1 #if !defined(__PETSC_P4EST_PACKAGE_H) 2 #define __PETSC_P4EST_PACKAGE_H 3 #include <petscsys.h> 4 5 #if defined(PETSC_HAVE_SETJMP_H) && defined(PETSC_USE_ERRORCHECKING) 6 #include <setjmp.h> 7 PETSC_INTERN jmp_buf PetscScJumpBuf; 8 9 #define PetscStackCallP4est(func,args) do { \ 10 if (setjmp(PetscScJumpBuf)) { \ 11 return PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,PETSC_ERR_LIB,PETSC_ERROR_REPEAT,"Error in p4est/libsc call %s()",#func); \ 12 } \ 13 else { \ 14 PetscStackPush(#func); \ 15 func args; \ 16 PetscStackPop; \ 17 } \ 18 } while (0) 19 #define PetscStackCallP4estReturn(ret,func,args) do { \ 20 if (setjmp(PetscScJumpBuf)) { \ 21 return PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,PETSC_ERR_LIB,PETSC_ERROR_REPEAT,"Error in p4est/libsc call %s()",#func); \ 22 } \ 23 else { \ 24 PetscStackPush(#func); \ 25 ret = func args; \ 26 PetscStackPop; \ 27 } \ 28 } while (0) 29 #else 30 #define PetscStackCallP4est(func,args) do { \ 31 if (setjmp(PetscScJumpBuf)) { \ 32 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in p4est/libsc call %s()",#func); \ 33 } \ 34 else { \ 35 PetscStackPush(#func); \ 36 func args; \ 37 PetscStackPop; \ 38 } \ 39 } while (0) 40 #define PetscStackCallP4estReturn(ret,func,args) do { \ 41 if (setjmp(PetscScJumpBuf)) { \ 42 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in p4est/libsc call %s()",#func); \ 43 } \ 44 else { \ 45 PetscStackPush(#func); \ 46 ret = func args; \ 47 PetscStackPop; \ 48 } \ 49 } while (0) 50 #endif 51 52 PETSC_EXTERN PetscErrorCode PetscP4estInitialize(); 53 54 #endif 55