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