Skip to content

Commit

Permalink
follow petsc adapt interface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
taupalosaurus authored and jwallwork23 committed Aug 25, 2020
1 parent 4eb4f85 commit e64f5fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions src/PETSc/DM.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,22 @@ cdef class DM(Object):
CHKERR( DMAdaptLabel(self.dm, clbl, &newdm.dm) )
return newdm

def adaptMetric(self, Vec metric, label=None):
cdef const char *cval = NULL
cdef PetscDMLabel clbl = NULL
label = str2bytes(label, &cval)
def adaptMetric(self, Vec metric, bdlabel=None, rglabel=None):
# boundary tags
cdef const_char *cval = NULL
cdef PetscDMLabel cbdlbl = NULL
label = str2bytes(bdlabel, &cval)
if cval == NULL: cval = b"" # XXX Should be fixed upstream
CHKERR( DMGetLabel(self.dm, cval, &clbl) )
CHKERR( DMGetLabel(self.dm, cval, &cbdlbl) )
# cell tags
cdef const_char *cval2 = NULL
cdef PetscDMLabel crglbl = NULL
label = str2bytes(rglabel, &cval2)
if cval2 == NULL: cval2 = b"" # XXX Should be fixed upstream
CHKERR( DMGetLabel(self.dm, cval2, &crglbl) )
#
cdef DM newdm = DMPlex()
CHKERR( DMAdaptMetric(self.dm, metric.vec, clbl, &newdm.dm) )
CHKERR( DMAdaptMetric(self.dm, metric.vec, cbdlbl, crglbl, &newdm.dm) )
return newdm

def getLabel(self, name):
Expand Down
2 changes: 1 addition & 1 deletion src/PETSc/petscdm.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ cdef extern from * nogil:
int DMGetCoarsenLevel(PetscDM,PetscInt*)

int DMAdaptLabel(PetscDM,PetscDMLabel,PetscDM*)
int DMAdaptMetric(PetscDM,PetscVec,PetscDMLabel,PetscDM*)
int DMAdaptMetric(PetscDM,PetscVec,PetscDMLabel,PetscDMLabel,PetscDM*)

int DMGlobalToLocalBegin(PetscDM,PetscVec,PetscInsertMode,PetscVec)
int DMGlobalToLocalEnd(PetscDM,PetscVec,PetscInsertMode,PetscVec)
Expand Down

0 comments on commit e64f5fe

Please sign in to comment.