Relation between required faces or elements between remeshes


is there a way to know the relation (in terms of ids) between required faces or elements between remeshes ?
are they kept in the same order as they were given (not the same id but the same order) ?
I have faces or elements that are tagged required. I want re-evaluate fields efficiently on these faces/elements.

Best regards

After some experiments, it seems that required faces/elements are not ordered the same way before and after remeshing.
Is there a way to know the id relation of required faces/elements before and after remeshing ?

Yes, required tetrahedra and triangles have different IDs after remeshing (either due to calls to Scotch renumbering or due to mesh packing).
A practical (although not sophisticated) way to retrieve their original IDs is to store them in their reference field when defining the required elements through the API functions MMG3D_Set_tetrahedron and MMG3D_Set_triangle (or their ParMmg equivalents), since the reference field is always preserved during the adaptation. In parallel, the global IDs can do the trick.

Hope this helps.
Best regards,

indeed ! I should have thought about that. thanks a lot !!

1 Like

One caveat is that for Mmg the interface between elements with different references is seen as an immersed surface: so you will see more triangles (in 3D) in the output mesh. Anyway this should not be a problem as these triangles will also be required, and the additional cost/memory should be OK as long as not too many tetrahedra are set as required…

thanks for the remark.

in fact, we may either require element or facet. The later should be enough. I just need to keep track of the interface.
In my case, it is the surface of a swimmer(some parts are actually elastic).

Best regards


I have the same question with vertices: can one keep track of the positions (in the input file) of the vertices of required triangles after remeshing ? I have tried using MMG2D_Set_vertex to set the id of the vertices as references but did not succeed… If one has an example, it would be nice to look at it ! :slight_smile:

The objective would be to refill a P1 finite element function at some dofs (vertices) that were not modified after calling mmg (since some triangles are set to “required”)

May be there is a better way to do that by giving directly the P1 function to mmg before remeshing ?

Thank you for your help.


Normally it works: if the vertices are marked as required, which is the case if they belong to a required triangle, their references should be preserved during the remeshing.

I have tested on a small mesh (1.1 KB). Vertices 12, 14 and 25 are marked as required and are assign different references (resp. 1, 2 and 3). The remeshing seems preserving it (in library mode too).

It is a feature that is not used much, maybe are you facing a bug: what is doing your code exactly?

Thank you by advance,

Hi Algiane,

Thank you for your answer. It’s my bad, I thought I had to change the references of the vertices inside the call to mmg. If I mark my vertices before calling mmg, they are indeed preserved.

So, everything woks fine !
Sorry for the misunderstanding and thank you very much for your explanations !