segmentation fault for polygons with "flat" bottoms

Issue #24 invalid
Former user created an issue

I'm getting a segmentation fault whenever I try to generate a mesh in which the bottom side falls on the x-axis:

from dolfin import *
from mshr import *

domain = [ Point(0.0, 0.0),
                  Point(1.0, 0.0),
                  Point(1.0, 1.0),
                  Point(0.0, 1.0),
                  Point(0.0, 0.0) ]

mesh = generate_mesh(Polygon(domain), 16)

I get the following when I try to run this code:

[PN105284:20600] Process received signal [PN105284:20600] Signal: Segmentation fault: 11 (11) [PN105284:20600] Signal code: Address not mapped (1) [PN105284:20600] Failing at address: 0x0 [PN105284:20600] [ 0] 2 libsystem_platform.dylib 0x00007fff8b35f5aa sigtramp + 26 [PN105284:20600] [ 1] 3 ??? 0x0000000000000000 0x0 + 0 [PN105284:20600] [ 2] 4 libmshr.1.4.dylib 0x000000010e02d8d9 _ZN4CGAL27Constrained_triangulation_2INS_5EpickENS_30Triangulation_data_structure_2INS_37Triangulation_vertex_base_with_info_2ImS1_NS_27Triangulation_vertex_base_2IS1_NS_30Triangulation_ds_vertex_base_2IvEEEEEE20Enriched_face_base_2IS1_NS_25Delaunay_mesh_face_base_2IS1_NS_37Constrained_triangulation_face_base_2IS1_NS_25Triangulation_face_base_2IS1_NS_28Triangulation_ds_face_base_2IvEEEEEEEEEEENS_20Exact_predicates_tagEE17insert_constraintENS_8internal11CC_iteratorINS_17Compact_containerINS3_ImS1_NS4_IS1_NS5_ISJ_EEEEEENS_7DefaultESS_SS_EELb0EEESU + 265 [PN105284:20600] [ 3] 5 libmshr.1.4.dylib 0x000000010e02c1f2 ZN4mshr22CSGCGALMeshGenerator2D8generateERKNS_11CSGGeometryERN6dolfin4MeshE + 1826 [PN105284:20600] [ 4] 6 libmshr.1.4.dylib 0x000000010e13b059 _ZN4mshr8generateERN6dolfin4MeshERKNS_11CSGGeometryEdNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE + 153 [PN105284:20600] [ 5] 7 _mshr.so 0x000000010de1ab7b _Z15_wrap__generateP7_objectS0 + 571 [PN105284:20600] [ 6] 8 Python 0x0000000105cc914d PyEval_EvalFrameEx + 8080 [PN105284:20600] [ 7] 9 Python 0x0000000105cc7093 PyEval_EvalCodeEx + 1641 [PN105284:20600] [ 8] 10 Python 0x0000000105ccd8c8 _PyEval_SliceIndex + 929 [PN105284:20600] [ 9] 11 Python 0x0000000105cca4d4 PyEval_EvalFrameEx + 13079 [PN105284:20600] [10] 12 Python 0x0000000105cc7093 PyEval_EvalCodeEx + 1641 [PN105284:20600] [11] 13 Python 0x0000000105cc6a24 PyEval_EvalCode + 54 [PN105284:20600] [12] 14 Python 0x0000000105ce5c2c PyParser_ASTFromFile + 306 [PN105284:20600] [13] 15 Python 0x0000000105ce5cd3 PyRun_FileExFlags + 137 [PN105284:20600] [14] 16 Python 0x0000000105ce5821 PyRun_SimpleFileExFlags + 718 [PN105284:20600] [15] 17 Python 0x0000000105cf6363 Py_Main + 2995 [PN105284:20600] [16] 18 libdyld.dylib 0x00007fff947a65fd start + 1 [PN105284:20600] [17] 19 ??? 0x0000000000000002 0x0 + 2 [PN105284:20600] End of error message Segmentation fault: 11

Comments (2)

  1. Benjamin Dam Kehlet

    Remove the first or the last point. mshr connects the first and the last point to get a closed polygon. In this case it sees a degenerate (length zero) segment. I will add a check for this to give a proper error message.

  2. Log in to comment