Recently, I am working on a problem which need to calculate the distance of all the interior points to the boundary. I use the following code:
bmesh = BoundaryMesh(mesh, "exterior")
bbtree = BoundingBoxTree()
bbtree.build(bmesh)
vertex_distance_to_boundary = MeshFunction("double", mesh, 0)
for v_idx in xrange(mesh.num_vertices()):
v = Vertex(mesh, v_idx)
_, distance = bbtree.compute_closest_entity(v.point())
print distance
vertex_distance_to_boundary[v_idx] = distance
It works well, but I am wondering how FEniCS computes the distance? What’s the method/algorithm used behind? I can not find any explanation here and there.
Thank you very much! That’s what I want. I tried to solve the Eikonal equation by myself, but it is unstable. Your provided algorithm is very stable. I also trying to find some references for the algorithm, but I can not find the one used in the link. Do you know some references of the Algorithms?