You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of having entity_maps as a dictionary, it should be a dolfinx::mesh::MeshTags object,
where the topology of the MeshTag is the mesh we are mapping to, the indices the entities in the input mesh topology, while the values are the entity number in the mesh we are mapping from.
This means that inverting the map is as easy as switching order of indices and values (and attaching the correct mesh topology), and we avoid storing -1 indices (that currently are resulting in segfaults whenever there are issues with user input, making it very hard to debug).
We would also no longer need a dictionary for the maps, as the topology is stored as part of the MeshTag, and we can create a topology -> list_index_in_input_entity_tags.
Internally in DOLFINx, we could unravel these to avoid calling find many times (similar to what we do with Dirichlet BC dofs), but then with explicit handling of the negative/non-existent entities.
Also note that creating the "parent_to_sub_mesh" map is a simpler operation than its inverse (as we do not have to sort the input entities to entity_map.
Suggested user interface
mesh= .....
sub_indices= ....
submesh, sub_to_parent, _, _=dolfinx.mesh.create_submesh(mesh, dim, entities)
entity_map=dolfinx.mesh.meshtags(submesh, dim, np.arange(len(sub_to_parent), dtype=np.int32), sub_to_parent)
# Given a parent cell `c` find cell in submeshsub_cell=entity_map.find(c)
# Invert mapparent_sort=np.argsort(sub_to_parent)
sub_cells=np.arange(len(sub_to_parent), dtype=np.int32)[parent_sort]
inverted_map=dolfinx.mesh.meshtags(mesh, dim, sub_to_parent[parent_sort], sub_cells)
# Given a child cell `d` find parent_cellp_cell=inverted_map.find(d)
The text was updated successfully, but these errors were encountered:
Describe new/missing feature
Instead of having
entity_maps
as a dictionary, it should be adolfinx::mesh::MeshTags
object,where the topology of the
MeshTag
is the mesh we are mapping to, the indices the entities in the input mesh topology, while the values are the entity number in the mesh we are mapping from.This means that inverting the map is as easy as switching order of
indices
andvalues
(and attaching the correct mesh topology), and we avoid storing-1
indices (that currently are resulting in segfaults whenever there are issues with user input, making it very hard to debug).We would also no longer need a dictionary for the maps, as the topology is stored as part of the MeshTag, and we can create a topology -> list_index_in_input_entity_tags.
Internally in DOLFINx, we could unravel these to avoid calling
find
many times (similar to what we do with Dirichlet BC dofs), but then with explicit handling of the negative/non-existent entities.Also note that creating the "parent_to_sub_mesh" map is a simpler operation than its inverse (as we do not have to sort the input entities to
entity_map
.Suggested user interface
The text was updated successfully, but these errors were encountered: