:orphan:
# DMPlexPreallocateOperator
Calculate the matrix nonzero pattern based upon the information in the `DM`, the `PetscDS` it contains, and the default `PetscSection`.
## Synopsis
```
#include "petscdmplex.h"
PetscErrorCode DMPlexPreallocateOperator(DM dm, PetscInt bs, PetscInt dnz[], PetscInt onz[], PetscInt dnzu[], PetscInt onzu[], Mat A, PetscBool fillMatrix)
```
Collective
## Input Parameters
- ***dm -*** The `DMPLEX`
- ***bs -*** The matrix blocksize
- ***dnz -*** An array to hold the number of nonzeros in the diagonal block
- ***onz -*** An array to hold the number of nonzeros in the off-diagonal block
- ***dnzu -*** An array to hold the number of nonzeros in the upper triangle of the diagonal block
- ***onzu -*** An array to hold the number of nonzeros in the upper triangle of the off-diagonal block
- ***fillMatrix -*** If `PETSC_TRUE`, fill the matrix with zeros
## Output Parameter
- ***A -*** The preallocated matrix
## See Also
[](ch_unstructured), `DM`, `DMPLEX`, `DMCreateMatrix()`
## Level
advanced
## Location
src/dm/impls/plex/plexpreallocate.c
## Implementations
DMPlexPreallocateOperator_2 in src/dm/impls/plex/plexpreallocate.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/plex/plexpreallocate.c)
[Index of all DMPlex routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)