DMForest (Adaptive Mesh Refinement)

DMForest manages adaptive mesh refinement (AMR) using forest-of-octrees (2D: quadtrees, 3D: octrees). It provides hierarchical mesh adaptation with efficient parallel implementation.

Overview

DMForest provides:

  • Adaptive mesh refinement and coarsening
  • Forest-of-octrees topology
  • Integration with p4est library
  • Multi-level mesh hierarchies for multigrid
  • Metric-based adaptation
  • Label-based adaptation

Basic Usage Pattern

using PETSc, MPI

# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)

# Create a DMForest
forest = LibPETSc.DMCreate(petsclib, MPI.COMM_WORLD)
LibPETSc.DMSetType(petsclib, forest, LibPETSc.DMFOREST)
# Set^ the geometric/topological dimension (e.g., 2 for a surface)
LibPETSc.DMSetDimension(petsclib, forest, 2)

# Set forest topology (e.g., unit square/cube)
# Set topology by name (e.g., "brick")
LibPETSc.DMForestSetTopology(petsclib, forest, "brick")

# Set base DM (initial coarse mesh) using a simple DMPlex box mesh
base_dm = LibPETSc.DMPlexCreateBoxMesh(
    petsclib, MPI.COMM_WORLD, 2, LibPETSc.PETSC_FALSE,
    [2, 2], [0.0, 0.0], [1.0, 1.0], [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], LibPETSc.PETSC_TRUE, 0, LibPETSc.PETSC_FALSE
)
LibPETSc.DMForestSetBaseDM(petsclib, forest, base_dm)

# Set initial refinement level
LibPETSc.DMForestSetInitialRefinement(petsclib, forest, 2)

# Ensure adjacency dimension and partition overlap are non-negative (some builds may leave them unset)
LibPETSc.DMForestSetAdjacencyDimension(petsclib, forest, 0)
LibPETSc.DMForestSetPartitionOverlap(petsclib, forest, 0)

# Set up
# (Skip DMSetFromOptions in this simple example to avoid parsing unexpected runtime options)
LibPETSc.DMSetUp(petsclib, forest)

# Create a new forest templated on this one (same base DM and settings); adapt it
# with DMForestSetAdaptivityForest / DMForestSetAdaptivityLabel before DMSetUp
adapted = LibPETSc.DMForestTemplate(petsclib, forest, MPI.COMM_WORLD)

# Cleanup
LibPETSc.DMDestroy(petsclib, adapted)
LibPETSc.DMDestroy(petsclib, forest)
LibPETSc.DMDestroy(petsclib, base_dm)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

DMForest Functions

PETSc.LibPETSc.DMForestGetAdaptivityForest — Method
adapt::PetscDM = DMForestGetAdaptivityForest(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the forest from which the current forest is adapted.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • adapt - the forest from which dm is/was adapted

Level: intermediate

See also: DM, DMFOREST, DMForestSetAdaptivityForest(), DMForestSetAdaptivityPurpose()

External Links

source
PETSc.LibPETSc.DMForestGetAdaptivityLabel — Method
adaptLabel::DMLabel = DMForestGetAdaptivityLabel(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the label of the pre-adaptation forest (see DMForestGetAdaptivityForest()) that holds the adaptation flags (refinement, coarsening, or some combination).

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • adaptLabel - the name of the label in the pre-adaptation forest

Level: intermediate

See also: DM, DMFOREST, DMForestSetAdaptivityLabel()

External Links

source
PETSc.LibPETSc.DMForestGetAdaptivityPurpose — Method
purpose::DMAdaptFlag = DMForestGetAdaptivityPurpose(petsclib::PetscLibType, dm::AbstractPetscDM)

Get whether the current DM is being adapted from its source (set with DMForestSetAdaptivityForest()) for the purpose of refinement (DM_ADAPT_REFINE), coarsening (DM_ADAPT_COARSEN), coarsening only the last level (DM_ADAPT_COARSEN_LAST) or undefined (DM_ADAPT_DETERMINE).

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • purpose - the adaptivity purpose

Level: advanced

See also: DM, DMFOREST, DMForestTemplate(), DMForestSetAdaptivityForest(), DMForestGetAdaptivityForest(), DMAdaptFlag

External Links

source
PETSc.LibPETSc.DMForestGetAdaptivitySF — Method
preCoarseToFine::PetscSF,coarseToPreFine::PetscSF = DMForestGetAdaptivitySF(petsclib::PetscLibType, dm::AbstractPetscDM)

Get PetscSFs that relate the pre-adaptation forest to the post-adaptation forest.

Not Collective

Input Parameter:

  • dm - the post-adaptation forest

Output Parameters:

  • preCoarseToFine - pre-adaptation coarse cells to post-adaptation fine cells: BCast goes from pre- to post-
  • coarseToPreFine - post-adaptation coarse cells to pre-adaptation fine cells: BCast goes from post- to pre-

Level: advanced

See also: DM, DMFOREST, DMForestGetComputeAdaptivitySF(), DMForestSetComputeAdaptivitySF()

External Links

source
PETSc.LibPETSc.DMForestGetAdaptivityStrategy — Method
adaptStrategy::String = DMForestGetAdaptivityStrategy(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the strategy for combining adaptivity labels from multiple processes.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • adaptStrategy - the adaptivity strategy (default DMFORESTADAPTALL)

Level: advanced

See also: DM, DMFOREST, DMFORESTADAPTALL, DMFORESTADAPTANY, DMForestSetAdaptivityStrategy()

External Links

source
PETSc.LibPETSc.DMForestGetAdaptivitySuccess — Method
success::PetscBool = DMForestGetAdaptivitySuccess(petsclib::PetscLibType, dm::AbstractPetscDM)

Return whether the requested adaptation (refinement, coarsening, repartitioning, etc.) was successful.

Collective

Input Parameter:

  • dm - the post-adaptation forest

Output Parameter:

  • success - PETSC_TRUE if the post-adaptation forest is different from the pre-adaptation forest.

Level: intermediate

See also: DM, DMFOREST

External Links

source
PETSc.LibPETSc.DMForestGetAdjacencyCodimension — Method
adjCodim::PetscInt = DMForestGetAdjacencyCodimension(petsclib::PetscLibType, dm::AbstractPetscDM)

Like DMForestGetAdjacencyDimension(), but specified as a co-dimension (so that, e.g., adjacency based on facets can be specified by codimension 1 in all cases)

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • adjCodim - default isthe dimension of the forest (see DMGetDimension()), since this is the codimension of vertices

Level: intermediate

See also: DM, DMFOREST, DMForestSetAdjacencyCodimension(), DMForestGetAdjacencyDimension()

External Links

source
PETSc.LibPETSc.DMForestGetAdjacencyDimension — Method
adjDim::PetscInt = DMForestGetAdjacencyDimension(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the dimension of interface points that determine cell adjacency (for the purposes of partitioning and overlap).

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • adjDim - default 0 (i.e., vertices determine adjacency)

Level: intermediate

See also: DM, DMFOREST, DMForestSetAdjacencyDimension(), DMForestGetAdjacencyCodimension(), DMForestSetPartitionOverlap()

External Links

source
PETSc.LibPETSc.DMForestGetBaseCoordinateMapping — Method
DMForestGetBaseCoordinateMapping(petsclib::PetscLibType, dm::AbstractPetscDM, noname::Ptr{Cvoid})

Get the user-supplied coordinate mapping previously set with DMForestSetBaseCoordinateMapping().

Not Collective

Input Parameter:

  • dm - the DMFOREST

Output Parameters:

  • func - the callback, or NULL
  • ctx - the application context that was registered with the callback, or NULL

Calling sequence of func:

  • base - the base DM of the forest
  • coarsePoint - the base-DM cell that owns the coordinate being mapped
  • dim - the coordinate dimension (at most 3)
  • coordIn - the input coordinate on the base DM
  • coordOut - the mapped coordinate to be written
  • ctx - optional application context

Level: intermediate

See also: DM, DMFOREST, DMForestSetBaseCoordinateMapping()

External Links

source
PETSc.LibPETSc.DMForestGetBaseDM — Method
base::PetscDM = DMForestGetBaseDM(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the base DM of a DMFOREST

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • base - the base DM of the forest

Level: intermediate

See also: DM, DMFOREST, DMForestSetBaseDM()

External Links

source
PETSc.LibPETSc.DMForestGetCellChart — Method
cStart::PetscInt,cEnd::PetscInt = DMForestGetCellChart(petsclib::PetscLibType, dm::AbstractPetscDM)

After the setup phase, get the local half-open interval of the chart of cells on this process

Not Collective

Input Parameter:

  • dm - the forest

Output Parameters:

  • cStart - the first cell on this process
  • cEnd - one after the final cell on this process

Level: intermediate

See also: DM, DMFOREST, DMForestGetCellSF()

External Links

source
PETSc.LibPETSc.DMForestGetCellSF — Method
cellSF::PetscSF = DMForestGetCellSF(petsclib::PetscLibType, dm::AbstractPetscDM)

After the setup phase, get the PetscSF for overlapping cells between processes

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • cellSF - the PetscSF

Level: intermediate

See also: DM, DMFOREST, DMForestGetCellChart()

External Links

source
PETSc.LibPETSc.DMForestGetCellWeightFactor — Method
weightsFactor::PetscReal = DMForestGetCellWeightFactor(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the factor by which the level of refinement changes the cell weight (see DMForestSetCellWeights()) when calculating partitions.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • weightsFactor - default 1.

Level: advanced

See also: DM, DMFOREST, DMForestSetCellWeightFactor(), DMForestSetCellWeights()

External Links

source
PETSc.LibPETSc.DMForestGetCellWeights — Method
weights::Ptr{PetscReal} = DMForestGetCellWeights(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the weights assigned to each of the cells (see DMForestGetCellChart()) of the current process: weights are used to determine parallel partitioning.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • weights - the array of weights for all cells, or NULL to indicate each cell has weight 1.

Level: advanced

See also: DM, DMFOREST, DMForestSetCellWeights(), DMForestSetWeightCapacity()

External Links

source
PETSc.LibPETSc.DMForestGetComputeAdaptivitySF — Method
computeSF::PetscBool = DMForestGetComputeAdaptivitySF(petsclib::PetscLibType, dm::AbstractPetscDM)

Get whether transfer PetscSFs should be computed relating the cells of the pre-adaptation forest to the post-adaptiation forest. After DMSetUp() is called, these transfer PetscSFs can be accessed with DMForestGetAdaptivitySF().

Not Collective

Input Parameter:

  • dm - the post-adaptation forest

Output Parameter:

  • computeSF - default PETSC_TRUE

Level: advanced

See also: DM, DMFOREST, DMForestSetComputeAdaptivitySF(), DMForestGetAdaptivitySF()

External Links

source
PETSc.LibPETSc.DMForestGetGradeFactor — Method
grade::PetscInt = DMForestGetGradeFactor(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the desired amount of grading in the mesh, e.g. give 2 to indicate that the diameter of neighboring cells should differ by at most a factor of 2. Subtypes of DMFOREST may only support one particular choice of grading factor.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • grade - the grading factor

Level: advanced

See also: DM, DMFOREST, DMForestSetGradeFactor()

External Links

source
PETSc.LibPETSc.DMForestGetInitialRefinement — Method
initRefinement::PetscInt = DMForestGetInitialRefinement(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the initial level of refinement (relative to the base DM, see DMForestGetBaseDM()) allowed in the forest.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • initRefinement - default PETSC_DEFAULT (interpreted by the subtype of DMFOREST)

Level: intermediate

See also: DM, DMFOREST, DMForestSetMinimumRefinement(), DMForestSetMaximumRefinement(), DMForestGetBaseDM()

External Links

source
PETSc.LibPETSc.DMForestGetMaximumRefinement — Method
maxRefinement::PetscInt = DMForestGetMaximumRefinement(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the maximum level of refinement (relative to the base DM, see DMForestGetBaseDM()) allowed in the forest. If the forest is being created by refining a previous forest (see DMForestGetAdaptivityForest()), this limits the amount of refinement.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • maxRefinement - default PETSC_DEFAULT (interpreted by the subtype of DMFOREST)

Level: intermediate

See also: DM, DMFOREST, DMForestSetMaximumRefinement(), DMForestGetMinimumRefinement(), DMForestGetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityForest()

External Links

source
PETSc.LibPETSc.DMForestGetMinimumRefinement — Method
minRefinement::PetscInt = DMForestGetMinimumRefinement(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the minimum level of refinement (relative to the base DM, see DMForestGetBaseDM()) allowed in the forest. If the forest is being created by coarsening a previous forest (see DMForestGetAdaptivityForest()), this limits the amount of coarsening.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • minRefinement - default PETSC_DEFAULT (interpreted by the subtype of DMFOREST)

Level: intermediate

See also: DM, DMFOREST, DMForestSetMinimumRefinement(), DMForestGetMaximumRefinement(), DMForestGetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityForest()

External Links

source
PETSc.LibPETSc.DMForestGetPartitionOverlap — Method
overlap::PetscInt = DMForestGetPartitionOverlap(petsclib::PetscLibType, dm::AbstractPetscDM)

Get the amount of cell-overlap present in parallel partitions of a forest, with values

0 indicating subdomains that are expanded by that many iterations of adding adjacent cells

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • overlap - default 0

Level: intermediate

See also: DM, DMFOREST, DMForestSetAdjacencyDimension(), DMForestSetAdjacencyCodimension()

External Links

source
PETSc.LibPETSc.DMForestGetTopology — Method
topology::String = DMForestGetTopology(petsclib::PetscLibType, dm::AbstractPetscDM)

Get a string describing the topology of a DMFOREST.

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • topology - the topology of the forest (e.g., cube, shell)

Level: intermediate

See also: DM, DMFOREST, DMForestSetTopology()

External Links

source
PETSc.LibPETSc.DMForestGetWeightCapacity — Method
capacity::PetscReal = DMForestGetWeightCapacity(petsclib::PetscLibType, dm::AbstractPetscDM)

Set the capacity of the current process when repartitioning a pre-adaptation forest (see DMForestGetAdaptivityForest()).

Not Collective

Input Parameter:

  • dm - the forest

Output Parameter:

  • capacity - this process's capacity

Level: advanced

See also: DM, DMFOREST, DMForestSetWeightCapacity(), DMForestSetCellWeights(), DMForestSetCellWeightFactor()

External Links

source
PETSc.LibPETSc.DMForestRegisterType — Method
DMForestRegisterType(petsclib::PetscLibType, name::String)

Registers a DMType as a subtype of DMFOREST (so that DMIsForest() will be correct)

Not Collective

Input Parameter:

  • name - the name of the type

Level: advanced

See also: DMFOREST, DMIsForest()

External Links

source
PETSc.LibPETSc.DMForestSetAdaptivityForest — Method
DMForestSetAdaptivityForest(petsclib::PetscLibType, dm::AbstractPetscDM, adapt::AbstractPetscDM)

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().

Logically Collective

Input Parameters:

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

Level: intermediate

See also: DM, DMFOREST, DMForestGetAdaptivityForest(), DMForestSetAdaptivityPurpose()

External Links

source
PETSc.LibPETSc.DMForestSetAdaptivityLabel — Method
DMForestSetAdaptivityLabel(petsclib::PetscLibType, dm::AbstractPetscDM, adaptLabel::DMLabel)

During the pre-setup phase, set the label of the pre-adaptation forest (see DMForestGetAdaptivityForest()) that holds the adaptation flags (refinement, coarsening, or some combination).

Logically Collective

Input Parameters:

  • dm - the forest
  • adaptLabel - the label in the pre-adaptation forest

Level: intermediate

See also: DM, DMFOREST, DMForestGetAdaptivityLabel()

External Links

source
PETSc.LibPETSc.DMForestSetAdaptivityPurpose — Method
DMForestSetAdaptivityPurpose(petsclib::PetscLibType, dm::AbstractPetscDM, purpose::DMAdaptFlag)

During the pre-setup phase, set whether the current DM is being adapted from its source (set with DMForestSetAdaptivityForest()) for the purpose of refinement (DM_ADAPT_REFINE), coarsening (DM_ADAPT_COARSEN), or undefined (DM_ADAPT_DETERMINE).

Logically Collective

Input Parameters:

  • dm - the forest
  • purpose - the adaptivity purpose

Level: advanced

See also: DM, DMFOREST, DMForestTemplate(), DMForestSetAdaptivityForest(), DMForestGetAdaptivityForest(), DMAdaptFlag

External Links

source
PETSc.LibPETSc.DMForestSetAdaptivityStrategy — Method
DMForestSetAdaptivityStrategy(petsclib::PetscLibType, dm::AbstractPetscDM, adaptStrategy::String)

During the pre-setup phase, set the strategy for combining adaptivity labels from multiple processes.

Logically Collective

Input Parameters:

  • dm - the forest
  • adaptStrategy - default DMFORESTADAPTALL

Level: advanced

See also: DM, DMFOREST, DMForestGetAdaptivityStrategy(), DMFORESTADAPTALL, DMFORESTADAPTANY

External Links

source
PETSc.LibPETSc.DMForestSetAdjacencyCodimension — Method
DMForestSetAdjacencyCodimension(petsclib::PetscLibType, dm::AbstractPetscDM, adjCodim::PetscInt)

Like DMForestSetAdjacencyDimension(), but specified as a co-dimension (so that, e.g., adjacency based on facets can be specified by codimension 1 in all cases)

Logically Collective

Input Parameters:

  • dm - the forest
  • adjCodim - default is the dimension of the forest (see DMGetDimension()), since this is the codimension of vertices

Level: intermediate

See also: DM, DMFOREST, DMForestGetAdjacencyCodimension(), DMForestSetAdjacencyDimension()

External Links

source
PETSc.LibPETSc.DMForestSetAdjacencyDimension — Method
DMForestSetAdjacencyDimension(petsclib::PetscLibType, dm::AbstractPetscDM, adjDim::PetscInt)

During the pre-setup phase, set the dimension of interface points that determine cell adjacency (for the purposes of partitioning and overlap).

Logically Collective

Input Parameters:

  • dm - the forest
  • adjDim - default 0 (i.e., vertices determine adjacency)

Level: intermediate

See also: DM, DMFOREST, DMForestGetAdjacencyDimension(), DMForestSetAdjacencyCodimension(), DMForestSetPartitionOverlap()

External Links

source
PETSc.LibPETSc.DMForestSetBaseCoordinateMapping — Method
DMForestSetBaseCoordinateMapping(petsclib::PetscLibType, dm::AbstractPetscDM, func::external, ctx::Ptr{Cvoid})

Set a user-supplied mapping that is applied to the base DM's coordinates when the forest computes coordinates for refined cells.

Logically Collective

Input Parameters:

  • dm - the DMFOREST
  • func - callback that maps reference coordinates to physical coordinates
  • ctx - optional application context passed through to func

Calling sequence of func:

  • base - the base DM of the forest
  • coarsePoint - the base-DM cell that owns the coordinate being mapped
  • dim - the coordinate dimension (at most 3)
  • coordIn - the input coordinate on the base DM
  • coordOut - the mapped coordinate to be written
  • ctx - optional application context

Level: intermediate

See also: DM, DMFOREST, DMForestGetBaseCoordinateMapping(), DMForestSetBaseDM()

External Links

source
PETSc.LibPETSc.DMForestSetBaseDM — Method
DMForestSetBaseDM(petsclib::PetscLibType, dm::AbstractPetscDM, base::AbstractPetscDM)

During the pre-setup phase, set the DM that defines the base mesh of a DMFOREST forest.

Logically Collective

Input Parameters:

  • dm - the forest
  • base - the base DM of the forest

Level: intermediate

See also: DM, DMFOREST, DMForestGetBaseDM()

External Links

source
PETSc.LibPETSc.DMForestSetCellWeightFactor — Method
DMForestSetCellWeightFactor(petsclib::PetscLibType, dm::AbstractPetscDM, weightsFactor::PetscReal)

During the pre-setup phase, set the factor by which the level of refinement changes the cell weight (see DMForestSetCellWeights()) when calculating partitions.

Logically Collective

Input Parameters:

  • dm - the forest
  • weightsFactor - default 1.

Level: advanced

See also: DM, DMFOREST, DMForestGetCellWeightFactor(), DMForestSetCellWeights()

External Links

source
PETSc.LibPETSc.DMForestSetCellWeights — Method
DMForestSetCellWeights(petsclib::PetscLibType, dm::AbstractPetscDM, weights::Vector{PetscReal}, copyMode::PetscCopyMode)

Set the weights assigned to each of the cells (see DMForestGetCellChart()) of the current process: weights are used to determine parallel partitioning.

Logically Collective

Input Parameters:

  • dm - the forest
  • weights - the array of weights (see DMForestSetWeightCapacity()) for all cells, or NULL to indicate each cell has weight 1.
  • copyMode - how weights should reference weights

Level: advanced

See also: DM, DMFOREST, DMForestGetCellWeights(), DMForestSetWeightCapacity()

External Links

source
PETSc.LibPETSc.DMForestSetComputeAdaptivitySF — Method
DMForestSetComputeAdaptivitySF(petsclib::PetscLibType, dm::AbstractPetscDM, computeSF::PetscBool)

During the pre-setup phase, set whether transfer PetscSFs should be computed relating the cells of the pre-adaptation forest to the post-adaptiation forest.

Logically Collective

Input Parameters:

  • dm - the post-adaptation forest
  • computeSF - default PETSC_TRUE

Level: advanced

See also: DM, DMFOREST, DMForestGetComputeAdaptivitySF(), DMForestGetAdaptivitySF()

External Links

source
PETSc.LibPETSc.DMForestSetGradeFactor — Method
DMForestSetGradeFactor(petsclib::PetscLibType, dm::AbstractPetscDM, grade::PetscInt)

During the pre-setup phase, set the desired amount of grading in the mesh, e.g. give 2 to indicate that the diameter of neighboring cells should differ by at most a factor of 2.

Logically Collective

Input Parameters:

  • dm - the forest
  • grade - the grading factor

Level: advanced

See also: DM, DMFOREST, DMForestGetGradeFactor()

External Links

source
PETSc.LibPETSc.DMForestSetInitialRefinement — Method
DMForestSetInitialRefinement(petsclib::PetscLibType, dm::AbstractPetscDM, initRefinement::PetscInt)

During the pre-setup phase, set the initial level of refinement (relative to the base DM, see DMForestGetBaseDM()) allowed in the forest.

Logically Collective

Input Parameters:

  • dm - the forest
  • initRefinement - default PETSC_DEFAULT (interpreted by the subtype of DMFOREST)

Level: intermediate

See also: DM, DMFOREST, DMForestSetMinimumRefinement(), DMForestSetMaximumRefinement(), DMForestGetBaseDM()

External Links

source
PETSc.LibPETSc.DMForestSetMaximumRefinement — Method
DMForestSetMaximumRefinement(petsclib::PetscLibType, dm::AbstractPetscDM, maxRefinement::PetscInt)

During the pre-setup phase, set the maximum level of refinement (relative to the base DM, see DMForestGetBaseDM()) allowed in the forest. If the forest is being created by refining a previous forest (see DMForestGetAdaptivityForest()), this limits the amount of refinement.

Logically Collective

Input Parameters:

  • dm - the forest
  • maxRefinement - default PETSC_DEFAULT (interpreted by the subtype of DMFOREST)

Level: intermediate

See also: DM, DMFOREST, DMForestGetMinimumRefinement(), DMForestSetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityDM()

External Links

source
PETSc.LibPETSc.DMForestSetMinimumRefinement — Method
DMForestSetMinimumRefinement(petsclib::PetscLibType, dm::AbstractPetscDM, minRefinement::PetscInt)

During the pre-setup phase, set the minimum level of refinement (relative to the base DM, see DMForestGetBaseDM()) allowed in the forest. If the forest is being created by coarsening a previous forest (see DMForestGetAdaptivityForest()) this limits the amount of coarsening.

Logically Collective

Input Parameters:

  • dm - the forest
  • minRefinement - default PETSC_DEFAULT (interpreted by the subtype of DMFOREST)

Level: intermediate

See also: DM, DMFOREST, DMForestGetMinimumRefinement(), DMForestSetMaximumRefinement(), DMForestSetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityForest()

External Links

source
PETSc.LibPETSc.DMForestSetPartitionOverlap — Method
DMForestSetPartitionOverlap(petsclib::PetscLibType, dm::AbstractPetscDM, overlap::PetscInt)

During the pre-setup phase, set the amount of cell-overlap present in parallel partitions of a forest, with values > 0 indicating subdomains that are expanded by that many iterations of adding adjacent cells

Logically Collective

Input Parameters:

  • dm - the forest
  • overlap - default 0

Level: intermediate

See also: DM, DMFOREST, DMForestGetPartitionOverlap(), DMForestSetAdjacencyDimension(), DMForestSetAdjacencyCodimension()

External Links

source
PETSc.LibPETSc.DMForestSetTopology — Method
DMForestSetTopology(petsclib::PetscLibType, dm::AbstractPetscDM, topology::String)

Set the topology of a DMFOREST during the pre-setup phase. The topology is a string (e.g. "cube", "shell") and can be interpreted by subtypes of DMFOREST) to construct the base DM of a forest during DMSetUp().

Logically collectiv

Input Parameters:

  • dm - the forest
  • topology - the topology of the forest

Level: intermediate

See also: DM, DMFOREST, DMForestGetTopology(), DMForestSetBaseDM()

External Links

source
PETSc.LibPETSc.DMForestSetWeightCapacity — Method
DMForestSetWeightCapacity(petsclib::PetscLibType, dm::AbstractPetscDM, capacity::PetscReal)

During the pre-setup phase, set the capacity of the current process when repartitioning a pre-adaptation forest (see DMForestGetAdaptivityForest()).

Logically Collective

Input Parameters:

  • dm - the forest
  • capacity - this process's capacity

Level: advanced

See also: DM, DMFOREST, DMForestGetWeightCapacity(), DMForestSetCellWeights(), DMForestSetCellWeightFactor()

External Links

source
PETSc.LibPETSc.DMForestTemplate — Method
tedm::PetscDM = DMForestTemplate(petsclib::PetscLibType, dm::AbstractPetscDM, comm::MPI_Comm)

Create a new DM that will be adapted from a source DM.

Collective

Input Parameters:

  • dm - the source DM object
  • comm - the communicator for the new DM (this communicator is currently ignored, but is present so that DMForestTemplate() can be used within DMCoarsen())

Output Parameter:

  • tedm - the new DM object

Level: intermediate

See also: DM, DMFOREST, DMForestSetAdaptivityForest()

External Links

source
PETSc.LibPETSc.DMForestTransferVec — Method
DMForestTransferVec(petsclib::PetscLibType, dmIn::AbstractPetscDM, vecIn::AbstractPetscVec, dmOut::AbstractPetscDM, vecOut::AbstractPetscVec, useBCs::PetscBool, time::PetscReal)

Transfer a Vec between two related DMFOREST grids, e.g. before and after adaptation.

Collective

Input Parameters:

  • dmIn - source DMFOREST
  • vecIn - vector on dmIn
  • dmOut - destination DMFOREST
  • useBCs - if PETSC_TRUE, apply boundary conditions during transfer
  • time - simulation time supplied to any time-dependent boundary conditions

Output Parameter:

  • vecOut - vector on dmOut that receives the transferred values

Level: intermediate

See also: DM, DMFOREST, DMForestTransferVecFromBase(), DMForestSetAdaptivityForest()

External Links

source
PETSc.LibPETSc.DMForestTransferVecFromBase — Method
DMForestTransferVecFromBase(petsclib::PetscLibType, dm::AbstractPetscDM, vecIn::AbstractPetscVec, vecOut::AbstractPetscVec)

Transfer a Vec defined on the base DM of a DMFOREST onto the refined forest.

Collective

Input Parameters:

  • dm - the DMFOREST
  • vecIn - vector defined on the base DM returned by DMForestGetBaseDM()

Output Parameter:

  • vecOut - vector on dm that receives the transferred values

Level: intermediate

See also: DM, DMFOREST, DMForestTransferVec(), DMForestGetBaseDM()

External Links

source