This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

BoundaryMesh

0 votes

Is there any function in Fenics that given a mesh on a domain and a relative boundary mesh using BoundaryMesh(mesh), maps the verteices number of the domain mesh to the vertices number of the Boundarymesh and viceversa?

Thank you!

asked Oct 18, 2016 by davide FEniCS Novice (250 points)

1 Answer

+2 votes
 
Best answer

Hi, consider

from dolfin import *

mesh = UnitSquareMesh(10, 10)
bmesh = BoundaryMesh(mesh, 'exterior')
# Map vertices of bmesh to vertices of mesh
vb_2_v = bmesh.entity_map(0)
# Check
assert all(near(Vertex(bmesh, vb_index).point().distance(Vertex(mesh, v_index).point()), 0)
           for vb_index, v_index in enumerate(vb_2_v))
# The reverse map
v_2_vb = {v: vb for vb, v in enumerate(vb_2_v)} 
answered Oct 18, 2016 by MiroK FEniCS Expert (80,920 points)
selected Oct 18, 2016 by davide

Thank you very much!!

...