Hello,
Is there is a more compact way of getting “facet” and “cell” tags (topology.dim - 1
and topology.dim
, respectively)? I did this on DOLFINx 0.8.0. Thanks.
[Edit 1]
I just want to be able to access all the facet and cell tags in the domain without creating a boundary condition or function (e.g. to be used with locate_entities
).
from dolfinx import mesh
from mpi4py import MPI
import numpy as np
# Mesh
msh = mesh.create_unit_square(MPI.COMM_WORLD, 5, 5)
gdim = msh.topology.dim
# Facets?
# https://fenicsproject.discourse.group/t/
# transfer-meshtags-to-submesh-in-dolfinx/8952/7
fdim = msh.topology.dim - 1
msh.topology.create_connectivity(fdim, gdim)
facet_map = msh.topology.index_map(fdim)
facet_total = facet_map.size_local + facet_map.num_ghosts
facet_tags = np.zeros(facet_total, dtype=np.int32)
# Cells?
cell_map = msh.topology.index_map(gdim)
cell_total = cell_map.size_local + cell_map.num_ghosts
cell_tags = np.zeros(cell_total, dtype=np.int32)
# Left boundary (just to test)
left_facets = mesh.locate_entities_boundary(
msh, fdim, lambda x: np.isclose(x[0], 0))
# Mark boundary
left_tags = mesh.meshtags(msh, fdim, left_facets,
np.full_like(left_facets, np.int32(1)))
left_tags.indices == left_facets