:orphan:
# MatMPIAdjCreateNonemptySubcommMat
create the same `MATMPIADJ` matrix on a subcommunicator containing only processes owning a positive number of rows
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatMPIAdjCreateNonemptySubcommMat(Mat A, Mat *B)
```
Collective
## Input Parameter
- ***A -*** original `MATMPIADJ` matrix
## Output Parameter
- ***B -*** matrix on subcommunicator, `NULL` on ranks that owned zero rows of `A`
## Note
This function is mostly useful for internal use by mesh partitioning packages that require that every process owns at least one row.
The matrix `B` should be destroyed with `MatDestroy()`. The arrays are not copied, so `B` should be destroyed before `A` is destroyed.
## See Also
[](ch_matrices), `Mat`, `MATMPIADJ`, `MatCreateMPIAdj()`
## Level
developer
## Location
src/mat/impls/adj/mpi/mpiadj.c
## Implementations
MatMPIAdjCreateNonemptySubcommMat_MPIAdj in src/mat/impls/adj/mpi/mpiadj.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/adj/mpi/mpiadj.c)
[Index of all Mat routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)