Use the MeshEntity
function
std::size_t num_global_entities(std::size_t dim) const
From Python, try:
dim = mesh.topology().dim()
mesh.init(dim-1, dim)
f = Facet(mesh, 42)
num_incident = f.num_global_entities(dim)
num_local = f.num_entities(dim)
If num_incident == 2
, then two cells (globally) share the facet. On the other hand if num_local == 1
, then there is only one incident cell on this partition. Therefore f
is shared iff num_incident != num_local
.