:orphan: # VecGetArrayWrite Returns a pointer to a contiguous array that WILL contain this processor's portion of the vector data. The values in this array are NOT valid, the caller of this routine is responsible for putting values into the array; any values it does not set will be invalid ## Synopsis ``` #include "petscvec.h" PetscErrorCode VecGetArrayWrite(Vec x, PetscScalar **a) ``` Logically Collective ## Input Parameter - ***x -*** the vector ## Output Parameter - ***a -*** location to put pointer to the array ## Note The array must be returned using a matching call to `VecRestoreArrayRead()`. For vectors associated with GPUs, the host and device vectors are not synchronized before giving access. If you need correct values in the array use `VecGetArray()` ## Fortran Note `VecGetArrayWrite()` Fortran binding is deprecated (since PETSc 3.19), use `VecGetArrayWriteF90()` ## See Also [](ch_vectors), `Vec`, `VecGetArrayWriteF90()`, `VecRestoreArray()`, `VecGetArrayRead()`, `VecGetArrays()`, `VecGetArrayF90()`, `VecGetArrayReadF90()`, `VecPlaceArray()`, `VecGetArray2d()`, `VecGetArrayPair()`, `VecRestoreArrayPair()`, `VecGetArray()`, `VecRestoreArrayWrite()` ## Level intermediate ## Location src/vec/vec/interface/rvector.c ## Examples src/dm/impls/plex/tutorials/ex11.c
src/dm/impls/plex/tutorials/ex14.c
src/snes/tutorials/ex17.c
src/tao/unconstrained/tutorials/rosenbrock3.c
src/ts/tutorials/ex23fwdadj.c
src/ts/tutorials/ex3.c
src/ts/tutorials/ex36.c
src/ts/tutorials/ex43.c
src/ts/tutorials/ex77.c
## Implementations VecGetArrayWrite_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecGetArrayWrite_SeqViennaCL in src/vec/vec/impls/seq/seqviennacl/vecviennacl.cxx
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/rvector.c) [Index of all Vec routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)