diff --git a/meshmode/mesh/__init__.py b/meshmode/mesh/__init__.py index a7bea50d7..d7a310cf6 100644 --- a/meshmode/mesh/__init__.py +++ b/meshmode/mesh/__init__.py @@ -1416,13 +1416,21 @@ def vertex_index_map_func(vertices): def _compute_facial_adjacency_from_vertices( - groups, element_id_dtype, face_id_dtype, tag_to_faces=None + groups: Sequence[MeshElementGroup], + element_id_dtype, + face_id_dtype, + tag_to_group_faces: Optional[Sequence[Mapping[Any, np.ndarray]]] = None ) -> Sequence[Sequence[FacialAdjacencyGroup]]: + """ + :arg tag_to_group_faces: for each group, a mapping from tag to + :class:`numpy.ndarray` of shape ``(2, nfaces)`` containing + the element and face indices of each tagged face in the group. + """ if not groups: return [] - if tag_to_faces is None: - tag_to_faces = [{} for grp in groups] + if tag_to_group_faces is None: + tag_to_group_faces = [{} for grp in groups] # Match up adjacent faces according to their vertex indices @@ -1503,7 +1511,7 @@ def _compute_facial_adjacency_from_vertices( is_tagged = np.full(len(bdry_elements), False) - for tag, tagged_elements_and_faces in tag_to_faces[igrp].items(): + for tag, tagged_elements_and_faces in tag_to_group_faces[igrp].items(): face_index_pairs = _find_matching_index_pairs( tagged_elements_and_faces.T, np.stack((bdry_elements, bdry_element_faces))) diff --git a/meshmode/mesh/io.py b/meshmode/mesh/io.py index cefd1a541..f7c003a88 100644 --- a/meshmode/mesh/io.py +++ b/meshmode/mesh/io.py @@ -187,7 +187,7 @@ def get_mesh(self, return_tag_to_elements_map=False): group_base_elem_nr = 0 tag_to_meshwide_elements = {} - tag_to_faces = [] + tag_to_group_faces = [] for group_el_type, ngroup_elements in el_type_hist.items(): if group_el_type.dimensions != mesh_bulk_dim: @@ -267,7 +267,7 @@ def get_mesh(self, return_tag_to_elements_map=False): group_base_elem_nr += group.nelements - group_tag_to_faces = {} + tag_to_faces = {} for tag, tagged_fvis in tag_to_fvis.items(): for fid, ref_fvi in enumerate(group.face_vertex_indices()): @@ -285,19 +285,19 @@ def get_mesh(self, return_tag_to_elements_map=False): np.sort(padded_fvis, axis=1).T) face_element_indices = face_element_index_pairs[1, :] if len(face_element_indices) > 0: - elements_and_faces = np.stack( + group_faces = np.stack( ( face_element_indices, np.full(face_element_indices.shape, fid)), axis=-1) - if tag in group_tag_to_faces: - group_tag_to_faces[tag] = np.concatenate(( - group_tag_to_faces[tag], - elements_and_faces)) + if tag in tag_to_faces: + tag_to_faces[tag] = np.concatenate(( + tag_to_faces[tag], + group_faces)) else: - group_tag_to_faces[tag] = elements_and_faces + tag_to_faces[tag] = group_faces - tag_to_faces.append(group_tag_to_faces) + tag_to_group_faces.append(tag_to_faces) for tag in tag_to_meshwide_elements.keys(): tag_to_meshwide_elements[tag] = np.array( @@ -314,7 +314,7 @@ def get_mesh(self, return_tag_to_elements_map=False): if is_conforming and self.tags: from meshmode.mesh import _compute_facial_adjacency_from_vertices facial_adjacency_groups = _compute_facial_adjacency_from_vertices( - groups, np.int32, np.int8, tag_to_faces) + groups, np.int32, np.int8, tag_to_group_faces) mesh = Mesh( vertices, groups,