From c7dfcad9b2fd105d44cc504ad968c7a0e70e9230 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Mon, 17 Sep 2018 10:25:44 -0500 Subject: [PATCH 1/2] vecscatter: API changes VecScatterCreate -> VecScatterCreateWithData VecScatterCreateEmpty -> VecScatterCreate --- src/PETSc/Scatter.pyx | 8 ++++---- src/PETSc/petscsct.pxi | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PETSc/Scatter.pyx b/src/PETSc/Scatter.pyx index 2ea84918..eea1a2b0 100644 --- a/src/PETSc/Scatter.pyx +++ b/src/PETSc/Scatter.pyx @@ -33,21 +33,21 @@ cdef class Scatter(Object): CHKERR( VecScatterDestroy(&self.sct) ) return self - def create(self, Vec vec_from, IS is_from or None, + def createWithData(self, Vec vec_from, IS is_from or None, Vec vec_to, IS is_to or None): cdef PetscIS cisfrom = NULL, cisto = NULL if is_from is not None: cisfrom = is_from.iset if is_to is not None: cisto = is_to.iset cdef PetscScatter newsct = NULL - CHKERR( VecScatterCreate( + CHKERR( VecScatterCreateWithData( vec_from.vec, cisfrom, vec_to.vec, cisto, &newsct) ) PetscCLEAR(self.obj); self.sct = newsct return self - def createEmpty(self, comm=None): + def create(self, comm=None): cdef MPI_Comm ccomm = def_Comm(comm, PETSC_COMM_DEFAULT) cdef PetscScatter newsct = NULL - CHKERR( VecScatterCreateEmpty(ccomm, &newsct) ) + CHKERR( VecScatterCreate(ccomm, &newsct) ) PetscCLEAR(self.obj); self.sct = newsct return self diff --git a/src/PETSc/petscsct.pxi b/src/PETSc/petscsct.pxi index 8d36975e..d14af398 100644 --- a/src/PETSc/petscsct.pxi +++ b/src/PETSc/petscsct.pxi @@ -10,8 +10,8 @@ cdef extern from * nogil: int VecScatterView(PetscScatter,PetscViewer) int VecScatterDestroy(PetscScatter*) - int VecScatterCreate(PetscVec,PetscIS,PetscVec,PetscIS,PetscScatter*) - int VecScatterCreateEmpty(MPI_Comm,PetscScatter*) + int VecScatterCreateWithData(PetscVec,PetscIS,PetscVec,PetscIS,PetscScatter*) + int VecScatterCreate(MPI_Comm,PetscScatter*) int VecScatterSetFromOptions(PetscScatter) int VecScatterSetType(PetscScatter,PetscScatterType) int VecScatterGetType(PetscScatter,PetscScatterType*) From fe0c3b71fa741e235e2a37b29c66cb7682cb9241 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Mon, 17 Sep 2018 11:21:41 -0500 Subject: [PATCH 2/2] Also fix examples --- demo/ode/heat.py | 2 +- test/test_object.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/ode/heat.py b/demo/ode/heat.py index 62eeefb3..0aa6b826 100644 --- a/demo/ode/heat.py +++ b/demo/ode/heat.py @@ -33,7 +33,7 @@ def __init__(self,comm,N): self.lvec.setUp() # Configure scatter from global to local isg = PETSc.IS().createGeneral(list(gindices), comm=comm) - self.g2l = PETSc.Scatter().create(self.gvec, isg, self.lvec, None) + self.g2l = PETSc.Scatter().createWithData(self.gvec, isg, self.lvec, None) self.tozero, self.zvec = PETSc.Scatter.toZero(self.gvec) self.history = [] diff --git a/test/test_object.py b/test/test_object.py index bca1f7c4..7bf373e2 100644 --- a/test/test_object.py +++ b/test/test_object.py @@ -195,7 +195,7 @@ class TestObjectScatter(BaseTestObject, unittest.TestCase): def setUp(self): v1, v2 = PETSc.Vec().createSeq(0), PETSc.Vec().createSeq(0) i1, i2 = PETSc.IS().createGeneral([]), PETSc.IS().createGeneral([]) - self.obj = PETSc.Scatter().create(v1, i1, v2, i2) + self.obj = PETSc.Scatter().createWithData(v1, i1, v2, i2) del v1, v2, i1, i2 class TestObjectMat(BaseTestObject, unittest.TestCase):