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.DMShellCreateMethod
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 - the DMSHELL

Level: advanced

-seealso: DMDestroy(), DMCreateGlobalVector(), DMCreateLocalVector(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellGetContextMethod
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

source
PETSc.LibPETSc.DMShellGetGlobalVectorMethod
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 - DMSHELL
  • X - template vector

Level: advanced

-seealso: DM, DMSHELL, DMShellSetGlobalVector(), DMShellSetCreateGlobalVector(), DMCreateGlobalVector()

External Links

source
PETSc.LibPETSc.DMShellSetCoarsenMethod
DMShellSetCoarsen(petsclib::PetscLibType,dm::PetscDM, coarsen::external)

Set the routine used to coarsen the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • coarsen - the routine that coarsens the DM

Level: advanced

-seealso: DM, DMSHELL, DMShellSetRefine(), DMCoarsen(), DMShellGetCoarsen(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetContextMethod
DMShellSetContext(petsclib::PetscLibType,dm::PetscDM, ctx::Cvoid)

set some data to be usable by this DMSHELL

Collective

Input Parameters:

  • dm - DMSHELL
  • ctx - the context

Level: advanced

-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateDomainDecompositionMethod
DMShellSetCreateDomainDecomposition(petsclib::PetscLibType,dm::PetscDM, decomp::external)

Set the routine used to create a domain decomposition for the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • decomp - the routine to create the decomposition

Level: advanced

-seealso: DM, DMSHELL, DMCreateDomainDecomposition(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateDomainDecompositionScattersMethod
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 - the DMSHELL
  • scatter - the routine to create the scatters

Level: advanced

-seealso: DM, DMSHELL, DMCreateDomainDecompositionScatters(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateFieldDecompositionMethod
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 - the DMSHELL
  • decomp - the routine to create the decomposition

Level: advanced

-seealso: DM, DMSHELL, DMCreateFieldDecomposition(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateGlobalVectorMethod
DMShellSetCreateGlobalVector(petsclib::PetscLibType,dm::PetscDM, func::external)

sets the routine to create a global vector associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • func - the creation routine

Level: advanced

-seealso: DM, DMSHELL, DMShellSetGlobalVector(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateInjectionMethod
DMShellSetCreateInjection(petsclib::PetscLibType,dm::PetscDM, inject::external)

Set the routine used to create the injection operator

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • inject - the routine to create the injection

Level: advanced

-seealso: DM, DMSHELL, DMShellSetCreateInterpolation(), DMCreateInjection(), DMShellGetCreateInjection(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateInterpolationMethod
DMShellSetCreateInterpolation(petsclib::PetscLibType,dm::PetscDM, interp::external)

Set the routine used to create the interpolation operator

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • interp - the routine to create the interpolation

Level: advanced

-seealso: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateInterpolation(), DMShellSetCreateRestriction(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateLocalVectorMethod
DMShellSetCreateLocalVector(petsclib::PetscLibType,dm::PetscDM, func::external)

sets the routine to create a local vector associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • func - the creation routine

Level: advanced

-seealso: DM, DMSHELL, DMShellSetLocalVector(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateMatrixMethod
DMShellSetCreateMatrix(petsclib::PetscLibType,dm::PetscDM, func::external)

sets the routine to create a matrix associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • func - the function to create a matrix

Level: advanced

-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellSetMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateRestrictionMethod
DMShellSetCreateRestriction(petsclib::PetscLibType,dm::PetscDM, restriction::external)

Set the routine used to create the restriction operator

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • restriction - the routine to create the restriction

Level: advanced

-seealso: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateRestriction(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateSubDMMethod
DMShellSetCreateSubDM(petsclib::PetscLibType,dm::PetscDM, subdm::external)

Set the routine used to create a sub DM from the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • subdm - the routine to create the decomposition

Level: advanced

-seealso: DM, DMSHELL, DMCreateSubDM(), DMShellGetCreateSubDM(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetDestroyContextMethod
DMShellSetDestroyContext(petsclib::PetscLibType,dm::PetscDM, destroyctx::external)

set a function that destroys the context provided with DMShellSetContext()

Collective

Input Parameters:

  • dm - the DM to attach the destroyctx() function to
  • destroyctx - the function that destroys the context

Level: advanced

-seealso: DM, DMSHELL, DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetGlobalToLocalMethod
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 - the DMSHELL
  • begin_ - the routine that begins the global to local scatter
  • end_ - the routine that ends the global to local scatter

Level: advanced

-seealso: DM, DMSHELL, DMShellSetLocalToGlobal(), DMGlobalToLocalBeginDefaultShell(), DMGlobalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetGlobalToLocalVecScatterMethod
DMShellSetGlobalToLocalVecScatter(petsclib::PetscLibType,dm::PetscDM, gtol::VecScatter)

Sets a VecScatter context for global to local communication

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • gtol - the global to local VecScatter context

Level: advanced

-seealso: DM, DMSHELL, DMShellSetGlobalToLocal(), DMGlobalToLocalBeginDefaultShell(), DMGlobalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetGlobalVectorMethod
DMShellSetGlobalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec)

sets a template global vector associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - DMSHELL
  • X - template vector

Level: advanced

-seealso: DM, DMSHELL, DMCreateGlobalVector(), DMShellSetMatrix(), DMShellSetCreateGlobalVector()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToGlobalMethod
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 - the DMSHELL
  • begin - the routine that begins the local to global scatter
  • end - the routine that ends the local to global scatter

Level: advanced

-seealso: DM, DMSHELL, DMShellSetGlobalToLocal()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToGlobalVecScatterMethod
DMShellSetLocalToGlobalVecScatter(petsclib::PetscLibType,dm::PetscDM, ltog::VecScatter)

Sets aVecScatter context for local to global communication

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • ltog - the local to global VecScatter context

Level: advanced

-seealso: DM, DMSHELL, DMShellSetLocalToGlobal(), DMLocalToGlobalBeginDefaultShell(), DMLocalToGlobalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToLocalMethod
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 - the DMSHELL
  • begin - the routine that begins the local to local scatter
  • end - the routine that ends the local to local scatter

Level: advanced

-seealso: DM, DMSHELL, DMShellSetGlobalToLocal(), DMLocalToLocalBeginDefaultShell(), DMLocalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToLocalVecScatterMethod
DMShellSetLocalToLocalVecScatter(petsclib::PetscLibType,dm::PetscDM, ltol::VecScatter)

Sets a VecScatter context for local to local communication

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • ltol - the local to local VecScatter context

Level: advanced

-seealso: DM, DMSHELL, DMShellSetLocalToLocal(), DMLocalToLocalBeginDefaultShell(), DMLocalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetLocalVectorMethod
DMShellSetLocalVector(petsclib::PetscLibType,dm::PetscDM, X::PetscVec)

sets a template local vector associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - DMSHELL
  • X - template vector

Level: advanced

-seealso: DM, DMSHELL, DMCreateLocalVector(), DMShellSetMatrix(), DMShellSetCreateLocalVector()

External Links

source
PETSc.LibPETSc.DMShellSetMatrixMethod
DMShellSetMatrix(petsclib::PetscLibType,dm::PetscDM, J::PetscMat)

sets a template matrix associated with the DMSHELL

Collective

Input Parameters:

  • dm - DMSHELL
  • J - template matrix

Level: advanced

-seealso: DM, DMSHELL, DMCreateMatrix(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetRefineMethod
DMShellSetRefine(petsclib::PetscLibType,dm::PetscDM, refine::external)

Set the routine used to refine the DMSHELL

Logically Collective

Input Parameters:

  • dm - the DMSHELL
  • refine - the routine that refines the DM

Level: advanced

-seealso: DM, DMSHELL, DMShellSetCoarsen(), DMRefine(), DMShellGetRefine(), DMShellSetContext(), DMShellGetContext()

External Links

source

DMProduct Functions

PETSc.LibPETSc.DMProductGetDMMethod
DMProductGetDM(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, subdm::PetscDM)

Get sub

Not Collective

Input Parameters:

  • dm - theDMPRODUCT
  • slot - which dimension within DMPRODUCT whose 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

source
PETSc.LibPETSc.DMProductGetDimensionIndexMethod
idx::PetscInt = DMProductGetDimensionIndex(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt)

Get which dimension idx of the sub

Not Collective

Input Parameters:

  • dm - the DMPRODUCT
  • slot - which dimension, in the range 0 to dim-1 of dm

Output Parameter:

  • idx - the dimension of the sub-DM

Level: advanced

-seealso: DMPRODUCT, DMProductGetDM(), DMProductSetDimensionIndex()

External Links

source
PETSc.LibPETSc.DMProductSetDMMethod
DMProductSetDM(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, subdm::PetscDM)

Set sub

Not Collective

Input Parameters:

  • dm - the DMPRODUCT
  • slot - which dimension within DMPRODUCT whose coordinates is being provided, in the range 0 to dim-1
  • subdm - the sub-DM

Level: advanced

-seealso: DMPRODUCT, DMProductGetDM(), DMProductSetDimensionIndex(), DMProductGetDimensionIndex()

External Links

source
PETSc.LibPETSc.DMProductSetDimensionIndexMethod
DMProductSetDimensionIndex(petsclib::PetscLibType,dm::PetscDM, slot::PetscInt, idx::PetscInt)

Set which dimension idx of the sub

Not Collective

Input Parameters:

  • dm - the DMPRODUCT
  • slot - which dimension, in the range 0 to dim-1 you are providing to the dm
  • idx - the dimension of the sub-DM to use

Level: advanced

-seealso: DMPRODUCT, DMProductGetDM(), DMProductGetDimensionIndex()

External Links

source

DMRedundant Functions

PETSc.LibPETSc.DMRedundantCreateMethod
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 vector
  • rank - the MPI rank to own the redundant values
  • N - total number of degrees of freedom

Output Parameter:

  • dm - the DM object of type DMREDUNDANT

Level: advanced

-seealso: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMCreateMatrix(), DMCompositeAddDM(), DMSetType(), DMRedundantSetSize(), DMRedundantGetSize()

External Links

source
PETSc.LibPETSc.DMRedundantGetSizeMethod
N::PetscInt = DMRedundantGetSize(petsclib::PetscLibType,dm::PetscDM, rank::PetscMPIInt)

Gets the size of a densely coupled redundant object

Not Collective

Input Parameter:

  • dm - DM object of type DMREDUNDANT

Output Parameters:

  • rank - rank of process to own the redundant degrees of freedom (or NULL)
  • N - total number of redundant degrees of freedom (or NULL)

Level: advanced

-seealso: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMRedundantCreate(), DMRedundantSetSize()

External Links

source
PETSc.LibPETSc.DMRedundantSetSizeMethod
DMRedundantSetSize(petsclib::PetscLibType,dm::PetscDM, rank::PetscMPIInt, N::PetscInt)

Sets the size of a densely coupled redundant object

Collective

Input Parameters:

  • dm - DM object of type DMREDUNDANT
  • rank - rank of process to own the redundant degrees of freedom
  • N - total number of redundant degrees of freedom

Level: advanced

-seealso: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMRedundantCreate(), DMRedundantGetSize()

External Links

source

DMComposite Functions

PETSc.LibPETSc.DMCompositeAddDMMethod
DMCompositeAddDM(petsclib::PetscLibType,dmc::PetscDM, dm::PetscDM)

adds a DM vector to a DMCOMPOSITE

Collective

Input Parameters:

  • dmc - the DMCOMPOSITE object
  • dm - the DM object

Level: advanced

-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeGather(), DMCreateGlobalVector(), DMCompositeScatter(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()

External Links

source
PETSc.LibPETSc.DMCompositeCreateMethod
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 - the DMCOMPOSITE object

Level: advanced

-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCompositeScatter(), DMCreate() DMCompositeGather(), DMCreateGlobalVector(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess() DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()

External Links

source
PETSc.LibPETSc.DMCompositeGatherArrayMethod
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 - the DMCOMPOSITE object
  • gvec - the global vector
  • imode - INSERT_VALUES or ADD_VALUES
  • lvecs - 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

source
PETSc.LibPETSc.DMCompositeGetAccessArrayMethod
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 - the DMCOMPOSITE
  • pvec - packed vector
  • nwanted - number of vectors wanted
  • wanted - sorted array of integers indicating thde vectors wanted, or NULL to get all vectors, length nwanted

Output Parameter:

  • vecs - array of requested global vectors (must be previously allocated and of length nwanted)

Level: advanced

-seealso: DMCOMPOSITE, DM, DMCompositeGetAccess(), DMCompositeGetEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeGetEntriesArrayMethod
DMCompositeGetEntriesArray(petsclib::PetscLibType,dm::PetscDM, dms::Vector{PetscDM})

Gets the DM for each entry in a DMCOMPOSITE

Not Collective

Input Parameter:

  • dm - the DMCOMPOSITE object

Output Parameter:

  • dms - array of sufficient length (see DMCompositeGetNumberDM()) to hold the individual DM

Level: advanced

-seealso: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGetEntries() DMCompositeGather(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeRestoreLocalVectors(), DMCompositeGetLocalVectors(), DMCompositeScatter()

External Links

source
PETSc.LibPETSc.DMCompositeGetGlobalISsMethod
DMCompositeGetGlobalISs(petsclib::PetscLibType,dm::PetscDM, is::Vector{IS})

Gets the index sets for each composed object in a DMCOMPOSITE

Collective

Input Parameter:

  • dm - the DMCOMPOSITE object

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

source
PETSc.LibPETSc.DMCompositeGetISLocalToGlobalMappingsMethod
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 - the DMCOMPOSITE object

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

source
PETSc.LibPETSc.DMCompositeGetLocalAccessArrayMethod
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 - the DMCOMPOSITE
  • pvec - packed vector
  • nwanted - number of vectors wanted
  • wanted - sorted array of vectors wanted, or NULL to get all vectors, length nwanted

Output Parameter:

  • vecs - array of requested local vectors (must be allocated and of length nwanted)

Level: advanced

-seealso: DMCOMPOSITE, DM, DMCompositeRestoreLocalAccessArray(), DMCompositeGetAccess(), DMCompositeGetEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeGetLocalISsMethod
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 - the DMCOMPOSITE

Output Parameter:

  • is - array of serial index sets for each component of the DMCOMPOSITE

Level: intermediate

-seealso: DMCOMPOSITE, DM, DMCompositeGetGlobalISs(), DMCompositeGetISLocalToGlobalMappings(), MatGetLocalSubMatrix(), MatCreateLocalRef(), DMCompositeGetNumberDM()

External Links

source
PETSc.LibPETSc.DMCompositeGetNumberDMMethod
nDM::PetscInt = DMCompositeGetNumberDM(petsclib::PetscLibType,dm::PetscDM)

Gets the number of DM objects in the DMCOMPOSITE representation.

Not Collective

Input Parameter:

  • dm - the DMCOMPOSITE object

Output Parameter:

  • nDM - the number of DM

Level: beginner

-seealso: DMCOMPOSITE, DM

External Links

source
PETSc.LibPETSc.DMCompositeRestoreAccessArrayMethod
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 - the DMCOMPOSITE object
  • pvec - packed vector
  • nwanted - number of vectors wanted
  • wanted - sorted array of vectors wanted, or NULL to restore all vectors
  • vecs - array of global vectors

Level: advanced

-seealso: DMCOMPOSITE, DM, DMCompositeRestoreAccess(), DMCompositeRestoreEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeRestoreLocalAccessArrayMethod
DMCompositeRestoreLocalAccessArray(petsclib::PetscLibType,dm::PetscDM, pvec::PetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::PetscVec)

Returns the vectors obtained with DMCompositeGetLocalAccessArray().

Collective

Input Parameters:

  • dm - the DMCOMPOSITE object
  • pvec - packed vector
  • nwanted - number of vectors wanted
  • wanted - sorted array of vectors wanted, or NULL to restore all vectors
  • vecs - array of local vectors

Level: advanced

-seealso: DMCOMPOSITE, DM, DMCompositeGetLocalAccessArray(), DMCompositeRestoreAccessArray(), DMCompositeRestoreAccess(), DMCompositeRestoreEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeScatterArrayMethod
DMCompositeScatterArray(petsclib::PetscLibType,dm::PetscDM, gvec::PetscVec, lvecs::PetscVec)

Scatters from a global packed vector into its individual local vectors

Collective

Input Parameters:

  • dm - the DMCOMPOSITE object
  • gvec - the global vector
  • lvecs - 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

source
PETSc.LibPETSc.DMCompositeSetCouplingMethod
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 object
  • FormCoupleLocations - routine to set the nonzero locations in the matrix

Level: advanced

-seealso: DMCOMPOSITE, DM

External Links

source