# DMSetRefineLevel
Sets the number of refinements that have generated this `DM`. 
## Synopsis
```
#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMSetRefineLevel(DM dm, PetscInt level)
```
Not Collective


## Input Parameters

- ***dm -*** the `DM` object
- ***level -*** number of refinements





## Notes
This value is used by `PCMG` to determine how many multigrid levels to use

The values are usually set automatically by the process that is causing the refinements of an initial `DM` by calling this routine.


## See Also
 `DMGetRefineLevel()`, `DMCoarsen()`, `DMGetCoarsenLevel()`, `DMDestroy()`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/interface/dm.c.html#DMSetRefineLevel">src/dm/interface/dm.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex65.c.html">src/ksp/ksp/tutorials/ex65.c.html</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
