:orphan:
# DMAdaptLabel
Adapt a `DM` based on a `DMLabel` with values interpreted as coarsening and refining flags. Specific implementations of `DM` maybe have specialized flags, but all implementations should accept flag values `DM_ADAPT_DETERMINE`, `DM_ADAPT_KEEP`, `DM_ADAPT_REFINE`, and, `DM_ADAPT_COARSEN`.
## Synopsis
```
#include "petscdm.h"
PetscErrorCode DMAdaptLabel(DM dm, DMLabel label, DM *dmAdapt)
```
Collective
## Input parameters
- ***dm -*** the pre-adaptation `DM` object
- ***label -*** label with the flags
## Output parameters
- ***dmAdapt -*** the adapted `DM` object: may be `NULL` if an adapted `DM` could not be produced.
## See Also
`DM`, `DMAdaptMetric()`, `DMCoarsen()`, `DMRefine()`
## Level
intermediate
## Location
src/dm/interface/dmgenerate.c
## Examples
src/dm/impls/plex/tutorials/ex10.c
src/ts/tutorials/ex11.c
## Implementations
DMAdaptLabel_Forest in src/dm/impls/forest/forest.c
DMAdaptLabel_Plex in src/dm/impls/plex/plexadapt.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dmgenerate.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)