The mmg3d application allows to discretize and optimize an implicitly defined surface (which mean a surface defined by a level-set function).
We start from the cube.mesh cube mesh and the discrete level-set function at the mesh nodes (elephant.sol file) displayed figure 1.
To split the domain on the 0 value of the level-set function:
mmg3d_O3 cube -sol elephant.sol -ls -nr -hausd 0.001 -hgrad 1.3 -hmax 0.05
- As previously, we specify the name of the .sol file, that contains here the level-set function values at mesh nodes, using the -sol option (more infos about the -sol option).
- The -ls option states that the input .sol file is in fact a level-set file and that we want to discretize the implicit surface defined by the 0 level of the level-set.
- A level-set function is a smooth function, thus we don’t want to detect ridges and we use the -nr option;
- The cube mesh bounding box size is of [1 x 1 x 1] thus a hausdorff parameter (-hausd option) of 0.001 allows to have a good surface approximation (more infos about the -hausd option).
- We increase the authorized ratio between consecutive edges using the -hgrad option (more infos about the -hgrad option).
- Last, the -hmax option ensure that we do not create edges longer than 0.05 (more infos about the -hmax option).
We obtain two domains separated by a surface that is an optimized mesh of the initial implicit surface (see figure 2).