diff --git a/firedrake/cython/dmcommon.pyx b/firedrake/cython/dmcommon.pyx index a452ac2f41..f440169ded 100644 --- a/firedrake/cython/dmcommon.pyx +++ b/firedrake/cython/dmcommon.pyx @@ -1022,6 +1022,18 @@ def label_facets(PETSc.DM plex, label_boundary=True): CHKERR(DMLabelSetValue(lbl_int, facet, 1)) CHKERR(DMLabelDestroyIndex(lbl_ext)) + +def complete_facet_labels(PETSc.DM dm): + """Transfer label values from the facet labels to everything in + the closure of the facets.""" + cdef PETSc.DMLabel label + + for name in [FACE_SETS_LABEL, "exterior_facets", "interior_facets"]: + if dm.hasLabel(name): + label = dm.getLabel(name) + CHKERR( DMPlexLabelComplete(dm.dm, label.dmlabel) ) + + @cython.boundscheck(False) @cython.wraparound(False) def cell_facet_labeling(PETSc.DM plex, diff --git a/firedrake/cython/petschdr.pxi b/firedrake/cython/petschdr.pxi index 8856877245..04d6c0048b 100644 --- a/firedrake/cython/petschdr.pxi +++ b/firedrake/cython/petschdr.pxi @@ -41,6 +41,7 @@ cdef extern from "petscdmplex.h" nogil: int DMPlexDistributeData(PETSc.PetscDM,PETSc.PetscSF,PETSc.PetscSection,MPI.MPI_Datatype,void*,PETSc.PetscSection,void**) int DMPlexSetAdjacencyUser(PETSc.PetscDM,int(*)(PETSc.PetscDM,PetscInt,PetscInt*,PetscInt[],void*),void*) int DMPlexCreatePointNumbering(PETSc.PetscDM,PETSc.PetscIS*) + int DMPlexLabelComplete(PETSc.PetscDM, PETSc.PetscDMLabel) cdef extern from "petscdmlabel.h" nogil: struct _n_DMLabel diff --git a/firedrake/mesh.py b/firedrake/mesh.py index ccc75921ce..1e2188e9cc 100644 --- a/firedrake/mesh.py +++ b/firedrake/mesh.py @@ -738,6 +738,7 @@ def callback(self): del self._callback if self.comm.size > 1: add_overlap() + dmcommon.complete_facet_labels(self.topology_dm) if reorder: with timed_region("Mesh: reorder"):