Function t8_forest_set_adapt

Function Documentation

void t8_forest_set_adapt(t8_forest_t forest, const t8_forest_t set_from, t8_forest_adapt_t adapt_fn, const int recursive)

Set a source forest with an adapt function to be adapted on committing.

By default, the forest takes ownership of the source set_from such that it will be destroyed on calling t8_forest_commit. To keep ownership of set_from, call t8_forest_ref before passing it into this function. This means that it is ILLEGAL to continue using set_from or dereferencing it UNLESS it is referenced directly before passing it into this function.

Note

This setting can be combined with t8_forest_set_partition and t8_forest_set_balance. The order in which these operations are executed is always 1) Adapt 2) Partition 3) Balance.

Note

This setting may not be combined with t8_forest_set_copy and overwrites this setting.

Parameters:
  • forest[inout] The forest

  • set_from[in] The source forest from which forest will be adapted. We take ownership. This can be prevented by referencing set_from. If NULL, a previously (or later) set forest will be taken (t8_forest_set_partition, t8_forest_set_balance).

  • adapt_fn[in] The adapt function used on committing.

  • recursive[in] A flag specifying whether adaptation is to be done recursively or not. If the value is zero, adaptation is not recursive and it is recursive otherwise.