From e64f5fec22434c3a48fd24c6568aacc2b97b649d Mon Sep 17 00:00:00 2001 From: Nicolas Barral Date: Wed, 29 Aug 2018 18:20:01 +0100 Subject: [PATCH] follow petsc adapt interface changes --- src/PETSc/DM.pyx | 20 ++++++++++++++------ src/PETSc/petscdm.pxi | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/PETSc/DM.pyx b/src/PETSc/DM.pyx index e96b9a01..b8da624e 100644 --- a/src/PETSc/DM.pyx +++ b/src/PETSc/DM.pyx @@ -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): diff --git a/src/PETSc/petscdm.pxi b/src/PETSc/petscdm.pxi index d066edbc..727838b5 100644 --- a/src/PETSc/petscdm.pxi +++ b/src/PETSc/petscdm.pxi @@ -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)