How to improve the quality of mesh generated with API mmg3dlib(mmgMesh,mmgSol)

How to improve the quality of mesh generated with API mmg3dlib(mmgMesh,mmgSol).
Does “-optim” has corresponding API functions.

Hi,

Each command line option of Mmg can be enabled using:

  • either the MMG3D_Set_iparameter API function for parameters without arguments or taking an integer argument,
  • or the MMG3D_Set_dparameter API function for parameters taking double arguments.

Both functions asks for:

  • a keyword with pattern MMG3D_IPARAM_<X> for integers and MMG3D_DPARAM_<X> for double, <X> being replaced by the name of the command line option;
  • a value for the parameter (In case of a command line parameter that doesn’t take argument, you must use the 0 value to disable the option (= not called in command line), and the 1 value to enable it (= called in command line));

Thus, in your case, the -optim option can be enabled using the following call in your code:

if ( MMG3D_Set_iparameter(mmgMesh,mmgSol, MMG3D_IPARAM_optim, 1) != 1 )
    exit(EXIT_FAILURE);

Note that you can genereate the DOxygen documentation with the following command lines:

cd mmg/build
make doc
firefox doc/mmg3d/html/index.html &

In the mmg3d -> file -> filelist -> libmmg3d.h section, you will find the list of authorized keywords.

Regards,
Algiane

ERROR: MISMATCH OPTIONS: OPTIM OPTION CAN NOT BE USED WITH AN INPUT METRIC.

I met this problem. How to resolve this?

Hello,

You must provide either a metric (= size map) or the optim option :

  • if you provide a size map, Mmg will try to create a good mesh that satisfies this input size map;
  • if you provide the optim option, Mmg will try to improve the mesh quality with respect to the sizes of the input edges (in practice, Mmg computes a size at each node as the mean of the length of the edges passing through this node);

Regards,

Algiane