diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 913ebcf53bea2704f8050953313607e3ee11d317..75f356ff1159ec588e688549380d6ec845539997 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -199,6 +199,25 @@ def _get_firedrake_boundary_tags(fdrake_mesh, tag_induced_boundary=False): return bdy_tags +def _get_facet_markers(dm, facets): + # based on code removed in + # https://github.com/firedrakeproject/firedrake/commit/9125a65c0cb5bb671c62c33f05a0d42b983e06ed + import firedrake.cython.dmcommon as dmcommon + + ids = np.empty_like(facets) + ids.fill(-1) + + nfacet = facets.shape[0] + label = dm.getLabel(dmcommon.FACE_SETS_LABEL) + if not label: + return + + for f in range(nfacet): + ids[f] = label.getValue(facets[f]) + + return ids + + def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, cells_to_use=None): """ @@ -333,7 +352,10 @@ def _get_firedrake_facial_adjacency_groups(fdrake_mesh_topology, dtype=Mesh.face_id_dtype) # If only using some of the cells, throw away unused cells and # move to new cell index - ext_facet_markers = top.exterior_facets.markers + + ext_facet_markers = _get_facet_markers( + top.topology_dm, top.exterior_facets.facets) + if cells_to_use is not None: to_keep = np.isin(ext_elements, cells_to_use) ext_elements = np.vectorize(cells_to_use_inv.__getitem__)( diff --git a/test/test_firedrake_interop.py b/test/test_firedrake_interop.py index 164c3bd7c5a865db37fe5a83ad4024b170af6bb3..67e0a8dcbfe4b548bfede3162829f71adfa4c1a3 100644 --- a/test/test_firedrake_interop.py +++ b/test/test_firedrake_interop.py @@ -334,8 +334,11 @@ def test_bdy_tags(square_or_cube_mesh, bdy_ids, coord_indices, coord_values, # Verify that the number of meshes tagged with a boundary tag # is the same in meshmode and firedrake for each tag in *bdy_ids* + from meshmode.interop.firedrake.mesh import _get_facet_markers fdrake_bdy_ids, fdrake_counts = \ - np.unique(square_or_cube_mesh.exterior_facets.markers, return_counts=True) + np.unique(_get_facet_markers( + square_or_cube_mesh.topology.topology_dm, + square_or_cube_mesh.exterior_facets.facets), return_counts=True) assert set(fdrake_bdy_ids) == set(bdy_ids) for bdy_id, fdrake_count in zip(fdrake_bdy_ids, fdrake_counts): assert fdrake_count == bdy_id_to_mm_count[bdy_id]