Skip to content

Parmmg library

lcirrott edited this page Dec 5, 2019 · 1 revision

The ParMmg library is called by means of the API functions whose declarations are available in build/include/parmmg/libparmmg.h (after having built the project, see here).

Here we present how to setup a C program in order to initialize, call and finalize the ParMmg library. Some examples are available in the repository for the centralized library (see here) and the distributed library (see here).

Short C program setup guide

After building the project, variables and functions definitions for C projects using by ParMmg library can be found in the file build/include/parmmg/libparmmg.h.

Initialization

The pointer to the parmmg data structure is declared as

PMMG_pParMesh parmesh;

After having initialized MPI, parmesh is initialized with

PMMG_Init_parMesh(PMMG_ARG_start,
                  PMMG_ARG_ppParMesh, &parmesh,
                  PMMG_ARG_pMesh, PMMG_ARG_pMet,
                  PMMG_ARG_dim, 3,
                  PMMG_ARG_MPIComm, MPI_COMM_WORLD,
                  PMMG_ARG_end);

The function accepts variadic arguments. Here we initialized parmeshin order to be able to set a mesh and a metrics in three dimensions, using the standard MPI_COMM_WORLDcommunicator.

Mesh setup

Mesh structures can be filled either by setting every entity manually, or by loading mesh files (see the test cases listed above for more details).

In the distributed case, also parallel interfaces need to be set by the users. Either node or face interfaces have to be provided by the user. Again, this information can be set either manually or through the input mesh files. This section is work in progress, more information will be available soon

Mesh adaptation

The distributed library is run as

PMMG_parmmglib_distributed(parmesh);

Finalization

Finally, the adapted mesh can be recovered either by setting every entity manually, or by loading a mesh file (see again the test cases listed above), and the parmeshstructure is freed with

PMMG_Free_all(PMMG_ARG_start,PMMG_ARG_ppParMesh, &parmesh, PMMG_ARG_end);