:orphan:
# VecSetUp
Sets up the internal vector data structures for the later use. 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecSetUp(Vec v)
```
Collective


## Input Parameter

- ***v -*** the `Vec` context





## Notes
For basic use of the `Vec` classes the user need not explicitly call
`VecSetUp()`, since these actions will happen automatically.


## See Also
 [](ch_vectors), `Vec`, `VecCreate()`, `VecDestroy()`

## Level
advanced

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/field/tutorials/ex1.c.html">src/dm/field/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex56.c.html">src/ksp/ksp/tutorials/ex56.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/constrained/tutorials/ex1.c.html">src/tao/constrained/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex11.c.html">src/ts/tutorials/ex11.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex31.c.html">src/ts/tutorials/ex31.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex40.c.html">src/ts/tutorials/ex40.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex41.c.html">src/ts/tutorials/ex41.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex43.c.html">src/ts/tutorials/ex43.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex51.c.html">src/ts/tutorials/ex51.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex2.c.html">src/vec/is/sf/tutorials/ex2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex3.c.html">src/vec/is/sf/tutorials/ex3.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/interface/vector.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)  
