Mmg type definition

Hello

The content of “mmg/mmg2d/libmmgtypes.h” and “mmg/mmg3d/libmmgtypes.h” are identical. Therefore the dedfinition of MMG5_Mesh is the same in both file. Should it be merged to make a common typedef file, such as “mmg/libmmgtypes.h” or is there a specific reason to separate? In fact, I’m surprised that the compiler does not complain when including libmmg.h, which implicitly includes the previous two files.

Best
Giang

Hello Giang and welcome to this forum,

You are right, the “libmmgtypes.h” file within the “mmg/mmg2d” directory is the same than the one within the “mmg/mmg3d” one: inside the source code, we have only one header file but it is copied into multiple locations at build/installation time so the user can choose to add only “mmg/mmg2d” to its include directories and to use only mmg2d (for example).
The compiler doesn’t complain when you include the libmmg.h header to your code because the definitions of the libmmgtypes.h file are wrapped into a preprocessor test and added only if they are not yet included (which means when the _LIBMMGTYPES_H variable is not defined).

Best Regards,
Algiane

1 Like