MeshView submesh vertex map to parent mesh

Hello,

I am getting started in using the cecile/mixed-dimensional branch. I have a 3D cube geometry with a cylindric hole at the center. I have defined the inner surface of the cylinder as a 2D subdomain using

> class Inner(SubDomain):
>     def inside(self,x,on_boundary):
>         tol = 1e-1
>         return (on_boundary and np.linalg.norm(x[0:2]) <= ri + tol)
>
> marker = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
> 
> marker.set_all(0)
> sm = Inner()
> sm.mark(marker, 1)
> marker = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
> submesh = MeshView.create(marker, 1)

My question is how do I map the vertex of the submesh to the parent mesh and vice-versa? Is there an easy way of doing this? I tried with some functions of MeshView but I can’t make it work.

Thank you!

1 Like

Hello,

The mapping between parent and child mesh vertices (and cells) is built when building the MeshView object. You can access these from the topology of your submesh :

submesh.topology().mapping()[mesh.id()].vertex_map()
submesh.topology().mapping()[mesh.id()].cell_map()

Note : In your code you redefine the variable marker after having marked your entities, making it zero for all entities so I suspect your submesh to be empty.

Thank you for the answer!