Hi,
I am trying to calculate the distance of interior points w.r.t. boundary. I found a very useful solution DISTANCE TO BOUNDARY, the solution I am using is,
from dolfin import *
mesh = UnitSquareMesh(4,4)
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
plot(vertex_distance_to_boundary)
interactive()
I am however, having the problem, in case of when not all edges defining the mesh are not included in distance calculation.
For example, in the code above, I am calculating the distance w.r.t. all edges on UnitSquareMesh (Left, Right, Top, Bottom),
TOP
-------------
LEFT | | RIGHT
| |
-------------
BOTTOM
but how do I calculate the distance, for instance, only w.r.t. Left, Right EDGES
< NOT INCLUDED >
-------------
LEFT | | RIGHT
| |
-------------
< NOT INCLUDED >