:orphan:
# VecStrideGatherAll
Gathers all the single components from a multi-component vector into separate vectors. 
## Synopsis
```
#include "petscvec.h" 
PetscErrorCode VecStrideGatherAll(Vec v, Vec s[], InsertMode addv)
```
Collective


## Input Parameters

- ***v -*** the vector
- ***addv -*** one of `ADD_VALUES`, `INSERT_VALUES`, `MAX_VALUES`



## Output Parameter

- ***s -*** the location where the subvectors are stored





## Notes
One must call `VecSetBlockSize()` before this routine to set the stride
information, or use a vector created from a multicomponent `DMDA`.

If x is the array representing the vector x then this gathers
the arrays (x[start],x[start+stride],x[start+2*stride], ....)
for start=0,1,2,...bs-1

The parallel layout of the vector and the subvector must be the same;
i.e., nlocal of v = stride*(nlocal of s)

Not optimized; could be easily


## See Also
 `Vec`, `VecStrideNorm()`, `VecStrideScatter()`, `VecStrideMin()`, `VecStrideMax()`, `VecStrideGather()`,
`VecStrideScatterAll()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/utils/vinv.c.html#VecStrideGatherAll">src/vec/vec/utils/vinv.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex7.c.html">src/snes/tutorials/ex7.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/tutorials/ex16.c.html">src/vec/vec/tutorials/ex16.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/tutorials/ex16f.F90.html">src/vec/vec/tutorials/ex16f.F90</A><BR>


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