:orphan:
# DMDANaturalToGlobalEnd
Maps values from the natural ordering global vector to a global vector in the PETSc `DMDA` ordering. Must be preceded by `DMDANaturalToGlobalBegin()`. 
## Synopsis
```
#include "petscdmda.h"   
PetscErrorCode DMDANaturalToGlobalEnd(DM da, Vec n, InsertMode mode, Vec g)
```
Neighbor-wise Collective


## Input Parameters

- ***da -*** the distributed array context
- ***g -*** the global vector in a natural ordering
- ***mode -*** one of `INSERT_VALUES` or `ADD_VALUES`



## Output Parameter

- ***l  -*** the global values in the PETSc `DMDA` ordering





## Notes
The global and local vectors used here need not be the same as those
obtained from `DMCreateGlobalVector()` and `DMDACreateNaturalVector()`, BUT they
must have the same parallel data layout; they could, for example, be
obtained with `VecDuplicate()` from the `DMDA` originating vectors.


## See Also
 `DM`, `DMDA`, `DMDAGlobalToNaturalBegin()`, `DMDAGlobalToNaturalEnd()`, `DMLocalToGlobalBegin()`, `DMDACreate2d()`,
`DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMDACreateNaturalVector()`

## Level
advanced

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex6.c.html">src/dm/tutorials/ex6.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>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/da/dagtol.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)  
