Id of a node in a edge equal to 0


#1

Hi,

I am using right now the library of MMG2D, and I am sometimes getting with the API the Ids of edges equal to 0, but if I understood correctly the Ids start in 1. not 0.

My code is basically:

        int edge0, edge1, isRidge;
        
        if (MMG2D_Get_edge(mmgMesh, &edge0, &edge1, &prop_id, &isRidge, &isRequired) != 1 )
        {
            exit(EXIT_FAILURE);
        }

To solve the problem I am using the following tricky thing (which will give problems in the future for sure):

        if (edge0 == 0) edge0 = mmgMesh->np;
        if (edge1 == 0) edge1 = mmgMesh->np;

I am reporting because maybe is a bug, or maybe I am doing something wrong.

Best regards


#2

Hi,

It seems to be a bug in mmg2d.
Your initial code is perfect but the way you solve it can not work (you will have false edges in your mesh).

I was not able to reproduce your bug so can you please try to apply the joined patch with the following command:
cd mmg; git apply MMG2D_pack.patch

Does this work now?

MMG2D_pack.patch (752 Bytes)

Best regards,

Algiane


#3

Thanks, but I still have that error. You can see in the following video like some spurious wall conditions are created perturbing the solution:

I am going to try to avoid to create a condition when this happen. But apparently the problem persists.


#4

Hello,

I am not sure of what happens:

  • Is it possible to send me a minimal reproducer?
  • Are you on a recent release of the software (up to release 5.2.0)?
  • I suppose that you are using the library and, starting from the mesh 1 that is valid you have trouble to recover the edges of the resulting mesh (the mesh 2). Have you trouble using mmg2d with command line (did you obtain a mesh containing edges with 0 extremities)?

Thank you in advance,

Regards,

Algiane


#5

Hi I tried with using both, the API (version 5.2.1) and the executable file. Both cases give me the same result, In the following zip you can see the mesh before and after remesh (I included the metrics too). I have all the steps saved if you want more files to debug.

https://dl.dropboxusercontent.com/u/11225823/error_mmg2d.zip

Thank you very much


#6

Hello,

The error comes from a duplicated edge in the initial mesh (the edge of extremities 468 903). Mmg2d can not deal with duplicated entities (because it doesn’t detect it).

By removing the duplicated edge (see out_step=62_FIXED.mesh (591.8 KB)), I obtain a valid result.

Best regards,

Algiane


#7

Tank you very much, the thing is that the previous mesh it is generated by the MMG too, but maybe the problem is in the generation of our mesh I will check, anyway I will implement a duplicated check process and run again.

Merci beacoup


#8

Finally I needed to remove by hand in our code the repeated edges in the mesh, because the problem wasn’t our original mesh, the MMG2D is still creating this spurious edges. I attach you all the inputs and outputs *.mesh and *.sol of our simulation, maybe this way will be easier to detect what is the origin of the problem.

https://dl.dropboxusercontent.com/u/11225823/mesh_and_sol_all_process.tar.gz

Once I remove the conditions by “hand” I get the following solution:

Which is very nice, I hope this help you to find the origin of the problem


#9

Hi,

If we compare the files of the simulation and the first file that you provide me (with the duplicated edge), it seems that the duplicated edge 468 903 is created during the remeshing of the “out_step=22.mesh” file.

Can you confirm that this step creates the duplicated edge?

I am still not able to reproduce the bug, even with the whole input/output files of the simulation.
I use the following application that read the mesh, call the mmg2d library and write a mesh using the API function :
main.c (3.9 KB)

It prints the number of occurences of the edge 468-903. Does it create a duplicated edge for you?

If not, are you using some parameters when calling Mmg in your simulation? Are you working on linux or mac?

Thank you by advance for your help,

Regards,

Algiane


#10

Hello apparently my last message was not published, here is what I wrote:

Yes, I have the first repeated edge in the step 22, line 102. I am using MMG from Linux with the API and the last version 5.2.1.

https://dl.dropboxusercontent.com/u/11225823/output.txt