# DMForestSetAdaptivityForest
During the pre-setup phase, set the forest from which the current forest will be adapted (e.g., the current forest will be refined/coarsened/repartitioned from it) im DMSetUp().  Usually not needed by users directly: DMForestTemplate() constructs a new forest to be adapted from an old forest and calls this routine. 
## Synopsis
```
#include "petscdmforest.h" 
#include "petscdm.h" 
#include "petscdmlabel.h" 
PetscErrorCode DMForestSetAdaptivityForest(DM dm, DM adapt)
```
Note that this can be called after setup with adapt = NULL, which will clear all internal data related to the
adaptivity forest from dm.  This way, repeatedly adapting does not leave stale DM objects in memory.

Logically collective on dm


## Input Parameters

- ***dm -*** the new forest, which will be constructed from adapt
- ***adapt -*** the old forest





## See Also
 `DMForestGetAdaptivityForest()`, `DMForestSetAdaptivityPurpose()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/forest/forest.c.html#DMForestSetAdaptivityForest">src/dm/impls/forest/forest.c</A>

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/forest/forest.c)


[Index of all DMForest routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
