MMG3D how to identify the boundary label

Dear developer,

I tried to use Implicit domain meshing MMG3D to get an adaptive mesh based on 0 value of the level-set function by executing the following command:
mmg3d_O3 cube -sol elephant.sol -ls -nr -hausd 0.001 -hgrad 1.3 -hmax 0.05

after reading the mesh into FreeFem++, I need to identify the boundary label in order to apply the boundary condition. Could you please give me some suggestion about this?

Thanks a lot!

LvSet.o.mesh (1.7 MB)


Normally Mmg3d preserve the boundary labels of the input domain and create a new surface of label 10 at the interface of 2 volume domains of label 3 (inside the level-set) and 2 (outside the level-set).

On the linked mesh, I see only one volume domain (of label 2).

An interactive way to check the mesh labels is to use the Medit software to visualize your mesh:

~/bin/medit LvSet.o.mesh

Each color is associated to a label. To print the label of an element inside your terminal, just click on the wanted element using MAJ - left click. It prints something like that:

Picking result :
  Triangle  7931 : 5497, 6695, 7974    ref : 3 [MAT03]
  vertex    5497 : 0.009584 -0.001913 0.007286   ref 3
  vertex    6695 : 0.020711 -0.002783 0.005265   ref 3
  vertex    7974 : 0.014579 -0.002268 0.012605   ref 3

Inside Medit (and Mmg), we call the label “reference”, thus, here, the Triangle 7931 has the label (=ref) 3.

(Note that you can cut the mesh along a plane using the F1 command and move the plane using F2 and the mouse to see the volume mesh).



Dear Algiane,

Thanks so much for your solution. I tried your method, it does work well.
Now I can apply the boundary condition on the specified boundaries.

Best regards,