:orphan:
# DMGetCoordinates
Gets a global vector with the coordinates associated with the `DM`. 
## Synopsis
```
#include "petscdm.h"          
PetscErrorCode DMGetCoordinates(DM dm, Vec *c)
```
Collective


## Input Parameter

- ***dm -*** the `DM`



## Output Parameter

- ***c -*** global coordinate vector





## Notes
This is a borrowed reference, so the user should NOT destroy this vector. When the `DM` is
destroyed the array will no longer be valid.

Each process has only the locally-owned portion of the global coordinates (does NOT have the ghost coordinates).

For `DMDA`, in two and three dimensions coordinates are interlaced (x_0,y_0,x_1,y_1,...)
and (x_0,y_0,z_0,x_1,y_1,z_1...)


## See Also
 `DM`, `DMDA`, `DMSetCoordinates()`, `DMGetCoordinatesLocal()`, `DMGetCoordinateDM()`, `DMDASetUniformCoordinates()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/interface/dmcoordinates.c.html#DMGetCoordinates">src/dm/interface/dmcoordinates.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/stag/tutorials/ex3.c.html">src/dm/impls/stag/tutorials/ex3.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex25.c.html">src/dm/tutorials/ex25.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex3.c.html">src/dm/tutorials/ex3.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex4.c.html">src/dm/tutorials/ex4.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/swarm_ex1.c.html">src/dm/tutorials/swarm_ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/swarm_ex3.c.html">src/dm/tutorials/swarm_ex3.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex49.c.html">src/ksp/ksp/tutorials/ex49.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex69.c.html">src/ksp/ksp/tutorials/ex69.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex71.c.html">src/ksp/ksp/tutorials/ex71.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex16.c.html">src/snes/tutorials/ex16.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex22.c.html">src/snes/tutorials/ex22.c</A><BR>


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


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