Mmg
Simplicial remeshers (mesh adaptation, isovalue discretization, lagrangian movement)
Basic use of the mmg3d library

I/ Implementation

To call the mmg3d library, you must:

  1. build mesh and sol at MMG5 format;
  2. call the MMG3D library;
  3. get the final mesh and sol.

example0_a

We read mesh and solution files using the MMG3D_loadMesh and MMG3D_loadSol functions. Results are saved using MMG3D_saveMesh and MMG3D_saveSol functions.

example0_b

The mesh and solution are hard coded.
They are build in MMG5 format using API functions and are recovered by the same way.
We show how to recover the mesh/sol by writting it in a file.

II/ Compilation

  1. Build and install the mmg3d shared and static library. We suppose in the following that you have installed the mmg3d library in the **_$CMAKE_INSTALL_PREFIX_** directory (see the installation section of the setup guide);
  2. compile the main.c file specifying:
    • the mmg3d include directory with the -I option;
    • the mmg3d library location with the -L option;
    • the mmg3d library name with the -l option;
    • for the static library you must also link the executable with, if used for the mmg3d library compilation, the scotch and scotcherr libraries and with the math library;
    • with the shared library, you must add the ***_$CMAKE_INSTALL_PREFIX_** directory to your LD_LIBRARY_PATH.

‍Example 1
Command line to link the application with the mmg3d static library (we supposed here that the scotch library is installed in the **_$SCOTCH_PATH_** directory):

gcc -I$CMAKE_INSTALL_PREFIX/include/mmg/mmg3d main.c -L$CMAKE_INSTALL_PREFIX/lib -L$SCOTCH_PATH -lmmg3d -lscotch -lscotcherr -lm

‍Example 2
Command line to link the application with the mmg3d shared library:

gcc -I$CMAKE_INSTALL_PREFIX/include/mmg/mmg3d main.c -L$CMAKE_INSTALL_PREFIX/lib -lmmg3d
export LD_LIBRARY_PATH=$CMAKE_INSTALL_PREFIX/lib:$LD_LIBRARY_PATH