154a8ef01SBarry Smith /* 2f621e05eSBarry Smith Contains all error handling interfaces for PETSc. 354a8ef01SBarry Smith */ 445d48df9SBarry Smith #if !defined(__PETSCERROR_H) 545d48df9SBarry Smith #define __PETSCERROR_H 6*6c7e564aSBarry Smith 7e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN 8c22c1629SBarry Smith 954a8ef01SBarry Smith /* 1054a8ef01SBarry Smith Defines the directory where the compiled source is located; used 115e97870eSBarry Smith in printing error messages. Each makefile has an entry 125e97870eSBarry Smith LOCDIR = thedirectory 13330cf3c9SBarry Smith and bmake/common_variables includes in CCPPFLAGS -D__SDIR__=${LOCDIR} 14f621e05eSBarry Smith which is a flag passed to the C/C++ compilers. This declaration below 15f621e05eSBarry Smith is only needed if some code is compiled without the -D__SDIR__ 1654a8ef01SBarry Smith */ 17330cf3c9SBarry Smith #if !defined(__INSDIR__) 18330cf3c9SBarry Smith #define __INSDIR__ "unknowndirectory/" 1954a8ef01SBarry Smith #endif 2054a8ef01SBarry Smith 2154a8ef01SBarry Smith /* 224f227f7cSBarry Smith Defines the function where the compiled source is located; used 23f621e05eSBarry Smith in printing error messages. This is defined here in case the user 24f621e05eSBarry Smith does not declare it. 254f227f7cSBarry Smith */ 264a2ae208SSatish Balay #if !defined(__FUNCT__) 27da9b6338SBarry Smith #define __FUNCT__ "User provided function" 284f227f7cSBarry Smith #endif 294f227f7cSBarry Smith 304f227f7cSBarry Smith /* 31329ffe3dSLois Curfman McInnes These are the generic error codes. These error codes are used 32e2d1d2b7SBarry Smith many different places in the PETSc source code. The string versions are 330e5e90baSSatish Balay at src/sys/error/err.c any changes here must also be made there 340f9cf654SBarry Smith These are also define in include/finclude/petscerror.h any CHANGES here 350f9cf654SBarry Smith must be also made there. 3645d48df9SBarry Smith 3754a8ef01SBarry Smith */ 382a6744ebSBarry Smith #define PETSC_ERR_MIN_VALUE 54 /* should always be one less then the smallest value */ 392a6744ebSBarry Smith 4045d48df9SBarry Smith #define PETSC_ERR_MEM 55 /* unable to allocate requested memory */ 4147794344SBarry Smith #define PETSC_ERR_SUP 56 /* no support for requested operation */ 42e2d1d2b7SBarry Smith #define PETSC_ERR_SUP_SYS 57 /* no support for requested operation on this computer system */ 43e2d1d2b7SBarry Smith #define PETSC_ERR_ORDER 58 /* operation done in wrong order */ 4445d48df9SBarry Smith #define PETSC_ERR_SIG 59 /* signal received */ 45f1caa5a4SBarry Smith #define PETSC_ERR_FP 72 /* floating point exception */ 46a8c6a408SBarry Smith #define PETSC_ERR_COR 74 /* corrupted PETSc object */ 47a8c6a408SBarry Smith #define PETSC_ERR_LIB 76 /* error in library called by PETSc */ 48329ffe3dSLois Curfman McInnes #define PETSC_ERR_PLIB 77 /* PETSc library generated inconsistent data */ 49329ffe3dSLois Curfman McInnes #define PETSC_ERR_MEMC 78 /* memory corruption */ 50b3cc6726SBarry Smith #define PETSC_ERR_CONV_FAILED 82 /* iterative method (KSP or SNES) failed */ 511302d50aSBarry Smith #define PETSC_ERR_USER 83 /* user has not provided needed function */ 524e2ffeddSBarry Smith #define PETSC_ERR_SYS 88 /* error in system call */ 5345d48df9SBarry Smith 5445d48df9SBarry Smith #define PETSC_ERR_ARG_SIZ 60 /* nonconforming object sizes used in operation */ 5545d48df9SBarry Smith #define PETSC_ERR_ARG_IDN 61 /* two arguments not allowed to be the same */ 56a8c6a408SBarry Smith #define PETSC_ERR_ARG_WRONG 62 /* wrong argument (but object probably ok) */ 5745d48df9SBarry Smith #define PETSC_ERR_ARG_CORRUPT 64 /* null or corrupted PETSc object as argument */ 5845d48df9SBarry Smith #define PETSC_ERR_ARG_OUTOFRANGE 63 /* input argument, out of range */ 594f227f7cSBarry Smith #define PETSC_ERR_ARG_BADPTR 68 /* invalid pointer argument */ 604f227f7cSBarry Smith #define PETSC_ERR_ARG_NOTSAMETYPE 69 /* two args must be same object type */ 616831982aSBarry Smith #define PETSC_ERR_ARG_NOTSAMECOMM 80 /* two args must be same communicators */ 62d252947aSBarry Smith #define PETSC_ERR_ARG_WRONGSTATE 73 /* object in argument is in wrong state, e.g. unassembled mat */ 638cda6cd7SBarry Smith #define PETSC_ERR_ARG_TYPENOTSET 89 /* the type of the object has not yet been set */ 64a8c6a408SBarry Smith #define PETSC_ERR_ARG_INCOMP 75 /* two arguments are incompatible */ 654482741eSBarry Smith #define PETSC_ERR_ARG_NULL 85 /* argument is null that should not be */ 66958c9bccSBarry Smith #define PETSC_ERR_ARG_UNKNOWN_TYPE 86 /* type name doesn't match any registered type */ 674f227f7cSBarry Smith 684f227f7cSBarry Smith #define PETSC_ERR_FILE_OPEN 65 /* unable to open file */ 694f227f7cSBarry Smith #define PETSC_ERR_FILE_READ 66 /* unable to read from file */ 704f227f7cSBarry Smith #define PETSC_ERR_FILE_WRITE 67 /* unable to write to file */ 71a8c6a408SBarry Smith #define PETSC_ERR_FILE_UNEXPECTED 79 /* unexpected data in file */ 7245d48df9SBarry Smith 73329ffe3dSLois Curfman McInnes #define PETSC_ERR_MAT_LU_ZRPVT 71 /* detected a zero pivot during LU factorization */ 749e3b2f23SBarry Smith #define PETSC_ERR_MAT_CH_ZRPVT 81 /* detected a zero pivot during Cholesky factorization */ 7554a8ef01SBarry Smith 76bf3909cdSBarry Smith #define PETSC_ERR_FLOP_COUNT 90 77bf3909cdSBarry Smith #define PETSC_ERR_MAX_VALUE 91 /* this is always the one more than the largest error code */ 782a6744ebSBarry Smith 794b55f32eSBarry Smith #if defined(PETSC_USE_ERRORCHECKING) 8030de9b25SBarry Smith 8159aaf355SLisandro Dalcin #define PetscStringizeArg(a) #a 8259aaf355SLisandro Dalcin #define PetscStringize(a) PetscStringizeArg(a) 83330cf3c9SBarry Smith #define __SDIR__ PetscStringize(__INSDIR__) 84330cf3c9SBarry Smith 8530de9b25SBarry Smith /*MC 8630de9b25SBarry Smith SETERRQ - Macro that is called when an error has been detected, 8730de9b25SBarry Smith 8830de9b25SBarry Smith Not Collective 8930de9b25SBarry Smith 9030de9b25SBarry Smith Synopsis: 91f4442326SMatthew Knepley PetscErrorCode SETERRQ(PetscErrorCode errorcode,char *message) 9230de9b25SBarry Smith 9330de9b25SBarry Smith 9430de9b25SBarry Smith Input Parameters: 9530de9b25SBarry Smith + errorcode - nonzero error code, see the list of standard error codes in include/petscerror.h 9630de9b25SBarry Smith - message - error message 9730de9b25SBarry Smith 9830de9b25SBarry Smith Level: beginner 9930de9b25SBarry Smith 10030de9b25SBarry Smith Notes: 10130de9b25SBarry Smith Once the error handler is called the calling function is then returned from with the given error code. 10230de9b25SBarry Smith 10330de9b25SBarry Smith See SETERRQ1(), SETERRQ2(), SETERRQ3() for versions that take arguments 10430de9b25SBarry Smith 10558ebbce7SBarry Smith In Fortran MPI_Abort() is always called 10630de9b25SBarry Smith 10730de9b25SBarry Smith Experienced users can set the error handler with PetscPushErrorHandler(). 10830de9b25SBarry Smith 10930de9b25SBarry Smith Concepts: error^setting condition 11030de9b25SBarry Smith 11191d3bdf4SKris Buschelman .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3() 11230de9b25SBarry Smith M*/ 1134a2ae208SSatish Balay #define SETERRQ(n,s) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s);} 11430de9b25SBarry Smith 11530de9b25SBarry Smith /*MC 11630de9b25SBarry Smith SETERRQ1 - Macro that is called when an error has been detected, 11730de9b25SBarry Smith 11830de9b25SBarry Smith Not Collective 11930de9b25SBarry Smith 12030de9b25SBarry Smith Synopsis: 121f4442326SMatthew Knepley PetscErrorCode SETERRQ1(PetscErrorCode errorcode,char *formatmessage,arg) 12230de9b25SBarry Smith 12330de9b25SBarry Smith 12430de9b25SBarry Smith Input Parameters: 12530de9b25SBarry Smith + errorcode - nonzero error code, see the list of standard error codes in include/petscerror.h 12630de9b25SBarry Smith . message - error message in the printf format 12730de9b25SBarry Smith - arg - argument (for example an integer, string or double) 12830de9b25SBarry Smith 12930de9b25SBarry Smith Level: beginner 13030de9b25SBarry Smith 13130de9b25SBarry Smith Notes: 13230de9b25SBarry Smith Once the error handler is called the calling function is then returned from with the given error code. 13330de9b25SBarry Smith 13430de9b25SBarry Smith Experienced users can set the error handler with PetscPushErrorHandler(). 13530de9b25SBarry Smith 13630de9b25SBarry Smith Concepts: error^setting condition 13730de9b25SBarry Smith 13891d3bdf4SKris Buschelman .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ(), SETERRQ2(), SETERRQ3() 13930de9b25SBarry Smith M*/ 1404a2ae208SSatish Balay #define SETERRQ1(n,s,a1) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1);} 14130de9b25SBarry Smith 14230de9b25SBarry Smith /*MC 14330de9b25SBarry Smith SETERRQ2 - Macro that is called when an error has been detected, 14430de9b25SBarry Smith 14530de9b25SBarry Smith Not Collective 14630de9b25SBarry Smith 14730de9b25SBarry Smith Synopsis: 148f4442326SMatthew Knepley PetscErrorCode SETERRQ2(PetscErrorCode errorcode,char *formatmessage,arg1,arg2) 14930de9b25SBarry Smith 15030de9b25SBarry Smith 15130de9b25SBarry Smith Input Parameters: 15230de9b25SBarry Smith + errorcode - nonzero error code, see the list of standard error codes in include/petscerror.h 15330de9b25SBarry Smith . message - error message in the printf format 15430de9b25SBarry Smith . arg1 - argument (for example an integer, string or double) 15530de9b25SBarry Smith - arg2 - argument (for example an integer, string or double) 15630de9b25SBarry Smith 15730de9b25SBarry Smith Level: beginner 15830de9b25SBarry Smith 15930de9b25SBarry Smith Notes: 16030de9b25SBarry Smith Once the error handler is called the calling function is then returned from with the given error code. 16130de9b25SBarry Smith 16230de9b25SBarry Smith Experienced users can set the error handler with PetscPushErrorHandler(). 16330de9b25SBarry Smith 16430de9b25SBarry Smith Concepts: error^setting condition 16530de9b25SBarry Smith 1666024bd2cSBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ3() 16730de9b25SBarry Smith M*/ 1684a2ae208SSatish Balay #define SETERRQ2(n,s,a1,a2) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1,a2);} 16930de9b25SBarry Smith 17030de9b25SBarry Smith /*MC 17130de9b25SBarry Smith SETERRQ3 - Macro that is called when an error has been detected, 17230de9b25SBarry Smith 17330de9b25SBarry Smith Not Collective 17430de9b25SBarry Smith 17530de9b25SBarry Smith Synopsis: 176f4442326SMatthew Knepley PetscErrorCode SETERRQ3(PetscErrorCode errorcode,char *formatmessage,arg1,arg2,arg3) 17730de9b25SBarry Smith 17830de9b25SBarry Smith 17930de9b25SBarry Smith Input Parameters: 18030de9b25SBarry Smith + errorcode - nonzero error code, see the list of standard error codes in include/petscerror.h 18130de9b25SBarry Smith . message - error message in the printf format 18230de9b25SBarry Smith . arg1 - argument (for example an integer, string or double) 18330de9b25SBarry Smith . arg2 - argument (for example an integer, string or double) 18430de9b25SBarry Smith - arg3 - argument (for example an integer, string or double) 18530de9b25SBarry Smith 18630de9b25SBarry Smith Level: beginner 18730de9b25SBarry Smith 18830de9b25SBarry Smith Notes: 18930de9b25SBarry Smith Once the error handler is called the calling function is then returned from with the given error code. 19030de9b25SBarry Smith 191f621e05eSBarry Smith There are also versions for 4, 5, 6 and 7 arguments. 192f621e05eSBarry Smith 19330de9b25SBarry Smith Experienced users can set the error handler with PetscPushErrorHandler(). 19430de9b25SBarry Smith 19530de9b25SBarry Smith Concepts: error^setting condition 19630de9b25SBarry Smith 1976024bd2cSBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2() 19830de9b25SBarry Smith M*/ 1994a2ae208SSatish Balay #define SETERRQ3(n,s,a1,a2,a3) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1,a2,a3);} 20030de9b25SBarry Smith 2014a2ae208SSatish Balay #define SETERRQ4(n,s,a1,a2,a3,a4) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1,a2,a3,a4);} 202a30c184eSMatthew Knepley #define SETERRQ5(n,s,a1,a2,a3,a4,a5) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1,a2,a3,a4,a5);} 203a30c184eSMatthew Knepley #define SETERRQ6(n,s,a1,a2,a3,a4,a5,a6) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1,a2,a3,a4,a5,a6);} 204a30c184eSMatthew Knepley #define SETERRQ7(n,s,a1,a2,a3,a4,a5,a6,a7) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s,a1,a2,a3,a4,a5,a6,a7);} 205e855a17bSBarry Smith #define SETERRABORT(comm,n,s) {PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s);MPI_Abort(comm,n);} 2069a00fa46SSatish Balay 20730de9b25SBarry Smith /*MC 20830de9b25SBarry Smith CHKERRQ - Checks error code, if non-zero it calls the error handler and then returns 20930de9b25SBarry Smith 21030de9b25SBarry Smith Not Collective 21130de9b25SBarry Smith 21230de9b25SBarry Smith Synopsis: 213f4442326SMatthew Knepley PetscErrorCode CHKERRQ(PetscErrorCode errorcode) 21430de9b25SBarry Smith 21530de9b25SBarry Smith 21630de9b25SBarry Smith Input Parameters: 21730de9b25SBarry Smith . errorcode - nonzero error code, see the list of standard error codes in include/petscerror.h 21830de9b25SBarry Smith 21930de9b25SBarry Smith Level: beginner 22030de9b25SBarry Smith 22130de9b25SBarry Smith Notes: 22230de9b25SBarry Smith Once the error handler is called the calling function is then returned from with the given error code. 22330de9b25SBarry Smith 22430de9b25SBarry Smith Experienced users can set the error handler with PetscPushErrorHandler(). 2255324ea47SKris Buschelman 226fcecf507SKris Buschelman CHKERRQ(n) is fundamentally a macro replacement for 2275324ea47SKris Buschelman if (n) return(PetscError(...,n,...)); 2285324ea47SKris Buschelman 2295324ea47SKris Buschelman Although typical usage resembles "void CHKERRQ(PetscErrorCode)" as described above, for certain uses it is 2305324ea47SKris Buschelman highly inappropriate to use it in this manner as it invokes return(PetscErrorCode). In particular, 2315324ea47SKris Buschelman it cannot be used in functions which return(void) or any other datatype. In these types of functions, 23258ebbce7SBarry Smith you can use CHKERRV() which returns without an error code (bad idea since the error is ignored or 2335324ea47SKris Buschelman if (n) {PetscError(....); return(YourReturnType);} 23458ebbce7SBarry Smith where you may pass back a PETSC_NULL to indicate an error. You can also call CHKERRABORT(comm,n) to have 23558ebbce7SBarry Smith MPI_Abort() returned immediately. 23658ebbce7SBarry Smith 23758ebbce7SBarry Smith In Fortran MPI_Abort() is always called 23830de9b25SBarry Smith 23930de9b25SBarry Smith Concepts: error^setting condition 24030de9b25SBarry Smith 24191d3bdf4SKris Buschelman .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ2() 24230de9b25SBarry Smith M*/ 2439800092aSJed Brown #define CHKERRQ(n) if (PetscUnlikely(n)) {return PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0," ");} 24430de9b25SBarry Smith 2459800092aSJed Brown #define CHKERRV(n) if (PetscUnlikely(n)) {n = PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0," ");return;} 2469800092aSJed Brown #define CHKERRABORT(comm,n) if (PetscUnlikely(n)) {PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0," ");MPI_Abort(comm,n);} 2479800092aSJed Brown #define CHKERRCONTINUE(n) if (PetscUnlikely(n)) {PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0," ");} 24885614651SBarry Smith 249fd705b32SMatthew Knepley #ifdef PETSC_CLANGUAGE_CXX 250fd705b32SMatthew Knepley 251cc26af49SMatthew Knepley /*MC 252cc26af49SMatthew Knepley CHKERRXX - Checks error code, if non-zero it calls the C++ error handler which throws an exception 253cc26af49SMatthew Knepley 254cc26af49SMatthew Knepley Not Collective 255cc26af49SMatthew Knepley 256cc26af49SMatthew Knepley Synopsis: 257cc26af49SMatthew Knepley void CHKERRXX(PetscErrorCode errorcode) 258cc26af49SMatthew Knepley 259cc26af49SMatthew Knepley 260cc26af49SMatthew Knepley Input Parameters: 261cc26af49SMatthew Knepley . errorcode - nonzero error code, see the list of standard error codes in include/petscerror.h 262cc26af49SMatthew Knepley 263cc26af49SMatthew Knepley Level: beginner 264cc26af49SMatthew Knepley 265cc26af49SMatthew Knepley Notes: 266cc26af49SMatthew Knepley Once the error handler throws a ??? exception. 267cc26af49SMatthew Knepley 268cc26af49SMatthew Knepley You can use CHKERRV() which returns without an error code (bad idea since the error is ignored) 269cc26af49SMatthew Knepley or CHKERRABORT(comm,n) to have MPI_Abort() returned immediately. 270cc26af49SMatthew Knepley 271cc26af49SMatthew Knepley Concepts: error^setting condition 272cc26af49SMatthew Knepley 273cc26af49SMatthew Knepley .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKERRQ(), CHKMEMQ 274cc26af49SMatthew Knepley M*/ 2759800092aSJed Brown #define CHKERRXX(n) if (PetscUnlikely(n)) {PetscErrorCxx(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,0);} 276fd705b32SMatthew Knepley 277fd705b32SMatthew Knepley #endif 278fd705b32SMatthew Knepley 27930de9b25SBarry Smith /*MC 28030de9b25SBarry Smith CHKMEMQ - Checks the memory for corruption, calls error handler if any is detected 28130de9b25SBarry Smith 28230de9b25SBarry Smith Not Collective 28330de9b25SBarry Smith 28430de9b25SBarry Smith Synopsis: 28591d3bdf4SKris Buschelman CHKMEMQ; 28630de9b25SBarry Smith 28730de9b25SBarry Smith Level: beginner 28830de9b25SBarry Smith 28930de9b25SBarry Smith Notes: 290ff002950SBarry Smith Must run with the option -malloc_debug to enable this option 29130de9b25SBarry Smith 29230de9b25SBarry Smith Once the error handler is called the calling function is then returned from with the given error code. 29330de9b25SBarry Smith 29430de9b25SBarry Smith By defaults prints location where memory that is corrupted was allocated. 29530de9b25SBarry Smith 296f621e05eSBarry Smith Use CHKMEMA for functions that return void 297f621e05eSBarry Smith 29830de9b25SBarry Smith Concepts: memory corruption 29930de9b25SBarry Smith 3006024bd2cSBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(), 301ff002950SBarry Smith PetscMallocValidate() 30230de9b25SBarry Smith M*/ 303ff002950SBarry Smith #define CHKMEMQ {PetscErrorCode _7_ierr = PetscMallocValidate(__LINE__,__FUNCT__,__FILE__,__SDIR__);CHKERRQ(_7_ierr);} 30485614651SBarry Smith 305e68848bdSBarry Smith #define CHKMEMA {PetscMallocValidate(__LINE__,__FUNCT__,__FILE__,__SDIR__);} 306e68848bdSBarry Smith 3079dd39edbSMatthew Knepley #if defined(PETSC_UNDERSCORE_CHKERR) 3086849ba73SBarry Smith extern PetscErrorCode __gierr; 309f1af5d2fSBarry Smith #define _ __gierr = 310ac355199SBarry Smith #define ___ CHKERRQ(__gierr); 311f1af5d2fSBarry Smith #endif 312f1af5d2fSBarry Smith 313d5e45103SBarry Smith #define PETSC_EXCEPTIONS_MAX 256 314d5e45103SBarry Smith extern PetscErrorCode PetscErrorUncatchable[PETSC_EXCEPTIONS_MAX]; 315d5e45103SBarry Smith extern PetscInt PetscErrorUncatchableCount; 316d5e45103SBarry Smith extern PetscErrorCode PetscExceptions[PETSC_EXCEPTIONS_MAX]; 317d5e45103SBarry Smith extern PetscInt PetscExceptionsCount; 318d5e45103SBarry Smith 3196024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscExceptionPush(PetscErrorCode); 3201853238fSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscExceptionPop(PetscErrorCode); 321d5e45103SBarry Smith 322c132512eSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscErrorSetCatchable(PetscErrorCode,PetscTruth); 32321dd7e22SBarry Smith EXTERN PetscTruth PETSC_DLLEXPORT PetscErrorIsCatchable(PetscErrorCode); 32475febeb1SBarry Smith /*MC 32521dd7e22SBarry Smith PetscExceptionCaught - Indicates if a specific exception zierr was caught. 32675febeb1SBarry Smith 32775febeb1SBarry Smith Not Collective 32875febeb1SBarry Smith 32975febeb1SBarry Smith Synopsis: 33075febeb1SBarry Smith PetscTruth PetscExceptionCaught(PetscErrorCode xierr,PetscErrorCode zierr); 33175febeb1SBarry Smith 33275febeb1SBarry Smith Input Parameters: 3331853238fSBarry Smith + xierr - error code returned from PetscExceptionTry1() or other PETSc routine 33475febeb1SBarry Smith - zierr - error code you want it to be 33575febeb1SBarry Smith 33675febeb1SBarry Smith Level: advanced 33775febeb1SBarry Smith 33875febeb1SBarry Smith Notes: 33975febeb1SBarry Smith PETSc must not be configured using the option --with-errorchecking=0 for this to work 34075febeb1SBarry Smith 3411853238fSBarry Smith Use PetscExceptionValue() to see if an error code is being "tried" 34221dd7e22SBarry Smith 3431853238fSBarry Smith Concepts: exceptions, exception handling 34475febeb1SBarry Smith 34575febeb1SBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(), 34675febeb1SBarry Smith CHKERRQ(), PetscExceptionTry1(), PetscExceptionValue() 34775febeb1SBarry Smith M*/ 348d0f46423SBarry Smith PETSC_STATIC_INLINE PetscTruth PetscExceptionCaught(PetscErrorCode xierr,PetscErrorCode zierr) 349d0f46423SBarry Smith { 350d5e45103SBarry Smith PetscInt i; 351d5e45103SBarry Smith if (xierr != zierr) return PETSC_FALSE; 352d5e45103SBarry Smith for (i=0; i<PetscErrorUncatchableCount; i++) { 353d5e45103SBarry Smith if (PetscErrorUncatchable[i] == zierr) { 354d5e45103SBarry Smith return PETSC_FALSE; 355d5e45103SBarry Smith } 356d5e45103SBarry Smith } 357d5e45103SBarry Smith return PETSC_TRUE; 358d5e45103SBarry Smith } 359d5e45103SBarry Smith 36075febeb1SBarry Smith /*MC 36175febeb1SBarry Smith PetscExceptionValue - Indicates if the error code is one that is currently being tried 362d5e45103SBarry Smith 36375febeb1SBarry Smith Not Collective 36475febeb1SBarry Smith 36575febeb1SBarry Smith Synopsis: 36675febeb1SBarry Smith PetscTruth PetscExceptionValue(PetscErrorCode xierr); 36775febeb1SBarry Smith 36875febeb1SBarry Smith Input Parameters: 36975febeb1SBarry Smith . xierr - error code 37075febeb1SBarry Smith 37175febeb1SBarry Smith Level: developer 37275febeb1SBarry Smith 37375febeb1SBarry Smith Notes: 37475febeb1SBarry Smith PETSc must not be configured using the option --with-errorchecking=0 for this to work 37575febeb1SBarry Smith 37621dd7e22SBarry Smith Use PetscExceptionCaught() to see if the current error code is EXACTLY the one you want 37721dd7e22SBarry Smith 37875febeb1SBarry Smith Concepts: exceptions, exception hanlding 37975febeb1SBarry Smith 38075febeb1SBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(), 38175febeb1SBarry Smith CHKERRQ(), PetscExceptionTry1(), PetscExceptionCaught() 38275febeb1SBarry Smith M*/ 383d0f46423SBarry Smith PETSC_STATIC_INLINE PetscTruth PetscExceptionValue(PetscErrorCode zierr) 384d0f46423SBarry Smith { 385d5e45103SBarry Smith PetscInt i; 386d5e45103SBarry Smith for (i=0; i<PetscExceptionsCount; i++) { 387d5e45103SBarry Smith if (PetscExceptions[i] == zierr) { 388d5e45103SBarry Smith return PETSC_TRUE; 389d5e45103SBarry Smith } 390d5e45103SBarry Smith } 391d5e45103SBarry Smith return PETSC_FALSE; 392d5e45103SBarry Smith } 3936024bd2cSBarry Smith 3946024bd2cSBarry Smith /*MC 3956024bd2cSBarry Smith PetscExceptionTry1 - Runs the routine, causing a particular error code to be treated as an exception, 3966024bd2cSBarry Smith rather than an error. That is if that error code is treated the program returns to this level, 3976024bd2cSBarry Smith but does not call the error handlers 3986024bd2cSBarry Smith 3996024bd2cSBarry Smith Not Collective 4006024bd2cSBarry Smith 4016024bd2cSBarry Smith Synopsis: 4021853238fSBarry Smith PetscErrorCode PetscExceptionTry1(PetscErrorCode routine(....),PetscErrorCode); 4036024bd2cSBarry Smith 4046024bd2cSBarry Smith Level: advanced 4056024bd2cSBarry Smith 4061853238fSBarry Smith No Fortran Equivalent (see PetscExceptionPush() for Fortran) 4071853238fSBarry Smith 4086024bd2cSBarry Smith Notes: 4096024bd2cSBarry Smith PETSc must not be configured using the option --with-errorchecking=0 for this to work 4106024bd2cSBarry Smith 41175febeb1SBarry Smith Note: In general, the outer most try on an exception is the one that will be caught (that is trys down in 41275febeb1SBarry Smith PETSc code will not usually handle an exception that was issued above). See SNESSolve() for an example 41375febeb1SBarry Smith of how the local try is ignored if a higher (in the stack) one is also in effect. 4146024bd2cSBarry Smith 4156024bd2cSBarry Smith Concepts: exceptions, exception hanlding 4166024bd2cSBarry Smith 4176024bd2cSBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(), 41821dd7e22SBarry Smith CHKERRQ(), PetscExceptionCaught(), PetscExceptionPush(), PetscExceptionPop() 4196024bd2cSBarry Smith M*/ 4207b0215c6SHong Zhang extern PetscErrorCode PetscExceptionTmp,PetscExceptionTmp1; 4217b0215c6SHong Zhang #define PetscExceptionTry1(a,b) (PetscExceptionTmp1 = PetscExceptionPush(b)) ? PetscExceptionTmp1 : (PetscExceptionTmp1 = a, (PetscExceptionTmp = PetscExceptionPop(b)) ? PetscExceptionTmp : PetscExceptionTmp1) 4226024bd2cSBarry Smith 423f70662edSBarry Smith /* 424f70662edSBarry Smith Used by PetscExceptionTrySync(). Returns zierr on ALL processes in comm iff xierr is zierr on at least one process and zero on all others. 425f70662edSBarry Smith */ 426f70662edSBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscExceptionTrySync_Private(MPI_Comm comm,PetscErrorCode xierr,PetscErrorCode zierr) 427f70662edSBarry Smith { 428f70662edSBarry Smith PetscReal in[2],out[2]; 429f70662edSBarry Smith PetscErrorCode ierr; 430f70662edSBarry Smith 431f70662edSBarry Smith if (xierr != zierr) return xierr; 432f70662edSBarry Smith 433f70662edSBarry Smith in[0] = xierr; 434f70662edSBarry Smith in[1] = 0.0; /* dummy value */ 435f70662edSBarry Smith 436f70662edSBarry Smith ierr = MPI_Allreduce(in,out,2,MPIU_REAL,0,comm); if (ierr) {;} 437f70662edSBarry Smith return xierr; 438f70662edSBarry Smith } 439f70662edSBarry Smith 440f70662edSBarry Smith /*MC 441f70662edSBarry Smith PetscExceptionTrySyncNorm - Runs the routine, causing a particular error code to be treated as an exception, 442f70662edSBarry Smith rather than an error. That is if that error code is treated the program returns to this level, 443f70662edSBarry Smith but does not call the error handlers 444f70662edSBarry Smith 445f70662edSBarry Smith Collective on Comm 446f70662edSBarry Smith 447f70662edSBarry Smith Synopsis: 448f70662edSBarry Smith PetscExceptionTrySyncNorm(MPI_Comm comm,PetscErrorCode routine(....),PetscErrorCode); 449f70662edSBarry Smith 450f70662edSBarry Smith Level: advanced 451f70662edSBarry Smith 452f70662edSBarry Smith Notes: This synchronizes the error code across all processes in the communicator IF the code matches PetscErrorCode. The next 453f70662edSBarry Smith call with an MPI_Reduce()/MPI_Allreduce() MUST be VecNorm() [We can added VecDot() and maybe others as needed]. 454f70662edSBarry Smith 455f70662edSBarry Smith PETSc must not be configured using the option --with-errorchecking=0 for this to work 456f70662edSBarry Smith 457f70662edSBarry Smith Note: In general, the outer most try on an exception is the one that will be caught (that is trys down in 458f70662edSBarry Smith PETSc code will not usually handle an exception that was issued above). See SNESSolve() for an example 459f70662edSBarry Smith of how the local try is ignored if a higher (in the stack) one is also in effect. 460f70662edSBarry Smith 461f70662edSBarry Smith Concepts: exceptions, exception hanlding 462f70662edSBarry Smith 463f70662edSBarry Smith .seealso: PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), SETERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2(), SETERRQ3(), 464f70662edSBarry Smith CHKERRQ(), PetscExceptionCaught(), PetscExceptionPush(), PetscExceptionPop(), PetscExceptionTry1() 465f70662edSBarry Smith M*/ 466f70662edSBarry Smith #define PetscExceptionTrySyncNorm(comm,a,b) (PetscExceptionTmp = PetscExceptionPush(b)) ? PetscExceptionTmp : \ 467f70662edSBarry Smith (PetscExceptionTmp = a , PetscExceptionPop(b),PetscExceptionTrySyncNorm_Private(comm,PetscExceptionTmp,b)) 468f70662edSBarry Smith 46954a8ef01SBarry Smith #else 470f621e05eSBarry Smith 471f621e05eSBarry Smith /* 472f621e05eSBarry Smith These are defined to be empty for when error checking is turned off, with config/configure.py --with-errorchecking=0 473f621e05eSBarry Smith */ 474f621e05eSBarry Smith 47590d37a7cSBarry Smith #define SETERRQ(n,s) ; 47690d37a7cSBarry Smith #define SETERRQ1(n,s,a1) ; 47790d37a7cSBarry Smith #define SETERRQ2(n,s,a1,a2) ; 47890d37a7cSBarry Smith #define SETERRQ3(n,s,a1,a2,a3) ; 47990d37a7cSBarry Smith #define SETERRQ4(n,s,a1,a2,a3,a4) ; 4809bd8d7fdSSatish Balay #define SETERRQ5(n,s,a1,a2,a3,a4,a5) ; 481742f4fedSDinesh Kaushik #define SETERRQ6(n,s,a1,a2,a3,a4,a5,a6) ; 4821ee4faa0SMatthew Knepley #define SETERRABORT(comm,n,s) ; 48385614651SBarry Smith 4844f227f7cSBarry Smith #define CHKERRQ(n) ; 4851ee4faa0SMatthew Knepley #define CHKERRABORT(comm,n) ; 4861ee4faa0SMatthew Knepley #define CHKERRCONTINUE(n) ; 48785614651SBarry Smith #define CHKMEMQ ; 48885614651SBarry Smith 489f1af5d2fSBarry Smith #if !defined(PETSC_SKIP_UNDERSCORE_CHKERR) 490f1af5d2fSBarry Smith #define _ 491f1af5d2fSBarry Smith #define ___ 492f1af5d2fSBarry Smith #endif 493f1af5d2fSBarry Smith 4948da67ba8SSatish Balay #define PetscExceptionPush(a) 0 4951853238fSBarry Smith #define PetscExceptionPop(a) 0 496c132512eSBarry Smith #define PetscErrorSetCatchable(a,b) 0 4978da67ba8SSatish Balay #define PetscErrorIsCatchable(a) PETSC_FALSE 4988da67ba8SSatish Balay 499c132512eSBarry Smith #define PetscExceptionCaught(a,b) PETSC_FALSE 500c132512eSBarry Smith #define PetscExceptionValue(a) PETSC_FALSE 5016024bd2cSBarry Smith #define PetscExceptionTry1(a,b) a 502f70662edSBarry Smith #define PetscExceptionTrySyncNorm(comm,a,b) a 503f70662edSBarry Smith 50454a8ef01SBarry Smith #endif 50554a8ef01SBarry Smith 506ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscErrorPrintfInitialize(void); 507ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscErrorMessage(int,const char*[],char **); 5086024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscTraceBackErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 5090577ce7cSSatish Balay #if defined(PETSC_CLANGUAGE_CXX) && !defined(PETSC_USE_EXTERN_CXX) 510fd705b32SMatthew Knepley #include <sstream> 511fd705b32SMatthew Knepley EXTERN void PETSC_DLLEXPORT PetscTraceBackErrorHandlerCxx(int,const char *,const char *,const char *,PetscErrorCode,int, std::ostringstream&); 512fd705b32SMatthew Knepley #endif 5136024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscIgnoreErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 5146024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscEmacsClientErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 515e8fb0fc0SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMPIAbortErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 5166024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscAbortErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 5176024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscAttachDebuggerErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 518e93bc3c1Svictor EXTERN PetscErrorCode PETSC_DLLEXPORT PetscReturnErrorHandler(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*); 5196024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscError(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,...) PETSC_PRINTF_FORMAT_CHECK(7,8); 520ba174c67SMatthew Knepley EXTERN void PETSC_DLLEXPORT PetscErrorCxx(int,const char*,const char*,const char*,PetscErrorCode,int); 5216024bd2cSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPushErrorHandler(PetscErrorCode (*handler)(int,const char*,const char*,const char*,PetscErrorCode,int,const char*,void*),void*); 522ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPopErrorHandler(void); 523ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDefaultSignalHandler(int,void*); 524ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPushSignalHandler(PetscErrorCode (*)(int,void *),void*); 525ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPopSignalHandler(void); 526329f5518SBarry Smith 527329f5518SBarry Smith typedef enum {PETSC_FP_TRAP_OFF=0,PETSC_FP_TRAP_ON=1} PetscFPTrap; 528ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetFPTrap(PetscFPTrap); 52954a8ef01SBarry Smith 5303a40ed3dSBarry Smith /* 5313a40ed3dSBarry Smith Allows the code to build a stack frame as it runs 5323a40ed3dSBarry Smith */ 53351d3a450SBarry Smith #if defined(PETSC_USE_DEBUG) 5343a40ed3dSBarry Smith 535184914b5SBarry Smith #define PETSCSTACKSIZE 15 536184914b5SBarry Smith 5373a40ed3dSBarry Smith typedef struct { 5380e33f6ddSBarry Smith const char *function[PETSCSTACKSIZE]; 5390e33f6ddSBarry Smith const char *file[PETSCSTACKSIZE]; 5400e33f6ddSBarry Smith const char *directory[PETSCSTACKSIZE]; 541184914b5SBarry Smith int line[PETSCSTACKSIZE]; 542184914b5SBarry Smith int currentsize; 5433a40ed3dSBarry Smith } PetscStack; 5443a40ed3dSBarry Smith 545ff73aad6SKris Buschelman extern PETSC_DLLEXPORT PetscStack *petscstack; 546ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackCopy(PetscStack*,PetscStack*); 547ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackPrint(PetscStack*,FILE* fp); 548184914b5SBarry Smith 549184914b5SBarry Smith #define PetscStackActive (petscstack != 0) 5503a40ed3dSBarry Smith 5516d385327SIbrahima Ba 55230de9b25SBarry Smith /*MC 55330de9b25SBarry Smith PetscFunctionBegin - First executable line of each PETSc function 55430de9b25SBarry Smith used for error handling. 55530de9b25SBarry Smith 55630de9b25SBarry Smith Synopsis: 55730de9b25SBarry Smith void PetscFunctionBegin; 55830de9b25SBarry Smith 55930de9b25SBarry Smith Usage: 56030de9b25SBarry Smith .vb 56130de9b25SBarry Smith int something; 56230de9b25SBarry Smith 56330de9b25SBarry Smith PetscFunctionBegin; 56430de9b25SBarry Smith .ve 56530de9b25SBarry Smith 56630de9b25SBarry Smith Notes: 56730de9b25SBarry Smith Not available in Fortran 56830de9b25SBarry Smith 56930de9b25SBarry Smith Level: developer 57030de9b25SBarry Smith 57130de9b25SBarry Smith .seealso: PetscFunctionReturn() 57230de9b25SBarry Smith 57330de9b25SBarry Smith .keywords: traceback, error handling 57430de9b25SBarry Smith M*/ 5753a40ed3dSBarry Smith #define PetscFunctionBegin \ 576beb17490SBarry Smith {\ 577184914b5SBarry Smith if (petscstack && (petscstack->currentsize < PETSCSTACKSIZE)) { \ 5784a2ae208SSatish Balay petscstack->function[petscstack->currentsize] = __FUNCT__; \ 579184914b5SBarry Smith petscstack->file[petscstack->currentsize] = __FILE__; \ 580184914b5SBarry Smith petscstack->directory[petscstack->currentsize] = __SDIR__; \ 581184914b5SBarry Smith petscstack->line[petscstack->currentsize] = __LINE__; \ 582184914b5SBarry Smith petscstack->currentsize++; \ 5833a40ed3dSBarry Smith }} 5843a40ed3dSBarry Smith 5855cd90555SBarry Smith #define PetscStackPush(n) \ 586184914b5SBarry Smith {if (petscstack && (petscstack->currentsize < PETSCSTACKSIZE)) { \ 587184914b5SBarry Smith petscstack->function[petscstack->currentsize] = n; \ 588184914b5SBarry Smith petscstack->file[petscstack->currentsize] = "unknown"; \ 589184914b5SBarry Smith petscstack->directory[petscstack->currentsize] = "unknown"; \ 590184914b5SBarry Smith petscstack->line[petscstack->currentsize] = 0; \ 591184914b5SBarry Smith petscstack->currentsize++; \ 5925cd90555SBarry Smith }} 5933a40ed3dSBarry Smith 594d64ed03dSBarry Smith #define PetscStackPop \ 595184914b5SBarry Smith {if (petscstack && petscstack->currentsize > 0) { \ 596184914b5SBarry Smith petscstack->currentsize--; \ 597184914b5SBarry Smith petscstack->function[petscstack->currentsize] = 0; \ 598184914b5SBarry Smith petscstack->file[petscstack->currentsize] = 0; \ 599184914b5SBarry Smith petscstack->directory[petscstack->currentsize] = 0; \ 600184914b5SBarry Smith petscstack->line[petscstack->currentsize] = 0; \ 6015cd90555SBarry Smith }}; 602d64ed03dSBarry Smith 60330de9b25SBarry Smith /*MC 60430de9b25SBarry Smith PetscFunctionReturn - Last executable line of each PETSc function 60530de9b25SBarry Smith used for error handling. Replaces return() 60630de9b25SBarry Smith 60730de9b25SBarry Smith Synopsis: 60830de9b25SBarry Smith void PetscFunctionReturn(0); 60930de9b25SBarry Smith 61030de9b25SBarry Smith Usage: 61130de9b25SBarry Smith .vb 61230de9b25SBarry Smith .... 61330de9b25SBarry Smith PetscFunctionReturn(0); 61430de9b25SBarry Smith } 61530de9b25SBarry Smith .ve 61630de9b25SBarry Smith 61730de9b25SBarry Smith Notes: 61830de9b25SBarry Smith Not available in Fortran 61930de9b25SBarry Smith 62030de9b25SBarry Smith Level: developer 62130de9b25SBarry Smith 62230de9b25SBarry Smith .seealso: PetscFunctionBegin() 62330de9b25SBarry Smith 62430de9b25SBarry Smith .keywords: traceback, error handling 62530de9b25SBarry Smith M*/ 6265cd90555SBarry Smith #define PetscFunctionReturn(a) \ 627beb17490SBarry Smith {\ 62806d1fe2cSBarry Smith PetscStackPop; \ 6295cd90555SBarry Smith return(a);} 630d64ed03dSBarry Smith 631ff94ddecSSatish Balay #define PetscFunctionReturnVoid() \ 632ff94ddecSSatish Balay {\ 6331fceb228SKris Buschelman PetscStackPop; \ 6341fceb228SKris Buschelman return;} 635ff94ddecSSatish Balay 6366d385327SIbrahima Ba 6376d385327SIbrahima Ba #else 6386d385327SIbrahima Ba 6393a40ed3dSBarry Smith #define PetscFunctionBegin 6403a40ed3dSBarry Smith #define PetscFunctionReturn(a) return(a) 6415665465eSBarry Smith #define PetscFunctionReturnVoid() return 642d64ed03dSBarry Smith #define PetscStackPop 643d64ed03dSBarry Smith #define PetscStackPush(f) 644d64ed03dSBarry Smith #define PetscStackActive 0 6453a40ed3dSBarry Smith 6463a40ed3dSBarry Smith #endif 6473a40ed3dSBarry Smith 648ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackCreate(void); 649ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackView(PetscViewer); 650ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackDestroy(void); 651ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackPublish(void); 652ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStackDepublish(void); 6533a40ed3dSBarry Smith 65406d1fe2cSBarry Smith 655e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END 65606d1fe2cSBarry Smith #endif 657