Unwanted refinement at domain corners


We are trying to refine a 3D domain using a metric that depends on the values of a level set. Thus, the refinement is expected to be stronger close to the level set zero-level. In this case the level set representse a bunch of buildings:

The issue is that the output of the refinement is also refining considerably at the corners of the domain:

Is there any configuration parameter that we can change to avoid this refinement in the corners? Ideally we would like the corners to be as coarse as the rest of the faces far from the buildings.

We did some tests changing the detection angle “-ar” but it was not enough.

Here you can download the .msh and .sol files for this case:

Thank you!


Hi @marcnunez ,

Nice mesh ;-)!

Thecorners of the bounding box are refined because the sharp angle are not detected so Mmg perform a smooth reconstruction of the geometry and the Hausdorff criterion applies.

Usually, users that are using the level-set discretization option of Mmg provides explicitely the sharp angles of the bounding box to Mmg (ridges keyword) and run Mmg without the detection of sharp angles (-nr option). You can call Mmg in analysis mode only on your input mesh to detect the sharp angles before discretizing the level-set:
mmg3d_O3 -noinsert -noswap -nomove input.mesh -o input-with-ridges.mesh

Then you can call Mmg for the level-set discretization on this new mesh :
mmg3d_O3 -ls -nr input-with-ridges.mesh -sol input.sol -o output.mesh

Another solution (but not as good) can be to provide a local hausdorff value to the surface triangles of the bounding box (in this case you have to provide the external triangles explicitely and they must have a ref different from ref 10 which is reserved to the implicit surface). See the documentation here : Parameter file – Mmg Platform

Best Regards,

Hi Algiane!

Thanks for the quick reply!

Just to clarify, this remeshing was done in adaptation only mode (no level set cutting), where the metric was constructed using level set information. We are interested in running at the very end with “-ls” but only after getting a good representation of the buildings.

I have two questions from your reply:

  • How can we provide beforehand the ridges? Is there any specific API call for it? Does MMG3D_Set_edges automatically set it as a ridge?

  • Your second option is also viable from our side as we already have the explicit triangles anyway. I understand it is less robust and case-dependant right? Should we set the hausdorff value for an object of the size of the triangle or for an object size of the whole bounding box?

Thank you!


Thanks for the clarification! So if I understand well, your input mesh don’t contains any surface for the building, it is only refined around their implicit surfaces and you are visualizing (with cyan color) the 0 value of the level-set?

In this case, I am pretty surprise that the -ar option don’t work on your geometry, for example with a low value (40). I have tried on the file you attached and it works on my laptop.

To answer to your other points:

  • the Set_edges function provides only info about “reference” edges (i.e. edges with a specific color/material). You will have to use the MMG3D_Set_ridge function.
  • Second option is not less robust but it is slower (because if local parameters are provided, Mmg has to check at each entities if a local value is provided) but it can lead to a wrong approximation of the bounding box if unrefinment is authorized. The hausdorff value has to be setted as usually: considering the distance you want to authorize between a triangle and its curve reconstruction. In your case, if the metric that you provide prescribes almost the current edge size along the bounding box, it will forbid unrefinment so I think that you can set a large hausdorff value.

Best Regards