Skip to main content
`Ctrl`+`K`

# DMDAGetOwnershipRanges

Gets the number of indices in the x, y and z direction that are owned by each process in that direction

## Synopsis

    #include "petscdmda.h"
    PetscErrorCode DMDAGetOwnershipRanges(DM da, PeOp const PetscInt *lx[], PeOp const PetscInt *ly[], PeOp const PetscInt *lz[])

Not Collective

## Input Parameter

- da - the `DMDA` object

## Output Parameters

- lx - ownership along x direction (optional), its length is `m` the number of processes in the x-direction

- ly - ownership along y direction (optional), its length is `n` the number of processes in the y-direction

- lz - ownership along z direction (optional), its length is `p` the number of processes in the z-direction

## Notes

These correspond to the optional final arguments passed to `DMDACreate()`, `DMDACreate2d()`, `DMDACreate3d()`

You should not free these arrays, nor change the values in them. They will only have valid values while the `DMDA` they came from still exists (has not been destroyed).

These numbers are NOT multiplied by the number of dof per node.

The meaning of these is different than that returned by `VecGetOwnerShipRanges()`

## Fortran Notes

Pass `PETSC_NULL_INT_POINTER` for any array not needed.

Use `DMDARestoreOwershipRange()` to return the arrays when no longer needed

## See Also

DMDA - Creating vectors for structured grids, `DM`, `DMDA`, `DMDAGetCorners()`, `DMDAGetGhostCorners()`, `DMDACreate()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `VecGetOwnershipRanges()`

## Level

intermediate

## Location

src/dm/impls/da/da.c

## Examples

src/ksp/ksp/tutorials/ex73.c
src/dm/tutorials/ex51.c
src/ksp/ksp/tutorials/ex42.c
src/snes/tutorials/ex28.c
src/ts/tutorials/ex10.c
src/dm/tutorials/ex22.c

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