:orphan:
# DMCoarsenHierarchy
Coarsens a `DM` object, all levels at once
## Synopsis
```
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMCoarsenHierarchy(DM dm, PetscInt nlevels, DM dmc[])
```
Collective
## Input Parameters
- ***dm -*** the `DM` object
- ***nlevels -*** the number of levels of coarsening
## Output Parameter
- ***dmc -*** the coarsened `DM` hierarchy
## See Also
[](ch_dmbase), `DM`, `DMCoarsen()`, `DMRefineHierarchy()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`
## Level
developer
## Location
src/dm/interface/dm.c
## Examples
src/ksp/ksp/tutorials/ex42.c
## Implementations
DMCoarsenHierarchy_DA in src/dm/impls/da/da.c
DMCoarsenHierarchy_Moab in src/dm/impls/moab/dmmbmg.cxx
DMCoarsenHierarchy_Plex in src/dm/impls/plex/plexcoarsen.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dm.c)
[Index of all DM routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)