[petsc-dev] VecGetArrayRead vs. VecGetArrayPrivate

Jed Brown jed at 59A2.org
Tue Nov 23 08:15:32 CST 2010


On Tue, Nov 23, 2010 at 15:10, Barry Smith <bsmith at mcs.anl.gov> wrote:

> You misunderstand. VecNorm() would still be calling the update cache
> business,. the only difference is it would get the cached values before the
> (*v->scale)(...) call and set them back into the Vec after the
> (*v->scale)(...)


VecNorm just reads the cache, you must mean that VecScale pulls out the
cached values as

    /*
     * Update cached data
     */
    for (i=0; i<4; i++) {
      ierr =
PetscObjectComposedDataGetReal((PetscObject)x,NormIds[i],norms[i],flgs[i]);CHKERRQ(ierr);
    }

    ierr = (*x->ops->scale)(x,alpha);CHKERRQ(ierr); /* state is increased
here */

    for (i=0; i<4; i++) {
      if (flgs[i]) {
        ierr =
PetscObjectComposedDataSetReal((PetscObject)x,NormIds[i],PetscAbsScalar(alpha)*norms[i]);CHKERRQ(ierr);
      }
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20101123/518bf153/attachment.html>


More information about the petsc-dev mailing list