# VecGetOwnershipRanges
Returns the range of indices owned by EACH processor, assuming that the vectors are laid out with the first n1 elements on the first processor, next n2 elements on the second, etc.  For certain parallel layouts this range may not be well defined. 
## Synopsis
```
#include "petscvec.h"   
PetscErrorCode VecGetOwnershipRanges(Vec x, const PetscInt *ranges[])
```
Not Collective


## Input Parameter

- ***x -*** the vector



## Output Parameters

- ***range -*** array of length size+1 with the start and end+1 for each process





## Notes
The high argument is one more than the last element stored locally.

If the ranges are used after all vectors that share the ranges has been destroyed then the program will crash accessing ranges[].


## Fortran Note
You must PASS in an array of length size+1


## See Also
 [](chapter_vectors), `Vec`, `MatGetOwnershipRange()`, `MatGetOwnershipRanges()`, `VecGetOwnershipRange()`

## Level
beginner

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/pde_constrained/tutorials/elliptic.c.html">src/tao/pde_constrained/tutorials/elliptic.c.html</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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
