Skip to main content
`Ctrl`+`K`

# DMDACreateNaturalVector

Creates a parallel PETSc vector that will hold vector values in the natural numbering, rather than in the PETSc parallel numbering associated with the `DMDA`.

## Synopsis

    #include "petscdmda.h"
    PetscErrorCode DMDACreateNaturalVector(DM da, Vec *g)

Collective

## Input Parameter

- da - the `DMDA`

## Output Parameter

- g - the distributed global vector

## Notes

The natural numbering is a number of grid nodes that starts with, in three dimensions, with (0,0,0), (1,0,0), (2,0,0), …, (m-1,0,0) followed by (0,1,0), (1,1,0), (2,1,0), …, (m,1,0) etc up to (0,n-1,p-1), (1,n-1,p-1), (2,n-1,p-1), …, (m-1,n-1,p-1).

The output parameter, `g`, is a regular `Vec` that should be destroyed with a call to `VecDestroy()` when usage is finished.

The number of local entries in the vector on each process is the same as in a vector created with `DMCreateGlobalVector()`.

## See Also

DMDA - Creating vectors for structured grids, `DM`, `DMDA`, `DMDAGlobalToNaturalBegin()`, `DMDAGlobalToNaturalEnd()`, `DMDANaturalToGlobalBegin()`, `DMDANaturalToGlobalEnd()`, `DMCreateLocalVector()`, `VecDuplicate()`, `VecDuplicateVecs()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`

## Level

advanced

## Location

src/dm/impls/da/dadist.c

## Examples

src/ksp/ksp/tutorials/ex71.c
src/dm/tutorials/ex6.c

Index of all DMDA routines
Table of Contents for all manual pages
Index of all manual pages