Error using MMG3D_Set_localParameter

Hello,

Initially I will explain briefly what I am trying to do. Suppose I have a volume (terrain) as shown in the figure 1, when I try to remesh it considering a metric based on the distance of some buildings (set of triangles), apart from remeshing in that area, I generate smaller elements between the edges of the contour faces (see second figure), to avoid this, we generate a list of local parameters with their specific properties ie maximum and minimum size and its corresponding local haussdorff values.


Figure 1


Figure 2

Before updating mmg everything worked fine but after updating I get this error.

MMG3D_Set_localParameter: You must set the number of local parameters with the MMG3D_Set_iparameters function before setting values in local parameters structure.

I understand that something has changed in the library, and that I am giving the wrong input to the method. Could you help me with this?

Hello,

In my understanding, this message is telling that, before calling MMG3D_Set_localParameter on a specific boundary, Mmg needs to know how many boundaries with custom parameters you want to set. This means that before calling MMG3D_Set_localParameter you need to do a call like:

MMG3D_Set_iparameter( mesh, sol, MMG3D_IPARAM_numberOfLocalParam, nparam )

with nparam = the number of boundaries on which you impose local parameters (you can check the syntax of API functions and all the MMG3D_*PARAM* parameters in libmmg3d.h).

Anyway, I have the feeling that this behaviour is not new, like I have used it for years… Can you specify what versions of Mmg are you using (before and after the problem)?

Hope this helps!
Luca

Hello,
Thanks for the help.
I know that the error is telling that I need to set the number of local parameters but MMG3D_Set_iparameter( mesh, sol, MMG3D_IPARAM_numberOfLocalParam, nparam ) it is been called before setting the local parameters, that is why I don’t understand why it is happenning.
If it is well for you I will insert here two links:

This solution as I told you previously was working fine with this version of mmg commit cf9bb59920584cf015a8262de2014392b75f92e5 (15 Oct 2021) and the problems appear when I use this version of mmg commit adf56d607e5d3f36a7b392c5e4996a32346fb3f5 (Dec 19 18:11:38 2022 )

I hope everything is clear and once again thanks for your help and time
Best regards
Uxue

Hello,
Thank you very much for the clarification, I was missing a bit of context :slight_smile:
I will have a look at the pull request and the code changes, and come back to you if I need to reproduce the problem by running Kratos+Mmg in a debugger.

Yours,
Luca