VecGetArray#
Returns a pointer to a contiguous array that contains this MPI processes’s portion of the vector data
Synopsis#
#include "petscvec.h"
PetscErrorCode VecGetArray(Vec x, PetscScalar *a[])
Logically Collective
Input Parameter#
x - the vector
Output Parameter#
a - location to put pointer to the array
Notes#
For the standard PETSc vectors, VecGetArray()
returns a pointer to the local data array and
does not use any copies. If the underlying vector data is not stored in a contiguous array
this routine will copy the data to a contiguous array and return a pointer to that. You MUST
call VecRestoreArray()
when you no longer need access to the array.
For vectors that may also have the array data in GPU memory, for example, VECCUDA
, this call ensures the CPU array has the
most recent array values by copying the data from the GPU memory if needed.
Fortran Note#
PetscScalar, pointer :: a(:)
See Also#
Vectors and Parallel Data, Vec
, VecRestoreArray()
, VecGetArrayRead()
, VecGetArrays()
, VecPlaceArray()
, VecGetArray2d()
,
VecGetArrayPair()
, VecRestoreArrayPair()
, VecGetArrayWrite()
, VecRestoreArrayWrite()
, VecGetArrayAndMemType()
Level#
beginner
Location#
Examples#
src/snes/tutorials/ex21.c
src/snes/tutorials/ex1.c
src/snes/tutorials/ex22.c
src/snes/tutorials/ex99.c
src/snes/tutorials/ex7.c
src/snes/tutorials/ex71.c
src/snes/tutorials/ex59.c
src/snes/tutorials/ex5f90.F90
src/snes/tutorials/ex6.c
src/snes/tutorials/ex13.c
Implementations#
VecGetArray_Nest() in src/vec/vec/impls/nest/vecnest.c
VecGetArray_SeqKokkos() in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecGetArray_SeqViennaCL() in src/vec/vec/impls/seq/seqviennacl/vecviennacl.cxx
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages