I am using dolfin. I have seen the following code to locate which element a point might collide.
from dolfin import *
meshlevel =10
degree = 1
dim = 2
mesh = UnitDiscMesh.create(MPI.comm_world,meshlevel, degree, dim)
Px = -0.519
Py = 0.33
Pz = 0.0
p = Point(Px, Py, Pz)
tree = BoundingBoxTree()
tree.build(mesh)
first = tree.compute_first_entity_collision(p)
print(first)
c_to_v = mesh.topology()(mesh.topology().dim(), 0)
print(c_to_v(first), mesh.coordinates()[c_to_v(first)])
However, I need to get the element indices in a user-defined axis aligned bounding box. What function can help me to do this?