Questions about the 3d libexamples

Dear users and developers,

I am trying MMG3D’s built-in examples,
mmg-master/libexamples/mmg3d/adaptation_example0.
Here, example0_a load a mesh and solution file for adapdation.
example0_b defined mesh and solution inside the main.c file.

For my part, I need to define an internal boundary face(blue one in the fig), e.g., in example0_b,

if ( MMG3D_Set_triangle(mmgMesh, 7, 11, 9, 5,21) != 1 ) exit(EXIT_FAILURE);

Then run it with -opnbdy. In order to run -opnbdy, the following line was also added.

if ( !MMG3D_parsar(argc,argv,mmgMesh,mmgSol,NULL) ) return MMG5_STRONGFAILURE;

The results are nice.

But when I tried the same initial mesh and solution file using MMG3D_O3, the results are different from the static library and are bad. It seems the internal boundary face was kept.

The main.c file with static library and the input mesh and solution with MMG3D_O3 are all attached.

Thanks a lot.

Xiaodong test.mesh (657 Bytes)
test.sol (119 Bytes)

main.c (14.9 KB)

Dear Xiadong,

Thank you for your question. I would like to ask you for a few more details to make sure I understand your problem correctly.
Could you please provide me with the exact command line that you use for both versions of your test ? The one where you use mmg as a library and the one where you directly use the executable. Also, could you provide me with the output files that you obtain from both cases ?

Finally, which version of mmg are you using ?

Is your objective to reproduce the result from your first picture ? Should the blue interior faces should be kept and refined ?

I thank you in advance for your answers.

Warm regards,
Corentin

Thanks a lot, Corentin.
I made a mistake.
It seems it is the mmg version that caused the difference.
Version 5.7.0 kept the internal face and refined it ( This is what we want)while Version 5.8.0 just kept the internal face without refining.
Just run
mmg3d_o3 -opnbdy test

Thanks,
Xiaodong

Thanks a lot, Corentin.
I made a mistake.
It seems it is the mmg version that caused the difference.
Version 5.7.0 kept the internal face and refined it while Version 5.8.0 just kept the internal face without refining.

Thanks,
Xiaodong

Hi, Corentin,
By comparing 5.8.0 with 5.7.0, I found the code that cause the different final mesh.

In tools.3d.c, the subroutine MMG5_BezierNom() is responsible for this difference.
For line 600,
line 596 if ( MG_SIN(p0->tag) && MG_SIN(p1->tag) ) { // function should not be used in that case
memcpy(to,t0,3sizeof(double));
/
returning 1 here may create memory error afterward because no (that
* is not filled) will be used */
line 600 return 0; //return 1 for 5.7.0
}
When “return 0” is modified to “return 1”, the results from 5.8.0 will be same as that of 5.7.0.
From your notes here, returning zero may cause some errors. Could you please detail on this?

In addition, I tried the -opnbdy for the .island case. http://www.mmgtools.org/mmg-remesher-try-mmg/mmg-remesher-tutorials/mmg-remesher-mmg3d/open-boundary-remeshing
Just run
mmg3d_O3 -opndy island.mesh

But the internal surface can not be kept either with 5.7.0 or 5.8.0.
The first figure below is from 5.7.0.


The 2nd figure below is from 5.8.0

The initial mesh is listed as follows,

Is this expected?

Thanks a lot.

Xiaodong