:orphan:
# DMDAGetRay
Returns a vector on process zero that contains a row or column of the values in a `DMDA` vector 
## Synopsis
```
#include "petscdmda.h"   
PetscErrorCode DMDAGetRay(DM da, DMDirection dir, PetscInt gp, Vec *newvec, VecScatter *scatter)
```
Collective


## Input Parameters

- ***da -*** the distributed array
- ***dir -*** Cartesian direction, either `DM_X`, `DM_Y`, or `DM_Z`
- ***gp -*** global grid point number in this direction



## Output Parameters

- ***newvec -*** the new vector that can hold the values (size zero on all processes except rank 0)
- ***scatter -*** the `VecScatter` that will map from the original vector to the slice





## Note
All processors that share the `DMDA` must call this with the same gp value


## See Also
 `DM`, `DMDA`, `DMDirection`, `Vec`, `VecScatter`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/da/dasub.c.html#DMDAGetRay">src/dm/impls/da/dasub.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/da/dasub.c)


[Index of all DMDA routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
