Should SlicedCreateLocalVector() exist?

Jed Brown jed at 59A2.org
Thu Apr 16 07:15:28 CDT 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090416/a957ef9e/attachment.sig>


More information about the petsc-dev mailing list