xref: /petsc/src/dm/impls/plex/adaptors/mmgcommon.h (revision bcee047adeeb73090d7e36cc71e39fc287cdbb97)
1 #ifndef PETSC_DM_PLEX_MMGCOMMON_H
2 #define PETSC_DM_PLEX_MMGCOMMON_H
3 
4 #include <petsc/private/dmpleximpl.h>
5 
6 #define PetscCallMMG_Private(ret, name, ...) \
7   do { \
8     PetscCall(PetscFPTrapPush(PETSC_FP_TRAP_OFF)); \
9     PetscStackPushExternal(PetscStringize(name)); \
10     int PETSC_UNUSED mmg_ierr_ = name(__VA_ARGS__); \
11     PetscStackPop; \
12     PetscCall(PetscFPTrapPop()); \
13     /* PetscCheck(mmg_ierr_ == (ret),PETSC_COMM_SELF,PETSC_ERR_LIB,"Error calling %s: error code %d",PetscStringize(__VA_ARGS__),mmg_ierr_); */ \
14   } while (0)
15 
16 // MMG sometimes returns 1, sometimes 0 when an error has occurred
17 #define PetscCallMMG(name, ...)             PetscCallMMG_Private(MMG5_SUCCESS, name, __VA_ARGS__)
18 #define PetscCallMMG_NONSTANDARD(name, ...) PetscCallMMG_Private(1, name, __VA_ARGS__)
19 #endif // PETSC_DM_PLEX_MMGCOMMON_H
20