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

Entity mapping between a submesh and the parent mesh

+4 votes

I'm constructing a submesh. I want to know how I can get the index mapping between the submesh and the parent mesh.

Many thanks

asked Jun 14, 2013 by nicusor FEniCS Novice (200 points)
edited Jun 14, 2013 by johanhake

1 Answer

+4 votes
 
Best answer

If sub_mesh is a SubMesh of dimension 2, then you can get the mappings by

vertex_indices = sub_mesh.data().array("parent_vertex_indices", 0)
cell_indices = sub_mesh.data().array("parent_cell_indices", 2)
answered Jun 14, 2013 by logg FEniCS Expert (11,790 points)
selected Jun 14, 2013 by johanhake

Maybe older syntax is:

sub_mesh.data().mesh_function('parent_vertex_indices') # returns MeshFunction
sub_mesh.data().mesh_function('parent_vertex_indices').array() # returns numpy.array
...