# Error reading file in triangulate

**URL:** <https://community.freefem.org/t/error-reading-file-in-triangulate/3021>\
**Category:** General Discussion\
**Created:** [March 7, 2024, 9:15pm UTC](https://community.freefem.org/t/error-reading-file-in-triangulate/3021 "2024-03-07T21:15:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![larismartins](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/larismartins/32/2712_2.png) [@larismartins](https://community.freefem.org/u/larismartins)\
**Post date:** [March 7, 2024, 9:15pm UTC](https://community.freefem.org/t/error-reading-file-in-triangulate/3021/1 "2024-03-07T21:15:30Z")

</div>

Hello,

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

```auto
 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

```auto
0 0
1200 0
1200 2200
600 0
600 1100
1200 1100

```

edge\_1.txt

```auto
0 0
1200 2200
0 2200
600 1100
0 1100
600 2200

```

and this is the loop:

```auto
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?

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [March 7, 2024, 9:39pm UTC](https://community.freefem.org/t/error-reading-file-in-triangulate/3021/2 "2024-03-07T21:39:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [March 11, 2024, 3:01pm UTC](https://community.freefem.org/t/error-reading-file-in-triangulate/3021/3 "2024-03-11T15:01:23Z")

</div>

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!.
