DMShell and Other DM Types
This page documents DMShell (user-defined DM), DMProduct (Cartesian product of DMs), DMRedundant (redundantly-stored DM), and DMComposite (deprecated composite DM).
DMShell
DMShell allows users to define custom DM implementations by providing callback functions for operations like creating vectors, matrices, and managing topology.
Basic DMShell Usage
using PETSc, MPI
# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)
# Create a DMShell (returns a PetscDM) and set callbacks
shell = LibPETSc.DMShellCreate(petsclib, MPI.COMM_WORLD)
# Set callbacks on the returned DM, for example:
# LibPETSc.DMShellSetCreateGlobalVector(petsclib, shell, ...)
# LibPETSc.DMShellSetCreateLocalVector(petsclib, shell, ...)
# LibPETSc.DMShellSetCreateMatrix(petsclib, shell, ...)
# Set up
LibPETSc.DMSetUp(petsclib, shell)
# Cleanup
LibPETSc.DMDestroy(petsclib, shell)
# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()DMProduct
DMProduct represents a Cartesian product of multiple DMs, useful for coupled multi-physics problems.
Basic DMProduct Usage
using PETSc, MPI
# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)
# Create component DMs
dm1 = Ref{LibPETSc.CDM}()
dm2 = Ref{LibPETSc.CDM}()
# ... create dm1 and dm2 ...
# Create DMProduct
# Create two simple component DMs (here using small box DMPlex meshes)
dm1 = LibPETSc.DMPlexCreateBoxMesh(
petsclib, MPI.COMM_WORLD, 2, LibPETSc.PETSC_FALSE,
[1,1], [0.0,0.0], [1.0,1.0], [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], LibPETSc.PETSC_TRUE, 0, LibPETSc.PETSC_FALSE
)
dm2 = LibPETSc.DMPlexCreateBoxMesh(
petsclib, MPI.COMM_WORLD, 2, LibPETSc.PETSC_FALSE,
[1,1], [0.0,0.0], [1.0,1.0], [LibPETSc.DM_BOUNDARY_NONE, LibPETSc.DM_BOUNDARY_NONE], LibPETSc.PETSC_TRUE, 0, LibPETSc.PETSC_FALSE
)
# Create a DMProduct and attach component DMs
product = LibPETSc.DMCreate(petsclib, MPI.COMM_WORLD)
LibPETSc.DMSetType(petsclib, product, "product")
# Set the product 'topological' dimension to the number of component DMs
LibPETSc.DMSetDimension(petsclib, product, 2)
# Map product slots to sub-DM dimensions (index mapping); then attach sub-DMs
LibPETSc.DMProductSetDimensionIndex(petsclib, product, 0, 0)
LibPETSc.DMProductSetDimensionIndex(petsclib, product, 1, 0)
LibPETSc.DMProductSetDM(petsclib, product, 0, dm1)
LibPETSc.DMProductSetDM(petsclib, product, 1, dm2)
# Set up
LibPETSc.DMSetUp(petsclib, product)
# Cleanup
LibPETSc.DMDestroy(petsclib, product)
LibPETSc.DMDestroy(petsclib, dm1)
LibPETSc.DMDestroy(petsclib, dm2)
# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()DMRedundant
DMRedundant stores data redundantly across all processes, useful for small shared data.
DMComposite
DMComposite (deprecated, use DMProduct instead) manages multiple DMs as separate fields.
Functions
DMShell Functions
PETSc.LibPETSc.DMShellCreate — Method
dm::PetscDM = DMShellCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a DMSHELL object, used to manage user
Collective
Input Parameter:
comm- the processors that will share the global vector
Output Parameter:
dm- theDMSHELL
Level: advanced
-seealso: DMDestroy(), DMCreateGlobalVector(), DMCreateLocalVector(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellCreate
PETSc.LibPETSc.DMShellGetContext — Method
DMShellGetContext(petsclib::PetscLibType,dm::PetscDM, ctx::Cvoid)Returns the user
Collective
Input Parameter:
dm-DMSHELL
Output Parameter:
ctx- the context
Level: advanced
-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellSetContext()
External Links
- PETSc Manual:
DM/DMShellGetContext
PETSc.LibPETSc.DMShellGetGlobalVector — Method
DMShellGetGlobalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec)Returns the template global vector associated with the DMSHELL, or NULL if it was not set
Not Collective
Input Parameters:
dm-DMSHELLX- template vector
Level: advanced
-seealso: DM, DMSHELL, DMShellSetGlobalVector(), DMShellSetCreateGlobalVector(), DMCreateGlobalVector()
External Links
- PETSc Manual:
DM/DMShellGetGlobalVector
PETSc.LibPETSc.DMShellSetCoarsen — Method
DMShellSetCoarsen(petsclib::PetscLibType,dm::PetscDM, coarsen::external)Set the routine used to coarsen the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLcoarsen- the routine that coarsens theDM
Level: advanced
-seealso: DM, DMSHELL, DMShellSetRefine(), DMCoarsen(), DMShellGetCoarsen(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCoarsen
PETSc.LibPETSc.DMShellSetContext — Method
DMShellSetContext(petsclib::PetscLibType,dm::PetscDM, ctx::Cvoid)set some data to be usable by this DMSHELL
Collective
Input Parameters:
dm-DMSHELLctx- the context
Level: advanced
-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetContext
PETSc.LibPETSc.DMShellSetCreateDomainDecomposition — Method
DMShellSetCreateDomainDecomposition(petsclib::PetscLibType,dm::PetscDM, decomp::external)Set the routine used to create a domain decomposition for the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLdecomp- the routine to create the decomposition
Level: advanced
-seealso: DM, DMSHELL, DMCreateDomainDecomposition(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateDomainDecomposition
PETSc.LibPETSc.DMShellSetCreateDomainDecompositionScatters — Method
DMShellSetCreateDomainDecompositionScatters(petsclib::PetscLibType,dm::PetscDM, scatter::external)Set the routine used to create the scatter contexts for domain decomposition with a DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLscatter- the routine to create the scatters
Level: advanced
-seealso: DM, DMSHELL, DMCreateDomainDecompositionScatters(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateDomainDecompositionScatters
PETSc.LibPETSc.DMShellSetCreateFieldDecomposition — Method
DMShellSetCreateFieldDecomposition(petsclib::PetscLibType,dm::PetscDM, decomp::external)Set the routine used to create a decomposition of fields for the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLdecomp- the routine to create the decomposition
Level: advanced
-seealso: DM, DMSHELL, DMCreateFieldDecomposition(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateFieldDecomposition
PETSc.LibPETSc.DMShellSetCreateGlobalVector — Method
DMShellSetCreateGlobalVector(petsclib::PetscLibType,dm::PetscDM, func::external)sets the routine to create a global vector associated with the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLfunc- the creation routine
Level: advanced
-seealso: DM, DMSHELL, DMShellSetGlobalVector(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateGlobalVector
PETSc.LibPETSc.DMShellSetCreateInjection — Method
DMShellSetCreateInjection(petsclib::PetscLibType,dm::PetscDM, inject::external)Set the routine used to create the injection operator
Logically Collective
Input Parameters:
dm- theDMSHELLinject- the routine to create the injection
Level: advanced
-seealso: DM, DMSHELL, DMShellSetCreateInterpolation(), DMCreateInjection(), DMShellGetCreateInjection(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateInjection
PETSc.LibPETSc.DMShellSetCreateInterpolation — Method
DMShellSetCreateInterpolation(petsclib::PetscLibType,dm::PetscDM, interp::external)Set the routine used to create the interpolation operator
Logically Collective
Input Parameters:
dm- theDMSHELLinterp- the routine to create the interpolation
Level: advanced
-seealso: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateInterpolation(), DMShellSetCreateRestriction(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateInterpolation
PETSc.LibPETSc.DMShellSetCreateLocalVector — Method
DMShellSetCreateLocalVector(petsclib::PetscLibType,dm::PetscDM, func::external)sets the routine to create a local vector associated with the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLfunc- the creation routine
Level: advanced
-seealso: DM, DMSHELL, DMShellSetLocalVector(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateLocalVector
PETSc.LibPETSc.DMShellSetCreateMatrix — Method
DMShellSetCreateMatrix(petsclib::PetscLibType,dm::PetscDM, func::external)sets the routine to create a matrix associated with the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLfunc- the function to create a matrix
Level: advanced
-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellSetMatrix(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateMatrix
PETSc.LibPETSc.DMShellSetCreateRestriction — Method
DMShellSetCreateRestriction(petsclib::PetscLibType,dm::PetscDM, restriction::external)Set the routine used to create the restriction operator
Logically Collective
Input Parameters:
dm- theDMSHELLrestriction- the routine to create the restriction
Level: advanced
-seealso: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateRestriction(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateRestriction
PETSc.LibPETSc.DMShellSetCreateSubDM — Method
DMShellSetCreateSubDM(petsclib::PetscLibType,dm::PetscDM, subdm::external)Set the routine used to create a sub DM from the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLsubdm- the routine to create the decomposition
Level: advanced
-seealso: DM, DMSHELL, DMCreateSubDM(), DMShellGetCreateSubDM(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetCreateSubDM
PETSc.LibPETSc.DMShellSetDestroyContext — Method
DMShellSetDestroyContext(petsclib::PetscLibType,dm::PetscDM, destroyctx::external)set a function that destroys the context provided with DMShellSetContext()
Collective
Input Parameters:
dm- theDMto attach thedestroyctx()function todestroyctx- the function that destroys the context
Level: advanced
-seealso: DM, DMSHELL, DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetDestroyContext
PETSc.LibPETSc.DMShellSetGlobalToLocal — Method
DMShellSetGlobalToLocal(petsclib::PetscLibType,dm::PetscDM, begin_::external, end_::external)Sets the routines used to perform a global to local scatter
Logically Collective
Input Parameters:
dm- theDMSHELLbegin_- the routine that begins the global to local scatterend_- the routine that ends the global to local scatter
Level: advanced
-seealso: DM, DMSHELL, DMShellSetLocalToGlobal(), DMGlobalToLocalBeginDefaultShell(), DMGlobalToLocalEndDefaultShell()
External Links
- PETSc Manual:
DM/DMShellSetGlobalToLocal
PETSc.LibPETSc.DMShellSetGlobalToLocalVecScatter — Method
DMShellSetGlobalToLocalVecScatter(petsclib::PetscLibType,dm::PetscDM, gtol::VecScatter)Sets a VecScatter context for global to local communication
Logically Collective
Input Parameters:
dm- theDMSHELLgtol- the global to localVecScattercontext
Level: advanced
-seealso: DM, DMSHELL, DMShellSetGlobalToLocal(), DMGlobalToLocalBeginDefaultShell(), DMGlobalToLocalEndDefaultShell()
External Links
- PETSc Manual:
DM/DMShellSetGlobalToLocalVecScatter
PETSc.LibPETSc.DMShellSetGlobalVector — Method
DMShellSetGlobalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec)sets a template global vector associated with the DMSHELL
Logically Collective
Input Parameters:
dm-DMSHELLX- template vector
Level: advanced
-seealso: DM, DMSHELL, DMCreateGlobalVector(), DMShellSetMatrix(), DMShellSetCreateGlobalVector()
External Links
- PETSc Manual:
DM/DMShellSetGlobalVector
PETSc.LibPETSc.DMShellSetLocalToGlobal — Method
DMShellSetLocalToGlobal(petsclib::PetscLibType,dm::PetscDM, begin_::external, end_::external)Sets the routines used to perform a local to global scatter
Logically Collective
Input Parameters:
dm- theDMSHELLbegin- the routine that begins the local to global scatterend- the routine that ends the local to global scatter
Level: advanced
-seealso: DM, DMSHELL, DMShellSetGlobalToLocal()
External Links
- PETSc Manual:
DM/DMShellSetLocalToGlobal
PETSc.LibPETSc.DMShellSetLocalToGlobalVecScatter — Method
DMShellSetLocalToGlobalVecScatter(petsclib::PetscLibType,dm::PetscDM, ltog::VecScatter)Sets aVecScatter context for local to global communication
Logically Collective
Input Parameters:
dm- theDMSHELLltog- the local to globalVecScattercontext
Level: advanced
-seealso: DM, DMSHELL, DMShellSetLocalToGlobal(), DMLocalToGlobalBeginDefaultShell(), DMLocalToGlobalEndDefaultShell()
External Links
- PETSc Manual:
DM/DMShellSetLocalToGlobalVecScatter
PETSc.LibPETSc.DMShellSetLocalToLocal — Method
DMShellSetLocalToLocal(petsclib::PetscLibType,dm::PetscDM, begin_::external, end_::external)Sets the routines used to perform a local to local scatter
Logically Collective
Input Parameters:
dm- theDMSHELLbegin- the routine that begins the local to local scatterend- the routine that ends the local to local scatter
Level: advanced
-seealso: DM, DMSHELL, DMShellSetGlobalToLocal(), DMLocalToLocalBeginDefaultShell(), DMLocalToLocalEndDefaultShell()
External Links
- PETSc Manual:
DM/DMShellSetLocalToLocal
PETSc.LibPETSc.DMShellSetLocalToLocalVecScatter — Method
DMShellSetLocalToLocalVecScatter(petsclib::PetscLibType,dm::PetscDM, ltol::VecScatter)Sets a VecScatter context for local to local communication
Logically Collective
Input Parameters:
dm- theDMSHELLltol- the local to localVecScattercontext
Level: advanced
-seealso: DM, DMSHELL, DMShellSetLocalToLocal(), DMLocalToLocalBeginDefaultShell(), DMLocalToLocalEndDefaultShell()
External Links
- PETSc Manual:
DM/DMShellSetLocalToLocalVecScatter
PETSc.LibPETSc.DMShellSetLocalVector — Method
DMShellSetLocalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec)sets a template local vector associated with the DMSHELL
Logically Collective
Input Parameters:
dm-DMSHELLX- template vector
Level: advanced
-seealso: DM, DMSHELL, DMCreateLocalVector(), DMShellSetMatrix(), DMShellSetCreateLocalVector()
External Links
- PETSc Manual:
DM/DMShellSetLocalVector
PETSc.LibPETSc.DMShellSetMatrix — Method
DMShellSetMatrix(petsclib::PetscLibType,dm::PetscDM, J::PetscMat)sets a template matrix associated with the DMSHELL
Collective
Input Parameters:
dm-DMSHELLJ- template matrix
Level: advanced
-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetMatrix
PETSc.LibPETSc.DMShellSetRefine — Method
DMShellSetRefine(petsclib::PetscLibType,dm::PetscDM, refine::external)Set the routine used to refine the DMSHELL
Logically Collective
Input Parameters:
dm- theDMSHELLrefine- the routine that refines theDM
Level: advanced
-seealso: DM, DMSHELL, DMShellSetCoarsen(), DMRefine(), DMShellGetRefine(), DMShellSetContext(), DMShellGetContext()
External Links
- PETSc Manual:
DM/DMShellSetRefine
DMProduct Functions
PETSc.LibPETSc.DMProductGetDM — Method
DMProductGetDM(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, subdm::PetscDM)Get sub
Not Collective
Input Parameters:
dm- theDMPRODUCTslot- which dimension withinDMPRODUCTwhose coordinates is being provided, in the range 0 to dim-1
Output Parameter:
subdm- the sub-DM
Level: advanced
-seealso: DMPRODUCT, DMProductSetDM(), DMProductGetDimensionIndex(), DMProductSetDimensionIndex()
External Links
- PETSc Manual:
DMPRODUCT/DMProductGetDM
PETSc.LibPETSc.DMProductGetDimensionIndex — Method
idx::PetscInt = DMProductGetDimensionIndex(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt)Get which dimension idx of the sub
Not Collective
Input Parameters:
dm- theDMPRODUCTslot- which dimension, in the range 0 to dim-1 ofdm
Output Parameter:
idx- the dimension of the sub-DM
Level: advanced
-seealso: DMPRODUCT, DMProductGetDM(), DMProductSetDimensionIndex()
External Links
- PETSc Manual:
DMPRODUCT/DMProductGetDimensionIndex
PETSc.LibPETSc.DMProductSetDM — Method
DMProductSetDM(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, subdm::PetscDM)Set sub
Not Collective
Input Parameters:
dm- theDMPRODUCTslot- which dimension withinDMPRODUCTwhose coordinates is being provided, in the range 0 to dim-1subdm- the sub-DM
Level: advanced
-seealso: DMPRODUCT, DMProductGetDM(), DMProductSetDimensionIndex(), DMProductGetDimensionIndex()
External Links
- PETSc Manual:
DMPRODUCT/DMProductSetDM
PETSc.LibPETSc.DMProductSetDimensionIndex — Method
DMProductSetDimensionIndex(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, idx::PetscInt)Set which dimension idx of the sub
Not Collective
Input Parameters:
dm- theDMPRODUCTslot- which dimension, in the range 0 to dim-1 you are providing to thedmidx- the dimension of the sub-DMto use
Level: advanced
-seealso: DMPRODUCT, DMProductGetDM(), DMProductGetDimensionIndex()
External Links
- PETSc Manual:
DMPRODUCT/DMProductSetDimensionIndex
DMRedundant Functions
PETSc.LibPETSc.DMRedundantCreate — Method
dm::PetscDM = DMRedundantCreate(petsclib::PetscLibType,comm::MPI_Comm, rank::PetscMPIInt, N::PetscInt)Creates a DM object, used to manage data for dense globally coupled variables
Collective
Input Parameters:
comm- the processors that will share the global vectorrank- the MPI rank to own the redundant valuesN- total number of degrees of freedom
Output Parameter:
dm- theDMobject of typeDMREDUNDANT
Level: advanced
-seealso: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMCreateMatrix(), DMCompositeAddDM(), DMSetType(), DMRedundantSetSize(), DMRedundantGetSize()
External Links
- PETSc Manual:
DM/DMRedundantCreate
PETSc.LibPETSc.DMRedundantGetSize — Method
N::PetscInt = DMRedundantGetSize(petsclib::PetscLibType,dm::PetscDM, rank::PetscMPIInt)Gets the size of a densely coupled redundant object
Not Collective
Input Parameter:
dm-DMobject of typeDMREDUNDANT
Output Parameters:
rank- rank of process to own the redundant degrees of freedom (orNULL)N- total number of redundant degrees of freedom (orNULL)
Level: advanced
-seealso: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMRedundantCreate(), DMRedundantSetSize()
External Links
- PETSc Manual:
DM/DMRedundantGetSize
PETSc.LibPETSc.DMRedundantSetSize — Method
DMRedundantSetSize(petsclib::PetscLibType,dm::PetscDM, rank::PetscMPIInt, N::PetscInt)Sets the size of a densely coupled redundant object
Collective
Input Parameters:
dm-DMobject of typeDMREDUNDANTrank- rank of process to own the redundant degrees of freedomN- total number of redundant degrees of freedom
Level: advanced
-seealso: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMRedundantCreate(), DMRedundantGetSize()
External Links
- PETSc Manual:
DM/DMRedundantSetSize
DMComposite Functions
PETSc.LibPETSc.DMCompositeAddDM — Method
DMCompositeAddDM(petsclib::PetscLibType,dmc::PetscDM, dm::PetscDM)adds a DM vector to a DMCOMPOSITE
Collective
Input Parameters:
dmc- theDMCOMPOSITEobjectdm- theDMobject
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeGather(), DMCreateGlobalVector(), DMCompositeScatter(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()
External Links
- PETSc Manual:
DM/DMCompositeAddDM
PETSc.LibPETSc.DMCompositeCreate — Method
packer::PetscDM = DMCompositeCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a DMCOMPOSITE, used to generate "composite" vectors made up of several subvectors.
Collective
Input Parameter:
comm- the processors that will share the global vector
Output Parameter:
packer- theDMCOMPOSITEobject
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCompositeScatter(), DMCreate() DMCompositeGather(), DMCreateGlobalVector(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess() DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()
External Links
- PETSc Manual:
DM/DMCompositeCreate
PETSc.LibPETSc.DMCompositeGatherArray — Method
DMCompositeGatherArray(petsclib::PetscLibType,dm::PetscDM, imode::InsertMode, gvec::PetscVec, lvecs::PetscVec)Gathers into a global packed vector from its individual local vectors
Collective
Input Parameters:
dm- theDMCOMPOSITEobjectgvec- the global vectorimode-INSERT_VALUESorADD_VALUESlvecs- the individual sequential vectors, NULL for any that are not needed
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeScatter(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries(),
External Links
- PETSc Manual:
DM/DMCompositeGatherArray
PETSc.LibPETSc.DMCompositeGetAccessArray — Method
DMCompositeGetAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec})Allows one to access the individual packed vectors in their global representation.
Collective
Input Parameters:
dm- theDMCOMPOSITEpvec- packed vectornwanted- number of vectors wantedwanted- sorted array of integers indicating thde vectors wanted, orNULLto get all vectors, lengthnwanted
Output Parameter:
vecs- array of requested global vectors (must be previously allocated and of lengthnwanted)
Level: advanced
-seealso: DMCOMPOSITE, DM, DMCompositeGetAccess(), DMCompositeGetEntries(), DMCompositeScatter(), DMCompositeGather()
External Links
- PETSc Manual:
DM/DMCompositeGetAccessArray
PETSc.LibPETSc.DMCompositeGetEntriesArray — Method
DMCompositeGetEntriesArray(petsclib::PetscLibType,dm::PetscDM, dms::Vector{PetscDM})Gets the DM for each entry in a DMCOMPOSITE
Not Collective
Input Parameter:
dm- theDMCOMPOSITEobject
Output Parameter:
dms- array of sufficient length (seeDMCompositeGetNumberDM()) to hold the individualDM
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGetEntries() DMCompositeGather(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeRestoreLocalVectors(), DMCompositeGetLocalVectors(), DMCompositeScatter()
External Links
- PETSc Manual:
DM/DMCompositeGetEntriesArray
PETSc.LibPETSc.DMCompositeGetGlobalISs — Method
DMCompositeGetGlobalISs(petsclib::PetscLibType,dm::PetscDM, is::Vector{IS})Gets the index sets for each composed object in a DMCOMPOSITE
Collective
Input Parameter:
dm- theDMCOMPOSITEobject
Output Parameter:
is- the array of index sets
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGather(), DMCompositeCreate(), DMCompositeGetAccess(), DMCompositeScatter(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()
External Links
- PETSc Manual:
DM/DMCompositeGetGlobalISs
PETSc.LibPETSc.DMCompositeGetISLocalToGlobalMappings — Method
DMCompositeGetISLocalToGlobalMappings(petsclib::PetscLibType,dm::PetscDM, ltogs::Vector{ISLocalToGlobalMapping})gets an ISLocalToGlobalMapping for each DM in the DMCOMPOSITE, maps to the composite global space
Collective; No Fortran Support
Input Parameter:
dm- theDMCOMPOSITEobject
Output Parameter:
ltogs- the individual mappings for each packed vector. Note that this includes
all the ghost points that individual ghosted DMDA may have.
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGather(), DMCompositeCreate(), DMCompositeGetAccess(), DMCompositeScatter(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()
External Links
- PETSc Manual:
DM/DMCompositeGetISLocalToGlobalMappings
PETSc.LibPETSc.DMCompositeGetLocalAccessArray — Method
DMCompositeGetLocalAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec})Allows one to access the individual packed vectors in their local representation.
Collective
Input Parameters:
dm- theDMCOMPOSITEpvec- packed vectornwanted- number of vectors wantedwanted- sorted array of vectors wanted, orNULLto get all vectors, lengthnwanted
Output Parameter:
vecs- array of requested local vectors (must be allocated and of lengthnwanted)
Level: advanced
-seealso: DMCOMPOSITE, DM, DMCompositeRestoreLocalAccessArray(), DMCompositeGetAccess(), DMCompositeGetEntries(), DMCompositeScatter(), DMCompositeGather()
External Links
- PETSc Manual:
DM/DMCompositeGetLocalAccessArray
PETSc.LibPETSc.DMCompositeGetLocalISs — Method
DMCompositeGetLocalISs(petsclib::PetscLibType,dm::PetscDM, is::Vector{IS})Gets index sets for each component of a composite local vector
Not Collective; No Fortran Support
Input Parameter:
dm- theDMCOMPOSITE
Output Parameter:
is- array of serial index sets for each component of theDMCOMPOSITE
Level: intermediate
-seealso: DMCOMPOSITE, DM, DMCompositeGetGlobalISs(), DMCompositeGetISLocalToGlobalMappings(), MatGetLocalSubMatrix(), MatCreateLocalRef(), DMCompositeGetNumberDM()
External Links
- PETSc Manual:
DM/DMCompositeGetLocalISs
PETSc.LibPETSc.DMCompositeGetNumberDM — Method
nDM::PetscInt = DMCompositeGetNumberDM(petsclib::PetscLibType,dm::PetscDM)Gets the number of DM objects in the DMCOMPOSITE representation.
Not Collective
Input Parameter:
dm- theDMCOMPOSITEobject
Output Parameter:
nDM- the number ofDM
Level: beginner
-seealso: DMCOMPOSITE, DM
External Links
- PETSc Manual:
DM/DMCompositeGetNumberDM
PETSc.LibPETSc.DMCompositeRestoreAccessArray — Method
DMCompositeRestoreAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{PetscVec})Returns the vectors obtained with DMCompositeGetAccessArray()
Collective
Input Parameters:
dm- theDMCOMPOSITEobjectpvec- packed vectornwanted- number of vectors wantedwanted- sorted array of vectors wanted, orNULLto restore all vectorsvecs- array of global vectors
Level: advanced
-seealso: DMCOMPOSITE, DM, DMCompositeRestoreAccess(), DMCompositeRestoreEntries(), DMCompositeScatter(), DMCompositeGather()
External Links
- PETSc Manual:
DM/DMCompositeRestoreAccessArray
PETSc.LibPETSc.DMCompositeRestoreLocalAccessArray — Method
DMCompositeRestoreLocalAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::PetscVec)Returns the vectors obtained with DMCompositeGetLocalAccessArray().
Collective
Input Parameters:
dm- theDMCOMPOSITEobjectpvec- packed vectornwanted- number of vectors wantedwanted- sorted array of vectors wanted, orNULLto restore all vectorsvecs- array of local vectors
Level: advanced
-seealso: DMCOMPOSITE, DM, DMCompositeGetLocalAccessArray(), DMCompositeRestoreAccessArray(), DMCompositeRestoreAccess(), DMCompositeRestoreEntries(), DMCompositeScatter(), DMCompositeGather()
External Links
- PETSc Manual:
DM/DMCompositeRestoreLocalAccessArray
PETSc.LibPETSc.DMCompositeScatterArray — Method
DMCompositeScatterArray(petsclib::PetscLibType,dm::PetscDM, gvec::PetscVec, lvecs::PetscVec)Scatters from a global packed vector into its individual local vectors
Collective
Input Parameters:
dm- theDMCOMPOSITEobjectgvec- the global vectorlvecs- array of local vectors, NULL for any that are not needed
Level: advanced
-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector() DMCompositeGather(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()
External Links
- PETSc Manual:
DM/DMCompositeScatterArray
PETSc.LibPETSc.DMCompositeSetCoupling — Method
DMCompositeSetCoupling(petsclib::PetscLibType,dm::PetscDM, FormCoupleLocations::external)Sets user provided routines that compute the coupling between the separate components DM in a DMCOMPOSITE to build the correct matrix nonzero structure.
Logically Collective; No Fortran Support
Input Parameters:
dm- the composite objectFormCoupleLocations- routine to set the nonzero locations in the matrix
Level: advanced
-seealso: DMCOMPOSITE, DM
External Links
- PETSc Manual:
DM/DMCompositeSetCoupling