VecGhost and state

Jed Brown jed at 59A2.org
Thu Apr 30 07:41:11 CDT 2009


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.

> 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.

Jed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090430/9cb96a05/attachment.sig>


More information about the petsc-dev mailing list