Skip to content

Commit

Permalink
Add VecDohpZeroEntries that acts on the closure
Browse files Browse the repository at this point in the history
  • Loading branch information
jedbrown committed Apr 12, 2011
1 parent c3b72a8 commit 3046363
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/dohpvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dEXTERN_C_BEGIN

extern dErr VecDohpGetClosure(Vec,Vec*);
extern dErr VecDohpRestoreClosure(Vec,Vec*);
extern dErr VecDohpZeroEntries(Vec);
extern dErr VecCreateDohp(MPI_Comm,dInt,dInt,dInt,dInt,const dInt[],Vec*);

extern dErr VecDohpCreateDirichletCache(Vec gvec,Vec *dcache,VecScatter *dscat);
Expand Down
5 changes: 3 additions & 2 deletions src/fs/interface/fsgeom.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ dErr dFSGetNodalCoordinatesGlobal(dFS fs,Vec *inx)
/* Count the number of occurances of each node in the closure. */
err = VecDuplicate(Expanded,&Ones);dCHK(err);
err = VecDuplicate(X,&Count);dCHK(err);

err = VecDohpZeroEntries(Count);dCHK(err);
err = VecSet(Ones,1.);dCHK(err);
err = VecZeroEntries(Count);dCHK(err);
err = dFSExpandedToGlobal(fs3,Ones,Count,dFS_INHOMOGENEOUS,ADD_VALUES);dCHK(err);
err = VecDestroy(Ones);dCHK(err);

err = VecZeroEntries(X);dCHK(err);
err = VecDohpZeroEntries(X);dCHK(err);
err = dFSExpandedToGlobal(fs3,Expanded,X,dFS_INHOMOGENEOUS,ADD_VALUES);dCHK(err);

err = VecDohpGetClosure(X,&Xclosure);dCHK(err);
Expand Down
17 changes: 17 additions & 0 deletions src/vec/vecd.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ dErr VecDohpRestoreClosure(Vec v,Vec *c)
if (*c != ((Vec_MPI*)v->data)->localrep) dERROR(PETSC_COMM_SELF,1,"attempting to restore incorrect closure");
err = VecStateSync_Private(v,*c);dCHK(err);
err = PetscObjectDereference((dObject)*c);dCHK(err);
*c = NULL;
dFunctionReturn(0);
}

dErr VecDohpZeroEntries(Vec v)
{
dErr err;
dBool isdohp;
Vec c;

dFunctionBegin;
dValidHeader(v,VEC_CLASSID,1);
err = PetscTypeCompare((dObject)v,VECDOHP,&isdohp);dCHK(err);
if (!isdohp) dERROR(PETSC_COMM_SELF,PETSC_ERR_SUP,"Vector type %s",((dObject)v)->type_name);
err = VecDohpGetClosure(v,&c);dCHK(err);
err = VecZeroEntries(c);dCHK(err);
err = VecDohpRestoreClosure(v,&c);dCHK(err);
dFunctionReturn(0);
}

Expand Down

0 comments on commit 3046363

Please sign in to comment.