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 whichdmis/was adapted
Level: intermediate
See also: DM, DMFOREST, DMForestSetAdaptivityForest(), DMForestSetAdaptivityPurpose()
External Links
- PETSc Manual:
DMForest/DMForestGetAdaptivityForest
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
- PETSc Manual:
DMForest/DMForestGetAdaptivityLabel
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
- PETSc Manual:
DMForest/DMForestGetAdaptivityPurpose
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
- PETSc Manual:
DMForest/DMForestGetAdaptivitySF
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 (defaultDMFORESTADAPTALL)
Level: advanced
See also: DM, DMFOREST, DMFORESTADAPTALL, DMFORESTADAPTANY, DMForestSetAdaptivityStrategy()
External Links
- PETSc Manual:
DMForest/DMForestGetAdaptivityStrategy
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_TRUEif the post-adaptation forest is different from the pre-adaptation forest.
Level: intermediate
See also: DM, DMFOREST
External Links
- PETSc Manual:
DMForest/DMForestGetAdaptivitySuccess
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 (seeDMGetDimension()), since this is the codimension of vertices
Level: intermediate
See also: DM, DMFOREST, DMForestSetAdjacencyCodimension(), DMForestGetAdjacencyDimension()
External Links
- PETSc Manual:
DMForest/DMForestGetAdjacencyCodimension
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
- PETSc Manual:
DMForest/DMForestGetAdjacencyDimension
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- theDMFOREST
Output Parameters:
func- the callback, orNULLctx- the application context that was registered with the callback, orNULL
Calling sequence of func:
base- the baseDMof the forestcoarsePoint- the base-DMcell that owns the coordinate being mappeddim- the coordinate dimension (at most 3)coordIn- the input coordinate on the baseDMcoordOut- the mapped coordinate to be writtenctx- optional application context
Level: intermediate
See also: DM, DMFOREST, DMForestSetBaseCoordinateMapping()
External Links
- PETSc Manual:
DMForest/DMForestGetBaseCoordinateMapping
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 baseDMof the forest
Level: intermediate
See also: DM, DMFOREST, DMForestSetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestGetBaseDM
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 processcEnd- one after the final cell on this process
Level: intermediate
See also: DM, DMFOREST, DMForestGetCellSF()
External Links
- PETSc Manual:
DMForest/DMForestGetCellChart
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- thePetscSF
Level: intermediate
See also: DM, DMFOREST, DMForestGetCellChart()
External Links
- PETSc Manual:
DMForest/DMForestGetCellSF
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
- PETSc Manual:
DMForest/DMForestGetCellWeightFactor
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, orNULLto indicate each cell has weight 1.
Level: advanced
See also: DM, DMFOREST, DMForestSetCellWeights(), DMForestSetWeightCapacity()
External Links
- PETSc Manual:
DMForest/DMForestGetCellWeights
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- defaultPETSC_TRUE
Level: advanced
See also: DM, DMFOREST, DMForestSetComputeAdaptivitySF(), DMForestGetAdaptivitySF()
External Links
- PETSc Manual:
DMForest/DMForestGetComputeAdaptivitySF
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
- PETSc Manual:
DMForest/DMForestGetGradeFactor
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- defaultPETSC_DEFAULT(interpreted by the subtype ofDMFOREST)
Level: intermediate
See also: DM, DMFOREST, DMForestSetMinimumRefinement(), DMForestSetMaximumRefinement(), DMForestGetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestGetInitialRefinement
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- defaultPETSC_DEFAULT(interpreted by the subtype ofDMFOREST)
Level: intermediate
See also: DM, DMFOREST, DMForestSetMaximumRefinement(), DMForestGetMinimumRefinement(), DMForestGetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityForest()
External Links
- PETSc Manual:
DMForest/DMForestGetMaximumRefinement
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- defaultPETSC_DEFAULT(interpreted by the subtype ofDMFOREST)
Level: intermediate
See also: DM, DMFOREST, DMForestSetMinimumRefinement(), DMForestGetMaximumRefinement(), DMForestGetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityForest()
External Links
- PETSc Manual:
DMForest/DMForestGetMinimumRefinement
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
- PETSc Manual:
DMForest/DMForestGetPartitionOverlap
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
- PETSc Manual:
DMForest/DMForestGetTopology
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
- PETSc Manual:
DMForest/DMForestGetWeightCapacity
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
- PETSc Manual:
DMForest/DMForestRegisterType
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 adaptadapt- the old forest
Level: intermediate
See also: DM, DMFOREST, DMForestGetAdaptivityForest(), DMForestSetAdaptivityPurpose()
External Links
- PETSc Manual:
DMForest/DMForestSetAdaptivityForest
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 forestadaptLabel- the label in the pre-adaptation forest
Level: intermediate
See also: DM, DMFOREST, DMForestGetAdaptivityLabel()
External Links
- PETSc Manual:
DMForest/DMForestSetAdaptivityLabel
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 forestpurpose- the adaptivity purpose
Level: advanced
See also: DM, DMFOREST, DMForestTemplate(), DMForestSetAdaptivityForest(), DMForestGetAdaptivityForest(), DMAdaptFlag
External Links
- PETSc Manual:
DMForest/DMForestSetAdaptivityPurpose
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 forestadaptStrategy- defaultDMFORESTADAPTALL
Level: advanced
See also: DM, DMFOREST, DMForestGetAdaptivityStrategy(), DMFORESTADAPTALL, DMFORESTADAPTANY
External Links
- PETSc Manual:
DMForest/DMForestSetAdaptivityStrategy
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 forestadjCodim- default is the dimension of the forest (seeDMGetDimension()), since this is the codimension of vertices
Level: intermediate
See also: DM, DMFOREST, DMForestGetAdjacencyCodimension(), DMForestSetAdjacencyDimension()
External Links
- PETSc Manual:
DMForest/DMForestSetAdjacencyCodimension
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 forestadjDim- default 0 (i.e., vertices determine adjacency)
Level: intermediate
See also: DM, DMFOREST, DMForestGetAdjacencyDimension(), DMForestSetAdjacencyCodimension(), DMForestSetPartitionOverlap()
External Links
- PETSc Manual:
DMForest/DMForestSetAdjacencyDimension
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- theDMFORESTfunc- callback that maps reference coordinates to physical coordinatesctx- optional application context passed through tofunc
Calling sequence of func:
base- the baseDMof the forestcoarsePoint- the base-DMcell that owns the coordinate being mappeddim- the coordinate dimension (at most 3)coordIn- the input coordinate on the baseDMcoordOut- the mapped coordinate to be writtenctx- optional application context
Level: intermediate
See also: DM, DMFOREST, DMForestGetBaseCoordinateMapping(), DMForestSetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestSetBaseCoordinateMapping
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 forestbase- the baseDMof the forest
Level: intermediate
See also: DM, DMFOREST, DMForestGetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestSetBaseDM
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 forestweightsFactor- default 1.
Level: advanced
See also: DM, DMFOREST, DMForestGetCellWeightFactor(), DMForestSetCellWeights()
External Links
- PETSc Manual:
DMForest/DMForestSetCellWeightFactor
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 forestweights- the array of weights (seeDMForestSetWeightCapacity()) for all cells, orNULLto indicate each cell has weight 1.copyMode- how weights should reference weights
Level: advanced
See also: DM, DMFOREST, DMForestGetCellWeights(), DMForestSetWeightCapacity()
External Links
- PETSc Manual:
DMForest/DMForestSetCellWeights
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 forestcomputeSF- defaultPETSC_TRUE
Level: advanced
See also: DM, DMFOREST, DMForestGetComputeAdaptivitySF(), DMForestGetAdaptivitySF()
External Links
- PETSc Manual:
DMForest/DMForestSetComputeAdaptivitySF
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 forestgrade- the grading factor
Level: advanced
See also: DM, DMFOREST, DMForestGetGradeFactor()
External Links
- PETSc Manual:
DMForest/DMForestSetGradeFactor
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 forestinitRefinement- defaultPETSC_DEFAULT(interpreted by the subtype ofDMFOREST)
Level: intermediate
See also: DM, DMFOREST, DMForestSetMinimumRefinement(), DMForestSetMaximumRefinement(), DMForestGetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestSetInitialRefinement
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 forestmaxRefinement- defaultPETSC_DEFAULT(interpreted by the subtype ofDMFOREST)
Level: intermediate
See also: DM, DMFOREST, DMForestGetMinimumRefinement(), DMForestSetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityDM()
External Links
- PETSc Manual:
DMForest/DMForestSetMaximumRefinement
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 forestminRefinement- defaultPETSC_DEFAULT(interpreted by the subtype ofDMFOREST)
Level: intermediate
See also: DM, DMFOREST, DMForestGetMinimumRefinement(), DMForestSetMaximumRefinement(), DMForestSetInitialRefinement(), DMForestGetBaseDM(), DMForestGetAdaptivityForest()
External Links
- PETSc Manual:
DMForest/DMForestSetMinimumRefinement
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 forestoverlap- default 0
Level: intermediate
See also: DM, DMFOREST, DMForestGetPartitionOverlap(), DMForestSetAdjacencyDimension(), DMForestSetAdjacencyCodimension()
External Links
- PETSc Manual:
DMForest/DMForestSetPartitionOverlap
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 foresttopology- the topology of the forest
Level: intermediate
See also: DM, DMFOREST, DMForestGetTopology(), DMForestSetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestSetTopology
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 forestcapacity- this process's capacity
Level: advanced
See also: DM, DMFOREST, DMForestGetWeightCapacity(), DMForestSetCellWeights(), DMForestSetCellWeightFactor()
External Links
- PETSc Manual:
DMForest/DMForestSetWeightCapacity
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 sourceDMobjectcomm- the communicator for the newDM(this communicator is currently ignored, but is present so thatDMForestTemplate()can be used withinDMCoarsen())
Output Parameter:
tedm- the newDMobject
Level: intermediate
See also: DM, DMFOREST, DMForestSetAdaptivityForest()
External Links
- PETSc Manual:
DMForest/DMForestTemplate
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- sourceDMFORESTvecIn- vector ondmIndmOut- destinationDMFORESTuseBCs- ifPETSC_TRUE, apply boundary conditions during transfertime- simulation time supplied to any time-dependent boundary conditions
Output Parameter:
vecOut- vector ondmOutthat receives the transferred values
Level: intermediate
See also: DM, DMFOREST, DMForestTransferVecFromBase(), DMForestSetAdaptivityForest()
External Links
- PETSc Manual:
DMForest/DMForestTransferVec
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- theDMFORESTvecIn- vector defined on the baseDMreturned byDMForestGetBaseDM()
Output Parameter:
vecOut- vector ondmthat receives the transferred values
Level: intermediate
See also: DM, DMFOREST, DMForestTransferVec(), DMForestGetBaseDM()
External Links
- PETSc Manual:
DMForest/DMForestTransferVecFromBase