[petsc-dev] VecRestoreArrayRead and const
Jed Brown
jed at 59A2.org
Mon Jun 14 14:34:17 CDT 2010
On Mon, 14 Jun 2010 12:07:23 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote:
> Yes you are. If you look at the Vec routines line VecAXPY(), VecScale() etc they manage the update of state themselves (in order to preserve norms). Thus VecAXPY_Seq(), VecScale_Seq() etc should not be updating state. So I want a set of routines that access the arrays and allow changes but do not increase the state; but I don't want to use the pure vec->array to access the data.
Right, thanks for explaining.
> I fear in the end we need three sets of VecGetArray() a read, a write and a private that allows writes but does not increase state. Don't have a good name for the private one.
Would the internal (mutable without state) one ever be called outside of
a specific implementation? If not, then it could be
implementation-private (src/vec/vec/impls/*/*impl.h instead of
include/petscvec.h or include/private/vecimpl.h).
> This is all made more complicated by the fact that sometimes two or three vector arguments to a routine could be the same.
Is this a real problem as long as there is a Vec{Get,Restore}Array{2,3}
for the version that does increment state (which increments state
exactly once per unique vector)? It doesn't seem like there is any
problem with access that doesn't increment state, except that the scope
responsible for incrementing state also needs to resolve duplicates. In
the standard cases (VecScale, VecCopy, and VecSwap are special) you're
just incrementing state for every unique modified vector.
Jed
More information about the petsc-dev
mailing list