Non-consistent exit statuses
The exit statuses of functions are non-consistent in the library, e.g., PMMG_Set_meshSize returns 1 on success, while PMMG_bdryUpdate returns PMMG_SUCCESS (defined to 0) on success. Would it be possible to follow the standard and always return 0 (or PMMG_SUCCESS) on success? Otherwise, it makes error checking in calling libraries extremely difficult to handle, see, e.g., https://gitlab.com/petsc/petsc/-/merge_requests/4889#note_863666426, as one needs to jump back and forth between if (return code != 1) // calling-library custom error-handling and if (return code != 0) // calling-library custom error-handling.
If you do not plan on addressing this in the near future, could you please generate two parsable lists of functions: the ones that return PMMG_SUCCESS on success and the ones that return 1 on success?
Hello,
I agree that this is ambiguous. The short answer is that internal functions should return 1 on success and 0 on failure, while "high level" functions (those in parmmg.c, libparmmg.cand libparmmg1.c should use exit codes PMMG_SUCCESS, PMMG_LOWFAILURE and PMMG_STRONGFAILURE to differentiate the two failing cases where a mesh can be returned to the user or not. Anyway the two conventions are mixed for functions provided in the API...
This behaviour has been basically inherited from Mmg so I think you will see the same problem in coupling Mmg.
I will see with @Algiane what we can do to make the behaviour more friendly for automatic error checking, either the list you suggest or fixing error codes for the functions provided in libparmmg.h.
You are correct, this is « consistent » with Mmg, see https://github.com/MmgTools/mmg/issues/131.
FYI @taupalosaurus