# VecCreateLocalVector
Creates a vector object suitable for use with `VecGetLocalVector()` and friends. You must call `VecDestroy()` when the vector is no longer needed. 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecCreateLocalVector(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.





## See Also
 [](chapter_vectors), `Vec`, `VecGetLocalVectorRead()`, `VecRestoreLocalVectorRead()`, `VecGetLocalVector()`, `VecRestoreLocalVector()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/interface/rvector.c.html#VecCreateLocalVector">src/vec/vec/interface/rvector.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/impls/nest/vecnest.c.html#VecCreateLocalVector_Nest">VecCreateLocalVector_Nest in src/vec/vec/impls/nest/vecnest.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
