Erroneous edge reference from mmg2dlib

Hi, Algiane,

I am trying isotropic adaptation of a 2D mesh to a solution field. The refined mesh itself looks good but a couple of boundary edges come out with an unreasonable reference value, 1701607982. The input mesh’s boundary edges have 1, 2, 16 or 32 as their reference values, though.

I am using the API functions for MMG2D but the same problem occurs when the input mesh and solution are given to the stand-alone executable, mmg2d_O3.

The input and output meshes and solutions are attached below for your reference:
input mesh: mmg2d_test.meshb (17.1 KB)
input solution: mmg2d_test.sol (4.7 KB)
output mesh: mmg2d_test_optimized.meshb (69.9 KB)
output solution: mmg2d_test_optimized.sol (21.2 KB)

Best regards,
Eunseo

Hi Eunseo,

How have you created your initial .meshb file? With Mmg?

It seems that the last edge of the input file has the 1701607982 reference (at least, Mmg read this value in the binary file). Once this edge is splitted, you end up with 3 edges having this ref.

Best Regards,
Algiane

The input mesh is from my simulation code. It was converted to an MMG mesh object and then written to .meshb using MMG2D_saveMesh().

I’ll investigate again the source of the weird reference. It just occurred to me that the conversion might not be working as expected.

I’ll report back here soon. Thank you!

Best regards,
Eunseo

I found the source of the problem.

I was using the function, int MMG2D_Set_edges(MMG5_pMesh mesh, int *edges, int *refs). I didn’t realize that this function expects a refs array of the size of mesh->na + 1 so that indexing starts from 1. Since the function expects the index of edges array to start from 0, I assumed the same for refs.

I decided to set edges and refs individually using MMG2D_Set_edge() function.

Any ways, the issue has been resolved. Thank you for your help!

Best regards,
Eunseo

Hi Eunseo,

Thank you for the feedback.

The numbering in Mmg is a little tricky: entities indices are going from 1 to nb\_entity (fortran numbering) while other indices are going from 0 to size\_array-1.

I have tried to document it in the Doxygen documentation of the API functions (present in the libmmg2d.h file).

I think that on 2D test cases you will not see any difference between the speed of the individual edge setter and the array one!.

Regards,
Algiane