Segfault when meshing a difference

Issue #37 resolved
Former user created an issue

I am experiencing a segfault when trying to generate_mesh on a difference. Here is a snippet

    mshr::Rectangle channel(Point(0,0,0),Point(L,H,0));
    mshr::Circle obstacle(Point(xc,yc,0),r);
    std::shared_ptr<mshr::CSGDifference> shedding = channel - obstacle;
    std::shared_ptr<Mesh> mesh = mshr::generate_mesh(*shedding,resolution);

Meshing channel or obstacle works fine.

Comments (8)

  1. Benjamin Dam Kehlet

    Confirmed. Thanks for reporting!

    I don't have time until Thursday or Friday this week, but I will take a look then.

  2. Jan Blechta

    Following code also segfaults with current master (02ffef1bbfce52721bae920de7d362ac4e4b57dd)

    from dolfin import *
    import mshr
    
    center = Point(0.2, 0.2)
    radius = 0.05
    L = 2.2
    W = 0.41
    geometry = mshr.Rectangle(Point(0.0, 0.0), Point(L, W)) \
             - mshr.Circle(center, radius, 40)
    mesh = mshr.generate_mesh(geometry, 50)
    
  3. Former user Account Deleted reporter

    @blechta your code crashes because the radius is too big. I set it to 10 and it works on my machine. Also the code from the tutorial works just fine. It's quite odd that the C++ version is broken and the Python one is not :S

  4. Former user Account Deleted reporter

    Sorry, not the radius, the third parameter, the segment number for the circle :D I put it to 10 and it worked.

    My code also seems to be working now, so the bug must be somewhere related to that third parameter. With 10 it works fine, but the default value is already enough to make it crash.

  5. Log in to comment