Skip to content

Commit

Permalink
mesh: Complete facet labels after adding overlaps
Browse files Browse the repository at this point in the history
This will be used for grabbing DirichletBC nodes from section data.
  • Loading branch information
wence- committed May 5, 2021
1 parent 88a443c commit d707967
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions firedrake/cython/dmcommon.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions firedrake/cython/petschdr.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down

0 comments on commit d707967

Please sign in to comment.