DMDAGetNeighbors — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# DMDAGetNeighbors

Gets an array containing the MPI rank of all the current processes neighbors.

## Synopsis

    #include "petscdmda.h"
    PetscErrorCode DMDAGetNeighbors(DM da, const PetscMPIInt *ranks[])

Not Collective

## Input Parameter

- da - the `DMDA` object

## Output Parameter

- ranks - the neighbors ranks, stored with the x index increasing most rapidly. The process itself is in the list

## Notes

In 2d the `ranks` is of length 9, in 3d of length 27

Not supported in 1d

Do not free the array, it is freed when the `DMDA` is destroyed.

## Fortran Note

Use `DMDARestoreNeighbors()` to return the array when no longer needed

## See Also

DMDA - Creating vectors for structured grids, `DMDA`, `DM`

## Level

intermediate

## Location

src/dm/impls/da/da.c

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