:orphan:
# VecGetLocalVectorRead
Maps the local portion of a vector into a vector.
## Synopsis
```
#include "petscvec.h"
PetscErrorCode VecGetLocalVectorRead(Vec v, Vec w)
```
Not Collective.
## Input parameter
- ***v -*** The vector for which the local vector is desired.
## Output parameter
- ***w -*** Upon exit this contains the local vector.
## Notes
You must call `VecRestoreLocalVectorRead()` when the local
vector is no longer needed.
This function is similar to `VecGetArrayRead()` which maps the local
portion into a raw pointer. `VecGetLocalVectorRead()` is usually
almost as efficient as `VecGetArrayRead()` but in certain circumstances
`VecGetLocalVectorRead()` can be much more efficient than
`VecGetArrayRead()`. This is because the construction of a contiguous
array representing the vector data required by `VecGetArrayRead()` can
be an expensive operation for certain vector types. For example, for
GPU vectors `VecGetArrayRead()` requires that the data between device
and host is synchronized.
Unlike `VecGetLocalVector()`, this routine is not collective and
preserves cached information.
## See Also
[](ch_vectors), `Vec`, `VecCreateLocalVector()`, `VecRestoreLocalVectorRead()`, `VecGetLocalVector()`, `VecGetArrayRead()`, `VecGetArray()`
## Level
beginner
## Location
src/vec/vec/interface/rvector.c
## Implementations
VecGetLocalVectorRead_Nest in src/vec/vec/impls/nest/vecnest.c
---
[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)