petsc-3.14.5 2021-03-03
Report Typos and Errors

# DMGetNeighbors

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

### Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMGetNeighbors(DM dm,PetscInt *nranks,const PetscMPIInt *ranks[])

Not Collective

### Input Parameter

| dm | - The DM

### Output Parameters

| nranks | - the number of neighbours
| ranks | - the neighbors ranks

### Notes

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

.seealso: DMDAGetNeighbors(), PetscSFGetRootRanks()

### Level

beginner

### Location

src/dm/interface/dm.c

### Examples

src/dm/tutorials/swarm_ex3.c.html

### Implementations

DMGetNeighbors_DA in src/dm/impls/da/dacreate.c
DMGetNeighbors_Plex in src/dm/impls/plex/plexcreate.c
DMGetNeighbors_Stag in src/dm/impls/stag/stag.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages