Should SlicedCreateLocalVector() exist?
Barry Smith
bsmith at mcs.anl.gov
Thu Apr 16 12:22:45 CDT 2009
Jed,
Feel free to make these changes.
Just curious, are you using the Sliced in some development?
Barry
On Apr 16, 2009, at 7:15 AM, Jed Brown wrote:
> It throws away the reference to the global vector and there is no
> way to
> recover it. Calling VecDestroy() on the local form won't do the right
> thing, it's essentially the same as VecGhostRestoreLocalForm(). Also,
> SlicedGlobalToLocalBegin/End really have different semantics from
> DAGlobalToLocalBegin/End (requiring that it's actually the same
> vector).
> I don't see how these functions simplify matters for the user. If you
> had different behavior than what is currently implemented in mind, I
> might be able to implement it, otherwise I'm in favor of removing
> these
> functions and having the user work with the VecGhost interface.
>
>
> As for SlicedCreateGlobalVector, I think that ideally after
>
> SlicedCreateGlobalVector(slice,&g0);
> VecDestroy(g0);
> SlicedCreateGlobalVector(slice,&g1);
>
> there should only be one vector allocated. For this, I think that the
> following will work. Am I missing something subtle?
>
> if (slice->globalvector) {
> ierr = PetscObjectGetReference((PetscObject)slice-
> >globalvector,&cnt);CHKERRQ(ierr);
> if (cnt == 1) {
> *gvec = slice->globalvector;
> ierr = PetscObjectReference((PetscObject)*gvec);CHKERRQ(ierr);
> ierr = VecZeroEntries(*gvec);CHKERRQ(ierr);
> } else {
> ierr = VecDuplicate(slice->globalvector,gvec);CHKERRQ(ierr);
> }
> } else {
> ...
> }
>
>
> Jed
More information about the petsc-dev
mailing list