Implicit domain meshing¶
mmgs allows to discretize and optimize an implicitly defined line, i.e. a line defined by a level-set function. As input, mmgs takes a surfacic mesh, i.e. a set of triangles, and a solution file defining values of the level-set function at the nodes. It returns a new surfacic mesh that represents the same underlying geometry with the explicit discretization of the specified isovalue and the two conformingly connected domains defined by this isovalue.
Standard level-set discretization¶
In this example, the mesh teapot
mesh is used
as input data, and the distance function to a cube discretized at the mesh nodes
(teaport-distance.sol
) will serve as
level-set data. These data are displayed below.

Surface mesh of a teapot and input distance function¶
To split the input mesh on the 0
isovalue of the level-set function, run the
following command:
mmgs_O3 teapot -sol teapot-distance.sol -ls
The
.sol
file name that contains the level-set function values at mesh nodes is specified using the-sol
option.The
-ls
option states that the input.sol
file is a level-set file and that mmgs should discretize the implicit line defined by the0
isovalue. To specify any other value, it is possible to provide it as an argument to the-ls
option.
The output mesh of the previous command contains two conformingly connected
domains separated by a line that is a discretization of the initial 0
isovalue.
Note that by default, mmg enforces the reference (or color) of the isosurface and the domains:
The isoline is created with reference 10.
Triangles in the domain corresponding to the negative part of the distance function receive reference 3.
Triangles in the domain corresponding to the positive part of the distance function receive reference 2.

Output teapot mesh. The yellow line represents the isovalue 0 of the distance function, the green domain its positive part and the yellow one its negative part.¶
Preservation of input references¶
By default, mmgs resets references of the input mesh. In the previous example, the teapot has multiple references.

References of the input teapot mesh¶
It is possible to ask mmgs to preserve them, by running the following command:
mmgs_O3 teapot -sol cube-distance.sol -ls -keep-ref
The resulting mesh is displayed below.

Output mesh after isovalue discretization with preservation of input references. The newly discretized isoline is still depicted in yellow.¶
Note that, similarly to mmg2d and mmg3d, it is possible to preserve
input references using a parameter file. This method is more robust and allows
removal of small parasitic components (-rmc
option) as well as removal of
implicit domains not connected to specific boundary conditions
(LSBaseReference
mode).
Boundary level-set splitting¶
Finally, it is possible to only split domain boundaries along the level-set
while not splitting the interior of the mesh using -lssurf
option. In this
example, input data are the peninsula.mesh
mesh file, peninsula.sol
solution file and
peninsula.mmgs
reference mapping file. This
mapping file contains the following data:
LSReferences
5
1 10 11
2 3 4
38 5 6
37 7 8
0 nosplit
Then, run the following command:
mmgs_O3 -lssurf peninsula.mesh
The output mesh is displayed below:

Edge splitting using -lssurf
option¶
Mesh lines are split if they belong to reference different from 0 and are assigned the target references
Internal domains, consitutued of triangle, are not split
On this example, since feature edges are marked as ridges by mmg, it is needed to remove the display of the ridges from the output Medit file to see edge colors and replicate the display shown above.
Note that if a reference mapping file is provided, all boundary references should be mapped.