Level-set re-meshing with with fixed skin

Hi,

I’m trying to re-mesh a domain conform to a level-set (3D mesh, with only tets). To be fast, I extract the sub-domain around the modified levelset and tag all the triangles on the skin as RequiredTriangles (red element in the image). I also ensure that the outside skin mesh is conform to the levelset (yellow and green line in the image) , so mmg does not need to modified it.

But mmg3D generate very degenerates tets, an also cuts mi skins triangles ( arrow on the second image), so the ReaquiredTriangles is not respected.

in the image (my problem is 3D, the image is only to explain my problem) :
Red line is the ouside skin (required triangles)
the yellow line is my old levelset (the mesh conforme to this levelset)
the green line is my new levelset, notice that the zero of the new and the old levelset are in the same place on the skin.

after the command :

mmg3d_O3 -ls 0.0 -nr -hmin 0.05 -hmax 0.15 meshfile -out solution.solb

the mesh is conform to the new levelset in the interior but new elements are generated on the surface and very degenerated tets (at the arrows).

I looked at the mmg sources and I found that the snap function (_MMG3D_snpval_ls) is doing something wrong, because my levelset is strictly zero (and I’m sure the levelset does not have any problem of maniford “moebius strip”). but the function _MMG3D_snpval_ls move some point of my surface to the value -0.0001.

attached are the original mesh and levelset, and the outputmesh mesh.zip (301.1 KB)

Any idea of how to fix this problem?
thanks
Felipe

Hi Felipe,
and thanks a lot for your message!
We have just made a commit in the develop branch which solves the problem: there was indeed a small bug in the function snapval_ls, arising solely in the case where the 0 level set you intend to discretize already exists in the mesh.
Thanks a lot again for letting us aware of the problem!!
Best,
Charles