Error in a simple mesh generation from FreeFem++?

Hi there,
I’m trying to generate a mesh using FreeFem++ and the docker image (because packaging is broken right now on my OS).

While it works online using https://freefem.org/tryit (see the attached screenshot), it does not when using the docker container:

root@7a0b8b6a2f5e:/data# /usr/freefem/bin/FreeFem++ l.edp
-- FreeFem++ v4.7 (Fri Sep  4 03:15:07 UTC 2020 - git no git)
 Load: lg_fem lg_mesh lg_mesh3 eigenvalue
    1 : real clockwise = 10;
    2 : real anticlockwise = -10;
    3 : border b351434140(t=0., 1.){x=4.8266172+t*(4.8266342-4.8266172); y=45.747651+t*(45.7476708-45.747651); label=35143414;}
    4 : border b351434141(t=0., 1.){x=4.8266342+t*(4.8266534-4.8266342); y=45.7476708+t*(45.7476931-45.7476708); label=35143414;}
    5 : border b351434142(t=0., 1.){x=4.8266534+t*(4.8266557-4.8266534); y=45.7476931+t*(45.7476957-45.7476931); label=35143414;}
    6 : border b351434143(t=0., 1.){x=4.8266557+t*(4.826679-4.8266557); y=45.7476957+t*(45.747723-45.7476957); label=35143414;}
    7 : border b351434144(t=0., 1.){x=4.826679+t*(4.8266808-4.826679); y=45.747723+t*(45.747725-45.747723); label=35143414;}
    8 : border b351434145(t=0., 1.){x=4.8266808+t*(4.8266936-4.8266808); y=45.747725+t*(45.74774-45.747725); label=35143414;}
    9 : border b351434146(t=0., 1.){x=4.8266936+t*(4.8267194-4.8266936); y=45.74774+t*(45.74777-45.74774); label=35143414;}
   10 : border b351434147(t=0., 1.){x=4.8267194+t*(4.826749-4.8267194); y=45.74777+t*(45.7478045-45.74777); label=35143414;}
   11 : border b351434148(t=0., 1.){x=4.826749+t*(4.8267831-4.826749); y=45.7478045+t*(45.7478441-45.7478045); label=35143414;}
   12 : border b351434149(t=0., 1.){x=4.8267831+t*(4.8268092-4.8267831); y=45.7478441+t*(45.7478745-45.7478441); label=35143414;}
   13 : border b3514341410(t=0., 1.){x=4.8268092+t*(4.8268337-4.8268092); y=45.7478745+t*(45.747903-45.7478745); label=35143414;}
   14 : border b3514341411(t=0., 1.){x=4.8268337+t*(4.8268566-4.8268337); y=45.747903+t*(45.7479297-45.747903); label=35143414;}
   15 : border b3514341412(t=0., 1.){x=4.8268566+t*(4.824565-4.8268566); y=45.7479297+t*(45.7488883-45.7479297); label=35143414;}
   16 : border b3514341413(t=0., 1.){x=4.824565+t*(4.8245356-4.824565); y=45.7488883+t*(45.748854-45.7488883); label=35143414;}
   17 : border b3514341414(t=0., 1.){x=4.8245356+t*(4.8245137-4.8245356); y=45.748854+t*(45.7488285-45.748854); label=35143414;}
   18 : border b3514341415(t=0., 1.){x=4.8245137+t*(4.8244847-4.8245137); y=45.7488285+t*(45.7487947-45.7488285); label=35143414;}
   19 : border b3514341416(t=0., 1.){x=4.8244847+t*(4.8244537-4.8244847); y=45.7487947+t*(45.7487587-45.7487947); label=35143414;}
   20 : border b3514341417(t=0., 1.){x=4.8244537+t*(4.8244221-4.8244537); y=45.7487587+t*(45.7487219-45.7487587); label=35143414;}
   21 : border b3514341418(t=0., 1.){x=4.8244221+t*(4.8243962-4.8244221); y=45.7487219+t*(45.7486917-45.7487219); label=35143414;}
   22 : border b3514341419(t=0., 1.){x=4.8243962+t*(4.8243684-4.8243962); y=45.7486917+t*(45.7486594-45.7486917); label=35143414;}
   23 : border b3514341420(t=0., 1.){x=4.8243684+t*(4.8243342-4.8243684); y=45.7486594+t*(45.7486238-45.7486594); label=35143414;}
   24 : border b3514341421(t=0., 1.){x=4.8243342+t*(4.8243213-4.8243342); y=45.7486238+t*(45.7486046-45.7486238); label=35143414;}
   25 : border b3514341422(t=0., 1.){x=4.8243213+t*(4.8243059-4.8243213); y=45.7486046+t*(45.7485867-45.7486046); label=35143414;}
   26 : border b3514341423(t=0., 1.){x=4.8243059+t*(4.8242759-4.8243059); y=45.7485867+t*(45.7485517-45.7485867); label=35143414;}
   27 : border b3514341424(t=0., 1.){x=4.8242759+t*(4.8242416-4.8242759); y=45.7485517+t*(45.7485132-45.7485517); label=35143414;}
   28 : border b3514341425(t=0., 1.){x=4.8242416+t*(4.8242196-4.8242416); y=45.7485132+t*(45.7484886-45.7485132); label=35143414;}
   29 : border b3514341426(t=0., 1.){x=4.8242196+t*(4.824185-4.8242196); y=45.7484886+t*(45.7484498-45.7484886); label=35143414;}
   30 : border b3514341427(t=0., 1.){x=4.824185+t*(4.8241644-4.824185); y=45.7484498+t*(45.7484219-45.7484498); label=35143414;}
   31 : border b3514341428(t=0., 1.){x=4.8241644+t*(4.8252637-4.8241644); y=45.7484219+t*(45.747962-45.7484219); label=35143414;}
   32 : border b3514341429(t=0., 1.){x=4.8252637+t*(4.8253519-4.8252637); y=45.747962+t*(45.7479253-45.747962); label=35143414;}
   33 : border b3514341430(t=0., 1.){x=4.8253519+t*(4.826456-4.8253519); y=45.7479253+t*(45.7474634-45.7479253); label=35143414;}
   34 : border b3514341431(t=0., 1.){x=4.826456+t*(4.8264849-4.826456); y=45.7474634+t*(45.7474941-45.7474634); label=35143414;}
   35 : border b3514341432(t=0., 1.){x=4.8264849+t*(4.8265158-4.8264849); y=45.7474941+t*(45.7475311-45.7474941); label=35143414;}
   36 : border b3514341433(t=0., 1.){x=4.8265158+t*(4.8265376-4.8265158); y=45.7475311+t*(45.7475572-45.7475311); label=35143414;}
   37 : border b3514341434(t=0., 1.){x=4.8265376+t*(4.8265704-4.8265376); y=45.7475572+t*(45.7475965-45.7475572); label=35143414;}
   38 : border b3514341435(t=0., 1.){x=4.8265704+t*(4.8266064-4.8265704); y=45.7475965+t*(45.7476384-45.7475965); label=35143414;}
   39 : border b3514341436(t=0., 1.){x=4.8266064+t*(4.8266172-4.8266064); y=45.7476384+t*(45.747651-45.7476384); label=35143414;}
   40 : mesh Th = buildmesh(b351434140(clockwise)+b351434141(clockwise)+b351434142(clockwise)+b351434143(clockwise)+b351434144(clockwise)+b351434145(clockwise)+b351434146(clockwise)+b351434147(clockwise)+b351434148(clockwise)+b351434149(clockwise)+b3514341410(clockwise)+b3514341411(clockwise)+b3514341412(clockwise)+b3514341413(clockwise)+b3514341414(clockwise)+b3514341415(clockwise)+b3514341416(clockwise)+b3514341417(clockwise)+b3514341418(clockwise)+b3514341419(clockwise)+b3514341420(clockwise)+b3514341421(clockwise)+b3514341422(clockwise)+b3514341423(clockwise)+b3514341424(clockwise)+b3514341425(clockwise)+b3514341426(clockwise)+b3514341427(clockwise)+b3514341428(clockwise)+b3514341429(clockwise)+b3514341430(clockwise)+b3514341431(clockwise)+b3514341432(clockwise)+b3514341433(clockwise)+b3514341434(clockwise)+b3514341435(clockwise)+b3514341436(clockwise));
   41 : plot(Th, ps="/data/Thwithouthole.eps");
   42 :  sizestack + 1024 =1864  ( 840 )

689 Problem: insert point 687([951477307,108774789],[4.82665,45.7477]{6.31137e-07,6.31137e-07,[1,0]})1122 tcvj = 0x7fabd1351148 0
([1024935376,194901279],[4.82686,45.7479]{0.00012596,0.00012596,[1,0]})([890714664,37610599],[4.82649,45.7475]{4.66524e-06,4.66524e-06,[1,0]})
([1024935376,194901279],[4.82686,45.7479]{0.00012596,0.00012596,[1,0]})([890714664,37610599],[4.82649,45.7475]{4.66524e-06,4.66524e-06,[1,0]})
 Fatal error in the mesh generator 1001
  current line = 3
Meshing error: Bamg
 number : 1001,
 catch Err bamg
Meshing error: Bamg
 number : 1001,
 err code 5 ,  mpirank 0

Any idea what’s the problem with this code? (Source is there: https://0x0.st/ilNu.txt )

Thanks,
Rémy

Another simpler example:

# cat l.edp
real clockwise = 100;
real anticlockwise = -100;
border building0poly0boundary0point0(t=0., 1.){x=4.8184454+t*(4.8183747-4.8184454); y=45.7308329+t*(45.7306317-45.7308329);}
border building0poly0boundary0point1(t=0., 1.){x=4.8183747+t*(4.818315-4.8183747); y=45.7306317+t*(45.7308105-45.7306317);}
border building0poly0boundary0point2(t=0., 1.){x=4.818315+t*(4.8183586-4.818315); y=45.7308105+t*(45.7309346-45.7308105);}
border building0poly0boundary0point3(t=0., 1.){x=4.8183586+t*(4.8183398-4.8183586); y=45.7309346+t*(45.7309856-45.7309346);}
border building0poly0boundary0point4(t=0., 1.){x=4.8183398+t*(4.8183639-4.8183398); y=45.7309856+t*(45.7310633-45.7309856);}
border building0poly0boundary0point5(t=0., 1.){x=4.8183639+t*(4.8184454-4.8183639); y=45.7310633+t*(45.7308329-45.7310633);}
mesh Th = buildmesh(building0poly0boundary0point0(anticlockwise)+building0poly0boundary0point1(anticlockwise)+building0poly0boundary0point2(anticlockwise)+building0poly0boundary0point3(anticlockwise)+building0poly0boundary0point4(anticlockwise)+building0poly0boundary0point5(anticlockwise));
plot(Th, ps="/data/Thwithouthole.eps");

And the result:

# FreeFem++ l.edp
-- FreeFem++ v4.7 (Fri Sep  4 03:15:07 UTC 2020 - git no git)
 Load: lg_fem lg_mesh lg_mesh3 eigenvalue
    1 : real clockwise = 100;
    2 : real anticlockwise = -100;
    3 : border building0poly0boundary0point0(t=0., 1.){x=4.8184454+t*(4.8183747-4.8184454); y=45.7308329+t*(45.7306317-45.7308329);}
    4 : border building0poly0boundary0point1(t=0., 1.){x=4.8183747+t*(4.818315-4.8183747); y=45.7306317+t*(45.7308105-45.7306317);}
    5 : border building0poly0boundary0point2(t=0., 1.){x=4.818315+t*(4.8183586-4.818315); y=45.7308105+t*(45.7309346-45.7308105);}
    6 : border building0poly0boundary0point3(t=0., 1.){x=4.8183586+t*(4.8183398-4.8183586); y=45.7309346+t*(45.7309856-45.7309346);}
    7 : border building0poly0boundary0point4(t=0., 1.){x=4.8183398+t*(4.8183639-4.8183398); y=45.7309856+t*(45.7310633-45.7309856);}
    8 : border building0poly0boundary0point5(t=0., 1.){x=4.8183639+t*(4.8184454-4.8183639); y=45.7310633+t*(45.7308329-45.7310633);}
    9 : mesh Th = buildmesh(building0poly0boundary0point0(anticlockwise)+building0poly0boundary0point1(anticlockwise)+building0poly0boundary0point2(anticlockwise)+building0poly0boundary0point3(anticlockwise)+building0poly0boundary0point4(anticlockwise)+building0poly0boundary0point5(anticlockwise));
   10 : plot(Th, ps="/data/Thwithouthole.eps");
   11 :  sizestack + 1024 =1368  ( 344 )

8272 Problem: insert point 8206([93579005,784780268],[4.81835,45.731]{5.65531e-07,5.65531e-07,[1,0]})8300 tcvj = 0x7fa2db2ea348 0
([94800954,681052721],[4.81835,45.7309]{1.31536e-06,1.31536e-06,[1,0]})([93767014,786995666],[4.81835,45.731]{5.43548e-07,5.43548e-07,[1,0]})
([94800954,681052721],[4.81835,45.7309]{1.31536e-06,1.31536e-06,[1,0]})([93767014,786995666],[4.81835,45.731]{5.43548e-07,5.43548e-07,[1,0]})
 Fatal error in the mesh generator 1001
  current line = 3
Meshing error: Bamg
 number : 1001,
 catch Err bamg
Meshing error: Bamg
 number : 1001,
 err code 5 ,  mpirank 0

The figure as plotted by matplotlib:

This is due to machine epsilons in the definition of your borders. Weird that it does not happen on the online demo though…

Thanks,

I thought about that but I was expecting freefem to used arbitrary precision. Is there some way to the “epsilon” used for comparison between points ? What’s the number format used by FreeFem? IEEE754? Is double precision available?

The online implementation is probably using javascript, so, different implementation of the number representation…

Is double precision available?

It’s the only available precision.

The online implementation is probably using javascript

No, it’s using FreeFEM under the hood, just a different version.