Hi there,
I have a question related to the new dolfinx.mesh.EntityMap in version 0.10.
I used the old entity maps (np.arrays) in order to transfer for various mesh/facet-tags, e.g. for transferring boundary tags which declare mixed boundary conditions. For that I used in 0.9 something like
def get_boundary_marker_for_submesh(
global_mesh: dfx.mesh.Mesh,
global_boundary_tag: dfx.mesh.MeshTags,
boundary_tag_values: Iterable[int],
submesh: dfx.mesh.Mesh,
enitity_map: np.ndarray,
vertex_map: np.ndarray,
):
transfered_global_tag, face_map = transfer_meshtags_to_submesh(global_mesh, global_boundary_tag, submesh, vertex_map, enitity_map)
fdim = global_mesh.topology.dim -1
num_faces_submesh = submesh.topology.index_map(fdim).size_local
new_boundary_marker = np.zeros(num_faces_submesh, dtype=np.int32)
new_tag_value = max(boundary_tag_values) + 1
all_boundary_faces = dfx.mesh.exterior_facet_indices(submesh.topology)
new_boundary_marker[all_boundary_faces] = new_tag_value
for value in boundary_tag_values:
boundary_i = transfered_global_tag.find(value)
new_boundary_marker[boundary_i] = value
submesh_boundary_tags = dfx.mesh.meshtags(submesh, fdim, np.arange(num_faces_submesh, dtype=np.int32), new_boundary_marker)
return submesh_boundary_tags
which additionally marks the βinnerβ boundary of the submesh. The function `transfer_meshtags_to_submesh` is more or less a slight adaptation of the method I found here (It is in fact quite long, so please excuse that I dont just copy it here. I thought Iβd rather give you the original source).
I understand that dolfinx.mesh.EntityMap is now in version 0.10 a two-way mapping between submesh entities and the global ones.
My questions are now the following:
- How can I access the size of an entity map and loop over the values (similar as I would do over an array)?
- Is there a quick way to port the function `transfer_meshtags_to_submesh` to version 0.10.?
- And otherwise, do you have some advice how to write a similar function using the new
dolfinx.mesh.EntityMap?
Thanks in advance ![]()