[Gmsh] segfault in MTetrahedron::getVolume

Jeremy Theler jeremy at seamplex.com
Fri Sep 15 21:12:27 CEST 2017


Dear developers

I found this segfault (using latest git source) when trying to mesh the attached BREP directly with

$ gmsh -3 cube-sphere-cube-compound.brep

Thread 1 "gmsh" received signal SIGSEGV, Segmentation fault.
MTetrahedron::getVolume (this=<optimized out>) at /home/gtheler/codigos/3ros/build/gmsh/Geo/MTetrahedron.cpp:113
113       getMat(mat);
(gdb) where
#0  MTetrahedron::getVolume (this=<optimized out>) at /home/gtheler/codigos/3ros/build/gmsh/Geo/MTetrahedron.cpp:113
#1  0x0000555555a9654d in MTetrahedron::getVolumeSign (this=<optimized out>)
    at /home/gtheler/codigos/3ros/build/gmsh/Geo/MTetrahedron.h:122
#2  0x0000555555a7c79c in MElement::setVolumePositive (this=0x555556b875a0) at /home/gtheler/codigos/3ros/build/gmsh/Geo/MElement.cpp:456
#3  0x000055555598609b in GModel::setAllVolumesPositive (this=this at entry=0x555556b26330)
    at /home/gtheler/codigos/3ros/build/gmsh/Geo/GModel.cpp:810
#4  0x0000555555b25716 in OptimizeMeshNetgen (m=m at entry=0x555556b26330) at /home/gtheler/codigos/3ros/build/gmsh/Mesh/Generator.cpp:967
#5  0x0000555555b280d3 in GenerateMesh (m=m at entry=0x555556b26330, ask=<optimized out>)
    at /home/gtheler/codigos/3ros/build/gmsh/Mesh/Generator.cpp:1089
#6  0x0000555555986039 in GModel::mesh (this=this at entry=0x555556b26330, dimension=<optimized out>)
    at /home/gtheler/codigos/3ros/build/gmsh/Geo/GModel.cpp:797
#7  0x000055555580028a in GmshBatch () at /home/gtheler/codigos/3ros/build/gmsh/Common/Gmsh.cpp:312
#8  0x00005555557f379c in main (argc=3, argv=0x7fffffffe088) at /home/gtheler/codigos/3ros/build/gmsh/Fltk/Main.cpp:35
(gdb) 

As the stack seems to imply, the problem is in the optimization. So if I call the attached geo as

$ gmsh -3 cube-sphere-cube.geo

then Gmsh does not crash, but the resulting mesh is weird (3d-weird.png).
If I stick to 2D, the mesh is the expected one (2d-ok):

$ gmsh -2 cube-sphere-cube.geo

Any ideas?

--
jeremy

-------------- next part --------------
DBRep_DrawableShape

CASCADE Topology V1, (c) Matra-Datavision
Locations 4
1
              1               0               0             -15 
              0               1               0              -5 
              0               0               1              -5 
1
              1               0               0               0 
              0               1               0               0 
              0               0               1               0 
1
              1               0               0               5 
              0               1               0              -5 
              0               0               1              -5 
2  2 -1 0
Curve2ds 52
1 0 0 1 0 
1 0 0 1 0 
1 10 0 0 -1 
1 0 0 0 1 
1 0 -10 1 0 
1 0 0 1 0 
1 0 0 0 -1 
1 0 0 0 1 
1 0 0 0 1 
1 0 0 1 0 
1 0 0 1 0 
1 0 10 1 0 
1 10 0 0 1 
1 0 0 1 0 
1 10 0 0 1 
1 0 10 1 0 
1 10 0 0 -1 
1 10 0 0 1 
1 0 0 0 1 
1 0 10 1 0 
1 0 -10 1 0 
1 0 10 1 0 
1 0 0 0 -1 
1 10 0 0 1 
1 6.2831853071795862 -6.2831853071795862 0 1 
1 0 -6.2831853071795862 0 1 
1 0 -1.5707963267948966 1 0 
1 0 1.5707963267948966 1 0 
1 0 0 1 0 
1 0 0 1 0 
1 10 0 0 -1 
1 0 0 0 1 
1 0 0 0 -1 
1 0 0 0 1 
1 0 -10 1 0 
1 0 0 1 0 
1 0 0 0 1 
1 0 0 1 0 
1 0 0 1 0 
1 0 10 1 0 
1 10 0 0 1 
1 0 0 1 0 
1 10 0 0 1 
1 0 10 1 0 
1 10 0 0 -1 
1 10 0 0 1 
1 0 0 0 1 
1 0 10 1 0 
1 0 0 0 -1 
1 10 0 0 1 
1 0 -10 1 0 
1 0 10 1 0 
Curves 25
1 0 0 0 0 0 1 
1 0 0 10 -0 1 0 
1 0 10 0 0 0 1 
1 0 0 0 -0 1 0 
1 0 0 0 1 0 -0 
1 10 0 0 0 0 1 
1 0 0 10 1 0 -0 
1 0 10 10 1 0 -0 
1 10 0 10 0 1 0 
1 0 10 0 1 0 -0 
1 10 10 0 0 0 1 
1 10 0 0 -0 1 0 
2 0 0 0 -2.4492935982947064e-16 -1 0 1 -2.4492935982947064e-16 0 0 0 1 5
1 0 0 0 0 0 1 
1 0 0 10 -0 1 0 
1 0 0 0 -0 1 0 
1 0 10 0 0 0 1 
1 0 0 0 1 0 -0 
1 10 0 0 0 0 1 
1 0 0 10 1 0 -0 
1 0 10 10 1 0 -0 
1 10 0 10 0 1 0 
1 0 10 0 1 0 -0 
1 10 0 0 -0 1 0 
1 10 10 0 0 0 1 
Polygon3D 0
PolygonOnTriangulations 0
Surfaces 13
1 0 0 0 1 0 -0 0 0 1 0 -1 0 
1 0 0 0 -0 1 0 0 0 1 1 0 -0 
1 0 0 10 0 0 1 1 0 -0 -0 1 0 
1 0 10 0 -0 1 0 0 0 1 1 0 -0 
1 0 0 0 0 0 1 1 0 -0 -0 1 0 
1 10 0 0 1 0 -0 0 0 1 0 -1 0 
4 0 0 0 0 0 1 1 0 -0 -0 1 0 5
1 0 0 0 1 0 -0 0 0 1 0 -1 0 
1 0 0 0 -0 1 0 0 0 1 1 0 -0 
1 0 0 10 0 0 1 1 0 -0 -0 1 0 
1 0 0 0 0 0 1 1 0 -0 -0 1 0 
1 0 10 0 -0 1 0 0 0 1 1 0 -0 
1 10 0 0 1 0 -0 0 0 1 0 -1 0 
Triangulations 0

TShapes 81
Ve
1e-07
0 0 10
0 0

0101101
*
Ve
1e-07
0 0 0
0 0

0101101
*
Ve
1e-07
0 10 10
0 0

0101101
*
Ve
1e-07
0 10 0
0 0

0101101
*
Ve
1e-07
10 0 0
0 0

0101101
*
Ve
1e-07
10 0 10
0 0

0101101
*
Ve
1e-07
10 10 10
0 0

0101101
*
Ve
1e-07
10 10 0
0 0

0101101
*
Ve
2.00001e-07
5 -1.22464679914735e-15 -1.22464679914735e-15
0 0

0101101
*
Ve
1e-07
3.06161699786838e-16 -7.49879891330929e-32 5
0 0

0101101
*
Ve
1e-07
3.06161699786838e-16 -7.49879891330929e-32 -5
0 0

0101101
*
Ve
1e-07
0 0 10
0 0

0101101
*
Ve
1e-07
0 0 0
0 0

0101101
*
Ve
1e-07
0 10 10
0 0

0101101
*
Ve
1e-07
0 10 0
0 0

0101101
*
Ve
1e-07
10 0 0
0 0

0101101
*
Ve
1e-07
10 0 10
0 0

0101101
*
Ve
1e-07
10 10 10
0 0

0101101
*
Ve
1e-07
10 10 0
0 0

0101101
*
Ve
1e-07
-5 0 0
0 0

0101101
*
Ed
 1e-07 1 1 0
1  1 0 0 10
2  1 1 0 0 10
2  2 2 0 0 10
0

0101000
-81 0 +80 0 *
Ed
 1e-07 1 1 0
1  2 0 0 10
2  3 1 0 0 10
2  4 3 0 0 10
0

0101000
-79 0 +81 0 *
Ed
 1e-07 1 1 0
1  3 0 0 10
2  5 1 0 0 10
2  6 4 0 0 10
0

0101000
-79 0 +78 0 *
Ed
 1e-07 1 1 0
1  4 0 0 10
2  7 1 0 0 10
2  8 5 0 0 10
0

0101000
-78 0 +80 0 *
Ed
 1e-07 1 1 0
1  5 0 0 10
2  9 2 0 0 10
2  10 5 0 0 10
0

0101000
-77 0 +80 0 *
Ed
 1e-07 1 1 0
1  6 0 0 10
2  11 6 0 0 10
2  12 2 0 0 10
0

0101000
-76 0 +77 0 *
Ed
 1e-07 1 1 0
1  7 0 0 10
2  13 2 0 0 10
2  14 3 0 0 10
0

0101000
-76 0 +81 0 *
Ed
 1e-07 1 1 0
1  8 0 0 10
2  15 4 0 0 10
2  16 3 0 0 10
0

0101000
-75 0 +79 0 *
Ed
 1e-07 1 1 0
1  9 0 0 10
2  17 6 0 0 10
2  18 3 0 0 10
0

0101000
-75 0 +76 0 *
Ed
 1e-07 1 1 0
1  10 0 0 10
2  19 4 0 0 10
2  20 5 0 0 10
0

0101000
-74 0 +78 0 *
Ed
 1e-07 1 1 0
1  11 0 0 10
2  21 6 0 0 10
2  22 4 0 0 10
0

0101000
-75 0 +74 0 *
Ed
 1e-07 1 1 0
1  12 0 0 10
2  23 6 0 0 10
2  24 5 0 0 10
0

0101000
-74 0 +77 0 *
Ed
 1e-07 1 1 0
1  13 0 6.28318530717959 7.85398163397448
3  25 26CN 7 0 6.28318530717959 7.85398163397448
0

0101000
+73 4 -72 0 *
Ed
 1e-07 1 1 0
1  13 0 4.71238898038469 6.28318530717959
3  25 26CN 7 0 4.71238898038469 6.28318530717959
0

0101000
+71 0 -73 4 *
Ed
 1e-07 1 1 1
2  27 7 0 0 6.28318530717959
0

0101000
+71 0 -71 0 *
Ed
 1e-07 1 1 1
2  28 7 0 0 6.28318530717959
0

0101000
+72 0 -72 0 *
Ed
 1e-07 1 1 0
1  14 0 0 10
2  29 8 0 0 10
2  30 9 0 0 10
0

0101000
-70 0 +69 0 *
Ed
 1e-07 1 1 0
1  15 0 0 10
2  31 8 0 0 10
2  32 10 0 0 10
0

0101000
-68 0 +70 0 *
Ed
 1e-07 1 1 0
1  16 0 0 10
2  33 8 0 0 10
2  34 11 0 0 10
0

0101000
-67 0 +69 0 *
Ed
 1e-07 1 1 0
1  17 0 0 10
2  35 8 0 0 10
2  36 12 0 0 10
0

0101000
-68 0 +67 0 *
Ed
 1e-07 1 1 0
1  18 0 0 10
2  37 9 0 0 10
2  38 11 0 0 10
0

0101000
-66 0 +69 0 *
Ed
 1e-07 1 1 0
1  19 0 0 10
2  39 13 0 0 10
2  40 9 0 0 10
0

0101000
-65 0 +66 0 *
Ed
 1e-07 1 1 0
1  20 0 0 10
2  41 9 0 0 10
2  42 10 0 0 10
0

0101000
-65 0 +70 0 *
Ed
 1e-07 1 1 0
1  21 0 0 10
2  43 12 0 0 10
2  44 10 0 0 10
0

0101000
-64 0 +68 0 *
Ed
 1e-07 1 1 0
1  22 0 0 10
2  45 13 0 0 10
2  46 10 0 0 10
0

0101000
-64 0 +65 0 *
Ed
 1e-07 1 1 0
1  23 0 0 10
2  47 12 0 0 10
2  48 11 0 0 10
0

0101000
-63 0 +67 0 *
Ed
 1e-07 1 1 0
1  24 0 0 10
2  49 13 0 0 10
2  50 11 0 0 10
0

0101000
-63 0 +66 0 *
Ed
 1e-07 1 1 0
1  25 0 0 10
2  51 13 0 0 10
2  52 12 0 0 10
0

0101000
-64 0 +63 0 *
Wi

0101100
-61 0 -60 0 +59 0 +58 0 *
Wi

0101100
-57 0 -56 0 +55 0 +61 0 *
Wi

0101100
-60 0 -54 0 +53 0 +55 0 *
Wi

0101100
-52 0 -51 0 +54 0 +59 0 *
Wi

0101100
-58 0 -52 0 +50 0 +57 0 *
Wi

0101100
-56 1 -53 1 +50 1 +51 1 *
Wi

0101100
+49 2 +48 2 +47 2 -48 2 -49 2 -46 2 *
Wi

0101100
-45 3 -44 3 +43 3 +42 3 *
Wi

0101100
-41 0 -40 0 +39 0 +45 0 *
Wi

0101100
-44 0 -38 0 +37 0 +39 0 *
Wi

0101100
-43 0 -36 0 +35 0 +41 0 *
Wi

0101100
-36 0 -34 0 +38 0 +42 0 *
Wi

0101100
-40 0 -37 0 +34 0 +35 0 *
Fa
0  1e-07 1 0

0111000
+33 0 *
Fa
0  1e-07 2 0

0101000
+32 0 *
Fa
0  1e-07 3 0

0101000
+31 0 *
Fa
0  1e-07 4 0

0101000
+30 0 *
Fa
0  1e-07 5 0

0101000
+29 0 *
Fa
0  1e-07 6 1

0111000
+28 0 i62 0 *
Fa
0  1e-07 7 2

0111000
+27 0 i62 0 *
Fa
0  1e-07 8 3

0111000
+26 0 i73 0 *
Fa
0  1e-07 9 0

0101000
+25 0 *
Fa
0  1e-07 10 0

0101000
+24 0 *
Fa
0  1e-07 11 0

0101000
+23 0 *
Fa
0  1e-07 12 0

0101000
+22 0 *
Fa
0  1e-07 13 0

0111000
+21 0 *
Sh

0101100
-20 1 -19 1 +18 1 +17 1 -16 1 +15 0 *
Sh

0101100
+14 0 *
Sh

0101100
-13 0 -12 3 +11 3 -10 3 +9 3 +8 3 *
So

0100000
+7 0 *
So

0100000
+6 0 *
So

0100000
+5 0 *
Co

1100000
-81 1 +80 1 -79 1 -78 1 -77 1 -76 1 +75 1 +74 1 +73 0 -72 2 
+71 2 -70 3 +69 3 -68 3 +67 3 -66 3 -65 3 +64 3 -63 3 i62 0 
+61 1 +60 1 -59 1 -58 1 +57 1 +56 1 -55 1 -54 1 +53 1 -52 1 
-51 1 -50 1 +49 2 +48 2 +47 2 -46 2 +45 3 +44 3 -43 3 -42 3 
+41 3 +40 3 -39 3 -38 3 +37 3 +36 3 -35 3 -34 3 -33 1 -32 1 
+31 1 +30 1 -29 1 +28 0 +27 0 -26 0 -25 3 +24 3 -23 3 +22 3 
+21 3 -20 1 -19 1 +18 1 +17 1 -16 1 +15 0 +14 0 -13 0 -12 3 
+11 3 -10 3 +9 3 +8 3 +7 0 +6 0 +5 0 +4 0 +3 0 +2 0 
*

+1 0 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3d-weird.png
Type: image/png
Size: 68467 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20170915/df1cb27f/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2d-ok.png
Type: image/png
Size: 53877 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20170915/df1cb27f/attachment-0003.png>


More information about the gmsh mailing list