Error reading file in triangulate

Hello,

I’m trying to read a file to use in triangulate but I’m getting the following error:

 we read  6 coordinates  xy 
 we build 6 boundary edges
 we read  6 coordinates  xy 
  current line = 320
Assertion fail : (area > 0)
        line :303, in file ../femlib/fem.hpp
Assertion fail : (area > 0)
        line :303, in file ../femlib/fem.hpp
 err code 6 ,  mpirank 0

Those are the files:
edge_0.txt

0 0
1200 0
1200 2200
600 0
600 1100
1200 1100

edge_1.txt

0 0
1200 2200
0 2200
600 1100
0 1100
600 2200

and this is the loop:

mesh[int] Th(2);

//mesh size
real hSubMesh;

for(int K=0; K<2; K++){
    string fileNameW = "/edge_" + K + ".txt";
    // Submesh 
    Th[K] = triangulate(fileNameW);
                  
    Th[K] = trunc(Th[K], 1, split=2);
    // plot(Th[K], wait=1);    

    hSubMesh = Th[K].hmax; 
}

Has anyone ever encounter something like this?

If you run it with the option “-v 10000” it seems the second file is trying to make 5 triangles
instead of 4 although just looking at it I don’t see why. You could try moving the points
around a little or plot them to find any pathologies.

Yes, I know is problem, The Delaunay Mesh is sensible to round off error,

in file edge_1.txt the point 0 0, 600 1100 , 1200, 2200 are aligne and hid create 0 triangle => error
Bug ot not I have to check!.

1 Like