MatGetGhosts — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# MatGetGhosts

Get the global indices of all ghost nodes defined by the sparse matrix

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatGetGhosts(Mat mat, PetscInt *nghosts, const PetscInt *ghosts[])

Collective

## Input Parameter

- mat - the matrix

## Output Parameters

- nghosts - number of ghosts (for `MATBAIJ` and `MATSBAIJ` matrices there is one ghost for each matrix block)

- ghosts - the global indices of the ghost points

## Note

`nghosts` and `ghosts` are suitable to pass into `VecCreateGhost()` or `VecCreateGhostBlock()`

## See Also

Matrices, `Mat`, `VecCreateGhost()`, `VecCreateGhostBlock()`

## Level

advanced

## Location

src/mat/interface/matrix.c

## Implementations

MatGetGhosts_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatGetGhosts_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatGetGhosts_MPISELL() in src/mat/impls/sell/mpi/mpisell.c

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