PETSc version 3.15.5
Fix/Edit manual page

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(), this routine is not collective and 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 must such implementations should cache the contiguous representation so that only one copy is performed when this routine is called multiple times in sequence.

See Also

VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair()

Level

beginner

Location

src/vec/vec/interface/rvector.c

Examples

src/vec/vec/tutorials/ex10.c.html
src/vec/is/sf/tutorials/ex2.c.html
src/mat/tutorials/ex12.c.html
src/dm/impls/plex/tutorials/ex6.c.html
src/dm/tutorials/swarm_ex3.c.html
src/dm/field/tutorials/ex1.c.html
src/ksp/ksp/tutorials/ex10.c.html
src/ksp/ksp/tutorials/ex70.c.html
src/ksp/ksp/tutorials/ex71.c.html
src/ksp/ksp/tutorials/ex73.c.html
src/snes/tutorials/ex1.c.html

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