Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/balay/refactor-vecscatter'
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Sep 22, 2018
2 parents 23c3439 + fe0c3b7 commit c4d3330
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demo/ode/heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
8 changes: 4 additions & 4 deletions src/PETSc/Scatter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/PETSc/petscsct.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
2 changes: 1 addition & 1 deletion test/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c4d3330

Please sign in to comment.