Local hausdorff



I have:

  • a 3D mesh called mymesh.mesh whit boundouries 1, 2, 3
  • a solution on this mesh called mysol.sol;

Now I call mmg in this way:

exec("./mmg3d_O3 mymesh.mesh -sol mysol.sol -hgrad 100.0 -hausd 1.65 -hmax 5 -hmin 0.001");

were i use hausd =1.65 and hmax=5 everywere.

  1. I want different hausdorff in my domain; for do this i read the section on your site “Local parameters for boundaries” ( https://www.mmgtools.org/local-parameters-for-boundaries ) and i think it is good for my problem.

But i don’t understand how i can create the file parameter like this:


1 Triangles 0.001 5 1.65
2 Triangles 0.001 5 0.01
3 Triangles 0.001 5 1.65

So I want hausd=1.65 on label called 1 and 3; I want hausd=default on label 2.

  1. Then i don’t now how to call this parameter file:

exec("./mmg3d_O3 mymesh.mesh -sol mysol.sol ??? ");

Thank you



Hello Monica,

  1. Your parameter file looks fine to me.
    You can check if it gives you the wanted results in command line before doing it by calling Mmg in another application.
  • If this file is named DEFAULT.mmg3d, it must be located in the directory from which you run your application:
    for example, my application is in ~/mmg/build/bin/, my mesh and metric in ~/test_case/mesh/ and are named 2spheres.mesh/sol. I run my application in ~/test_exec/ :
    ~/mmg/build/bin/mmg3d_O3 ~/test_case/mesh/2spheres.mesh
    To be readed, the DEFAULT.mmg3d file must be in ~/test_exec/
    You can check in the mmg output that the default file is readed:
    -- INPUT DATA %% ~/test_case/2spheres.mesh OPENED %% ~/test_case/2spheres.sol OPENED
    %% DEFAULT.mmg3d OPENED

  • If this file is named using your mesh name root (mymesh.mmg3d for your example, 2spheres.mmg3d for mine), it must be located in the same directory than your mesh and solution. Which means, in my example in ~/test_case/mesh/
    With the same command line than in the previous example I can see that the 2spheres.mmg3d file is opened:
    -- INPUT DATA %% ~/test_case/2spheres.mesh OPENED %% ~/test_case/2spheres.sol OPENED
    %% ~/test_case/2spheres.mmg3d OPENED

  • Personally, I prefer using the test case name for the parameter file, it avoid to have a DEFAULT file that will apply on other test cases just because I forgot that it exists.

  • The beahviour of Mmg called inside the exec() command is the same than in command line: if you execute your script/application from a directory where you have a DEFAULT.mmg3d file, this file will be automatically readed. The same if you have a mymesh.mmg3d file located in the same path than your mesh file.




Thank you, now I’m using parameters file and it works!

I created a metric and i used it several times. But now i have this kind of problem:

SaveMesh3 relabel06_mymesh3.mesh 0x2fc92e0
NmbMsh=6NmbMsh=7exec: ./mmg3d_O3 relabel06_mymesh3.mesh -sol relabel06_mysol3.sol -hgrad 0. -hausd 1.65 -hmax 100 -hmin 1e-5

ERROR: WRONG METRIC AT POINT 203 – eigenvalue : -1.093376e+05 2.701696e+06 -1.093883e+05 – det 3.231298e+16

WRONG METRIC AT POINT 203 – metric -1.093385e+05 -1.099115e+02 -8.557892e+00 2.701019e+06 4.362456e+04 -1.087102e+05
– MMG3d, Release 5.2.6 (Apr. 10, 2017)
Copyright © IMB-LJLL, 2004-
Jul 13 2017 12:25:03

%% relabel06_mymesh3.mesh OPENED

     BAD ORIENTATION : vol < 0 --      279 tetra reoriented

%% relabel06_mysol3.sol OPENED
%% relabel06_mymesh3.mmg3d OPENED
– MMG3d, Release 5.2.6 (Apr. 10, 2017)
Copyright © IMB-LJLL, 2004-
Jul 13 2017 12:24:58


MODULE MMG3D: IMB-LJLL : 5.2.6 (Apr. 10, 2017)


initMesh relabel06_mymesh3.o.mesh
read mesh ok 1
, nt 0, nv 0 nbe: = 0
– Mesh3::Mesh3 Erreur openning relabel06_mymesh3.o.mesh
current line = 361
Assertion fail : (0)
line :158, in file …/femlib/Mesh3dn.cpp
Assertion fail : (0)
line :158, in file …/femlib/Mesh3dn.cpp
err code 5 , mpirank 0

I’m sure that all files are in the right place. There is an error and phase 2 doesn’t work.
Can you help me?
Thank you for your reply, it’s very usefull!



Hello Monika,

I have some questions:

  1. relabel06_mymesh3.mesh is an output mesh from Mmg?

    • If yes, it seems that we have created inverted elements, which is a bug. In this case, is it possible to send me the mesh used at the previous step (relabel06_mymesh2.mesh), the associated metric and the options used for the remesher (as well as the remesher version that you use)?

    • if no, the mesh contains elements that needs to be reorientated. It can have different origins:

      • if all the elements are inverted, there is no problem, the mesh is reorientated by Mmg and it must works.
      • if only some elements are inverted, it may be simply an orientation error (it will be corrected by Mmg) or it may be due to a non-conformal mesh (we do not detect this kind of problem so Mmg will try to run but it will probably crash).
  2. I have the same question for the metric file:

  • it is created by Mmg? If yes, is it possible to send it to me with the associated mesh file? If no, it seems that 1 metric cannot be diagonalized with strictly positive eigenvalues (so it is not a metric)
  1. For the missing mesh, I think that Mmg fails with a “strong failure” (its return value is equal to 2). In this case, it is not able to save a mesh and will not create the relabel06_mymesh3.o.mesh.