:orphan:
# DMStagGetGlobalSizes
get global element counts
## Synopsis
```
PetscErrorCode DMStagGetGlobalSizes(DM dm, PetscInt *M, PetscInt *N, PetscInt *P)
```
Not Collective
## Input Parameter
- ***dm -*** the `DMSTAG` object
## Output Parameters
- ***M -*** global element counts in the x direction
- ***N -*** global element counts in the y direction
- ***P -*** global element counts in the z direction
## Note
Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to `NULL` in this case.
## See Also
[](ch_stag), `DMSTAG`, `DMStagGetLocalSizes()`, `DMDAGetInfo()`
## Level
beginner
## Location
src/dm/impls/stag/stagutils.c
## Examples
src/dm/impls/stag/tutorials/ex2.c
src/dm/impls/stag/tutorials/ex3.c
src/dm/impls/stag/tutorials/ex4.c
src/dm/impls/stag/tutorials/ex6.c
src/dm/impls/stag/tutorials/ex8.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/stag/stagutils.c)
[Index of all DMStag routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)