Segfault when creating Mesh from Polygon in python

Issue #40 invalid
Martin Sandve Alnæs created an issue

Am I doing something wrong? Mesh generation from Rectangle and Circle works fine on the same computer. Is there a demo of this somewhere? (didn't find one):

from dolfin import *
points = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)]
#points = reversed(points)
points = [Point(*p) for p in points]
polygon = Polygon(points)
mesh = Mesh(polygon, 10)

Comments (10)

  1. Anders Logg (Chalmers)

    Did you follow the docstring instructions?

    The points must be given in counter-clockwise order (without repeating the first/last vertex) and the polygon must not self intersect.

  2. Martin Sandve Alnæs reporter

    Thanks, it works now. I first used the pointlist from the mesh-generation C++ demo using PolygonalMeshGenerator, which was the closest thing I could find to a demo.

    And... you mean these docstring instructions?

    Type: type String Form:<class 'dolfin.cpp.mesh.Polygon'> File: /home/martinal/opt/fenics/dorsal-unstable/lib/python2.7/site-packages/dolfin/cpp/mesh.py Docstring: This class describes a 2D polygon which can be used to build geometries using Constructive Solid Geometry (CSG). Constructor information: Definition:Polygon(self, *args)

  3. Anders Logg (Chalmers)

    Why doesn't the constructor docstring get generated from the C++ constructor docstring? Is that a known bug?

  4. Martin Sandve Alnæs reporter

    Is it necessary to crash and burn when the input is malformed? Can an informative exception be thrown instead? Apart from that this was user error and can be closed.

  5. Anders Logg (Chalmers)

    Then a check would be needed and I suspect we just bundle stuff up and ship it to CGAL. But this is something Johannes and Benjamin know better. I'll close this issue as invalid but maybe they can comment further.

  6. Log in to comment