VecGetArrayRead#

Get read-only pointer to contiguous array containing this processor’s portion of the vector data.

Synopsis#

#include "petscvec.h"   
PetscErrorCode VecGetArrayRead(Vec x, const PetscScalar **a)

Not Collective

Input Parameter#

  • x - the vector

Output Parameter#

  • a - the array

Notes#

The array must be returned using a matching call to VecRestoreArrayRead().

Unlike VecGetArray(), preserves cached information like vector norms.

Standard PETSc vectors use contiguous storage so that this routine does not perform a copy. Other vector implementations may require a copy, but such implementations should cache the contiguous representation so that only one copy is performed when this routine is called multiple times in sequence.

Fortran Notes#

VecGetArrayRead() Fortran binding is deprecated (since PETSc 3.19), use VecGetArrayReadF90()

See Also#

Vectors and Parallel Data, Vec, VecGetArrayReadF90(), VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair()

Level#

beginner

Location#

src/vec/vec/interface/rvector.c

Examples#

src/tao/unconstrained/tutorials/rosenbrock1.c
src/tao/leastsquares/tutorials/chwirut1.c
src/tao/leastsquares/tutorials/cs1.c
src/tao/complementarity/tutorials/minsurf1.c
src/tao/unconstrained/tutorials/rosenbrock2.c
src/mat/tutorials/ex12.c
src/tao/unconstrained/tutorials/rosenbrock3.c
src/tao/constrained/tutorials/ex1.c
src/tao/unconstrained/tutorials/eptorsion3.c
src/tao/unconstrained/tutorials/minsurf1.c


Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages