Skip to main content
`Ctrl`+`K`

# 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) in `DMSetUp()`.

## Synopsis

    #include "petscdmforest.h"
    #include "petscdm.h"
    #include "petscdmlabel.h"
    PetscErrorCode DMForestSetAdaptivityForest(DM dm, DM adapt)

Logically Collective

## Input Parameters

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

- adapt - the old forest

## Note

Usually not needed by users directly, `DMForestTemplate()` constructs a new forest to be adapted from an old forest and calls this routine.

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.

## See Also

`DM`, `DMFOREST`, `DMForestGetAdaptivityForest()`, `DMForestSetAdaptivityPurpose()`

## Level

intermediate

## Location

src/dm/impls/forest/forest.c

## Examples

src/ts/tutorials/ex30.c
src/ts/tutorials/ex11.c

Index of all DMForest routines
Table of Contents for all manual pages
Index of all manual pages