# VecGetKokkosViewWrite
Returns a Kokkos View that contains the array of a vector in the specified memory space. 
## Synopsis
```
template <class MemorySpace>
PetscErrorCode VecGetKokkosViewWrite(Vec, Kokkos::View<PetscScalar *, MemorySpace> *)
```

## Synopsis
```
#include <petscvec_kokkos.hpp>
PetscErrorCode VecGetKokkosViewWrite  (Vec v,Kokkos::View<PetscScalar*,MemorySpace>* kv);
```

Logically Collective


## Input Parameter

- ***v -*** the vector in type of `VECKOKKOS`



## Output Parameter

- ***kv -*** the Kokkos View with a user-specified template parameter MemorySpace



## Notes
If the vector is not of type `VECKOKKOS`, an error will be raised.

The functions is similar to `VecGetArrayWrite()`. The returned view might contain garbage data or stale data and one is not
expected to read data from the View. Instead, one is expected to overwrite all data in the View.
One must return the View by a matching `VecRestoreKokkosViewWrite()` after finishing using the View.

Currently, only two memory spaces are supported: Kokkos::HostSpace and Kokkos::DefaultExecutionSpace::memory_space.




## See Also
 `VecRestoreKokkosViewWrite()`, `VecRestoreKokkosView()`, `VecGetKokkosView()`, `VecRestoreArray()`, `VecGetArrayRead()`, `VecGetArrays()`, `VecGetArrayF90()`, `VecGetArrayReadF90()`, `VecPlaceArray()`, `VecGetArray2d()`,
`VecGetArrayPair()`, `VecRestoreArrayPair()`, `VecGetArrayWrite()`, `VecRestoreArrayWrite()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscvec_kokkos.hpp#VecGetKokkosViewWrite">include/petscvec_kokkos.hpp</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscvec_kokkos.hpp)


[Index of all Vec routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
