How to check if a Point is in a Mesh?

Is there a way to check if a Point() is contained within the bounds of a given mesh within the Python interface? I’m getting the error: AttributeError: ‘dolfin.cpp.geometry.BoundingBoxTree’ object has no attribute ‘collides_entity’ when I try a statement like if mesh.bounding_box_tree().collides_entity(point) in 2018.1.0. Thanks in advance!

1 Like

How about mesh.bounding_box_tree().compute_first_entity_collision(point). This should return a cell index, or a very large number, if out of the mesh. I’m not quite sure how this appears in Python.

3 Likes

Thanks, chris! I think this will work, if I understand correctly–something like testing if mesh.bounding_box_tree().compute_first_entity_collision(point) > mesh.num_cells():`? I’ve run into another issue related to my time marching in the particle tracking I’m trying to implement, but I’ll post my solution once I have it working.

1 Like