VecGhost and state
Matthew Knepley
knepley at gmail.com
Thu Apr 30 07:48:49 CDT 2009
On Thu, Apr 30, 2009 at 7:41 AM, Jed Brown <jed at 59a2.org> wrote:
> Matthew Knepley wrote:
>
> > We could make a copy and do the same thing for GetArray. We don't because
> > it is more expensive. The same argument applies here. Some people will
> > complain about any unnecessary expense.
>
> It *is* expensive with GetArray, so that would be pointless. In this
> case, it does *not* cost extra, you just set the state to the maximum.
>
I misunderstood. I thought you were checking for element maxima, which would
tell you if something changed. You are just checking state numbers? I did
not think
these had any guarantees of synchronization.
> > The local form is meaningless after restore so its state is unimportant.
>
> VecGhostGetLocalForm(g,&lf);
> VecNorm(lf,NORM_1,&nrm);
> VecGhostRestoreLocalForm(g,&lf);
> VecSet(g,0);
> VecGhostGetLocalForm(g,&lf);
> VecNorm(lf,NORM_1,&nrm); /* will erroneously use cached norm */
>
> You might say that the user should not do this (the ghost values are
> stale, and the norm of a local vector has dubious value), but it doesn't
> cost anything to at least do it in a consistent way. This is why I
> prefer to syncronize state on both GetLocalForm and RestoreLocalForm.
You are not guaranteed to get the same local vector.
Matt
>
> Jed
>
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090430/d84d17b5/attachment.html>
More information about the petsc-dev
mailing list