Libraries

Some Libraries examples are provided in the mmg repository, under the libexamples directory. More particularly:

  • very simple examples with automatic parsing of .mesh files are provided in the libexamples/mmg<X>/adaptation_example0/example0_a folder (where <X> must be replaced by 2d, 3d or s depending on the library that you want to use);
  • still very simple examples but with manual mesh setters/getters are provided in the libexamples/mmg<X>/adaptation_example0/example0_b folder;
  • Examples of fortran calls can be found in the libexamples/mmg<X>/adaptation_example0_fortran/example0_<a|b> folders. These examples are the same than the previous ones. Most of the time, we provide a Fortran subroutine similar to the C API but with an additional argument to store the return value of the C function. Note that if the C API takes a string as argument, the Fortran one will use another additional argument as input: the string length;
  • An example of library call from a C++ code is provided in libexamples/mmg/adaptation_example0_cpp;
  • Even if we try to preserve the API compatibility between Mmg versions, we can have small modifications. In this case, you can use predefined macro (MMG_VERSION, MMG_VERSION_LE…) to detect the API version of Mmg in your code. An example is provided in the
    mmg/libexamples/mmg2d/adaptation_example0/example0_b/ directory (and its fortran version);

You can consult the Doxygen documentation for more informations about the API functions. To build it:

cd mmg
mkdir build && cd build
cmake ..
make doc

You can then open:

  •  the build/doc/mmg3d/html/index.html file with a web browser to access to the mmg3d doc;
  • the
  • build/doc/mmg2d/html/index.html file with a web browser to access to the mmg2d doc;
  • build/doc/mmgs/html/index.html file with a web browser to access to the mmgs doc;

The APIs documentation is available under the files->file list->libmmg<X>.h selection.

More informations on the library usage can be found in the github wiki of Mmg.

Comments are closed.