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 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-defined problem data

Collective

Input Parameter:

  • comm - the processors that will share the global vector

Output Parameter:

  • dm - the DMSHELL

Level: advanced

See also: DMDestroy(), DMCreateGlobalVector(), DMCreateLocalVector(), DMShellSetContext(), DMShellGetContext()

External Links

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

Get the routine used to coarsen the DMSHELL

Logically Collective

Input Parameter:

  • dm - the DMSHELL

Output Parameter:

  • coarsen - the routine that coarsens the DM

Calling sequence of coarsen:

  • fine - the DM to coarsen
  • comm - the MPI_Comm to share the coarser DM
  • coarse - the resulting coarse DM

Level: advanced

See also: DM, DMSHELL, DMShellSetCoarsen(), DMCoarsen(), DMShellSetRefine(), DMRefine()

External Links

source
PETSc.LibPETSc.DMShellGetContext — Method
ctx::Ptr{Cvoid} = DMShellGetContext(petsclib::PetscLibType, dm::AbstractPetscDM)

Returns the user-provided context associated to the DMSHELL

Collective

Input Parameter:

  • dm - DMSHELL

Output Parameter:

  • ctx - the context

Level: advanced

See also: DM, DMSHELL, DMCreateMatrix(), DMShellSetContext()

External Links

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

Get the routine used to create the injection operator

Logically Collective

Input Parameter:

  • dm - the DMSHELL

Output Parameter:

  • inject - the routine to create the injection

Calling sequence of inject:

  • fine - the fine DM
  • coarse - the DM to inject to
  • inject - the output injection Mat

Level: advanced

See also: DM, DMSHELL, DMShellGetCreateInterpolation(), DMCreateInjection(), DMShellSetContext(), DMShellGetContext()

External Links

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

Get the routine used to create the interpolation operator

Logically Collective

Input Parameter:

  • dm - the DMSHELL

Output Parameter:

  • interp - the routine to create the interpolation

Calling sequence of interp:

  • coarse - the DM to refine to
  • fine - the fine DM
  • interp - the output interpolation Mat
  • rscale - an output scaling Vec, see DMCreateInterpolationScale()

Level: advanced

See also: DM, DMSHELL, DMShellGetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateRestriction(), DMShellSetContext(), DMShellGetContext()

External Links

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

Get the routine used to create the restriction operator

Logically Collective

Input Parameter:

  • dm - the DMSHELL

Output Parameter:

  • restriction - the routine to create the restriction

Calling sequence of restriction:

  • fine - the fine DM
  • coarse - the DM to restrict to
  • restrct - the output restriction Mat

Level: advanced

See also: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellSetContext(), DMShellGetContext()

External Links

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

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

Logically Collective

Input Parameter:

  • dm - the DMSHELL

Output Parameter:

  • subdm - the routine to create the decomposition

Calling sequence of subdm:

  • dm - the original DM
  • numFields - the number of fields to create
  • fields - the fields to create for
  • is - output, the IS defining the sub DM
  • subdm - the sub DM

Level: advanced

See also: DM, DMSHELL, DMCreateSubDM(), DMShellSetCreateSubDM(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellGetGlobalVector — Method
DMShellGetGlobalVector(petsclib::PetscLibType, dm::AbstractPetscDM, X::AbstractPetscVec)

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

See also: DM, DMSHELL, DMShellSetGlobalVector(), DMShellSetCreateGlobalVector(), DMCreateGlobalVector()

External Links

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

Get the routine used to refine the DMSHELL

Logically Collective

Input Parameter:

  • dm - the DMSHELL

Output Parameter:

  • refine - the routine that refines the DM

Calling sequence of refine:

  • coarse - the DM to refine
  • comm - the MPI_Comm to share the finer DM
  • fine - the resulting fine DM

Level: advanced

See also: DM, DMSHELL, DMShellSetCoarsen(), DMCoarsen(), DMShellSetRefine(), DMRefine()

External Links

source
PETSc.LibPETSc.DMShellSetCoarsen — Method
DMShellSetCoarsen(petsclib::PetscLibType, dm::AbstractPetscDM, coarsen::external)

Set the routine used to coarsen the DMSHELL

Logically Collective

Input Parameters:

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

Calling sequence of coarsen:

  • fine - the DM to coarsen
  • comm - the MPI_Comm to share the coarser DM
  • coarse - the resulting coarse DM

Level: advanced

See also: DM, DMSHELL, DMShellSetRefine(), DMCoarsen(), DMShellGetCoarsen(), DMShellSetContext(), DMShellGetContext()

External Links

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

set some data to be usable by this DMSHELL

Collective

Input Parameters:

  • dm - DMSHELL
  • ctx - the context

Level: advanced

See also: DM, DMSHELL, DMCreateMatrix(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateDomainDecomposition — Method
DMShellSetCreateDomainDecomposition(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of decomp:

  • dm - the DM to decompose into domains
  • len - output, the number of domains (or NULL if not requested)
  • namelist - output, the name for each domain (or NULL if not requested)
  • innerlist - output, the global indices for each domain's inner region (or NULL if not requested)
  • outerlist - output, the global indices for each domain's outer region (or NULL if not requested)
  • dmlist - output, the DMs for each field subproblem (or NULL, if not requested; if NULL is returned, no DMs are defined)

Level: advanced

See also: DM, DMSHELL, DMCreateDomainDecomposition(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateDomainDecompositionScatters — Method
DMShellSetCreateDomainDecompositionScatters(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of scatter:

  • dm - the DM to decompose into domains
  • n - number of subdomains
  • subdms - the sub DM
  • iscat - output, the inner scatters for the subdomains
  • oscat - output, outer scatters for the subdomains
  • gscat - output, the global scatters for the subdomains

Level: advanced

See also: DM, DMSHELL, DMCreateDomainDecompositionScatters(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateFieldDecomposition — Method
DMShellSetCreateFieldDecomposition(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of decomp:

  • dm - the DM to decompose into fields
  • len - output, the number of fields (or NULL if not requested)
  • namelist - output, the name for each field (or NULL if not requested)
  • islist - output, the global indices for each field (or NULL if not requested)
  • dmlist - output, the DMs for each field subproblem (or NULL, if not requested; if NULL is returned, no DMs are defined)

Level: advanced

See also: DM, DMSHELL, DMCreateFieldDecomposition(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateGlobalVector — Method
DMShellSetCreateGlobalVector(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of func:

  • dm - the DM
  • g - the global Vec to be created

Level: advanced

See also: DM, DMSHELL, DMShellSetGlobalVector(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateInjection — Method
DMShellSetCreateInjection(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of inject:

  • fine - the fine DM
  • coarse - the DM to inject to
  • inject - the output injection Mat

Level: advanced

See also: DM, DMSHELL, DMShellSetCreateInterpolation(), DMCreateInjection(), DMShellGetCreateInjection(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateInterpolation — Method
DMShellSetCreateInterpolation(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of interp:

  • coarse - the DM to refine to
  • fine - the fine DM
  • interp - the output interpolation Mat
  • rscale - an output scaling Vec, see DMCreateInterpolationScale()

Level: advanced

See also: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateInterpolation(), DMShellSetCreateRestriction(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateLocalVector — Method
DMShellSetCreateLocalVector(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of func:

  • dm - the DM
  • l - the local Vec to be created

Level: advanced

See also: DM, DMSHELL, DMShellSetLocalVector(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateMatrix — Method
DMShellSetCreateMatrix(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of func:

  • dm - the DM
  • mat - the Mat to be created

Level: advanced

See also: DM, DMSHELL, DMCreateMatrix(), DMShellSetMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateRestriction — Method
DMShellSetCreateRestriction(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of restriction:

  • fine - the fine DM
  • coarse - the DM to restrict to
  • restrct - the output restriction Mat

Level: advanced

See also: DM, DMSHELL, DMShellSetCreateInjection(), DMCreateInterpolation(), DMShellGetCreateRestriction(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetCreateSubDM — Method
DMShellSetCreateSubDM(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of subdm:

  • dm - the original DM
  • numFields - the number of fields to create
  • fields - the fields to create for
  • is - output, the IS defining the sub DM
  • subdm - the sub DM

Level: advanced

See also: DM, DMSHELL, DMCreateSubDM(), DMShellGetCreateSubDM(), DMShellSetContext(), DMShellGetContext()

External Links

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

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

See also: DM, DMSHELL, DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetGlobalToLocal — Method
DMShellSetGlobalToLocal(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of begin:

  • dm - the DM
  • global - the global Vec to be communicated
  • mode - insert mode of the resulting vector
  • local - the local Vec to receive the result

Calling sequence of end:

  • dm - the DM
  • global - the global Vec to be communicated
  • mode - insert mode of the resulting vector
  • local - the local Vec to receive the result

Level: advanced

See also: DM, DMSHELL, DMShellSetLocalToGlobal(), DMGlobalToLocalBeginDefaultShell(), DMGlobalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetGlobalToLocalVecScatter — Method
DMShellSetGlobalToLocalVecScatter(petsclib::PetscLibType, dm::AbstractPetscDM, 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

See also: DM, DMSHELL, DMShellSetGlobalToLocal(), DMGlobalToLocalBeginDefaultShell(), DMGlobalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetGlobalVector — Method
DMShellSetGlobalVector(petsclib::PetscLibType, dm::AbstractPetscDM, X::AbstractPetscVec)

sets a template global vector associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - DMSHELL
  • X - template vector

Level: advanced

See also: DM, DMSHELL, DMCreateGlobalVector(), DMShellSetMatrix(), DMShellSetCreateGlobalVector()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToGlobal — Method
DMShellSetLocalToGlobal(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of begin:

  • dm - the DM
  • local - the local Vec to be communicated
  • mode - insert mode of the resulting vector
  • global - the global Vec to receive the result

Calling sequence of end:

  • dm - the DM
  • local - the local Vec to be communicated
  • mode - insert mode of the resulting vector
  • global - the global Vec to receive the result

Level: advanced

See also: DM, DMSHELL, DMShellSetGlobalToLocal(), InsertMode, VecScatter, DMLocalToGlobal(), DMGlobalToLocal()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToGlobalVecScatter — Method
DMShellSetLocalToGlobalVecScatter(petsclib::PetscLibType, dm::AbstractPetscDM, 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

See also: DM, DMSHELL, DMShellSetLocalToGlobal(), DMLocalToGlobalBeginDefaultShell(), DMLocalToGlobalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToLocal — Method
DMShellSetLocalToLocal(petsclib::PetscLibType, dm::AbstractPetscDM, 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

Calling sequence of begin:

  • dm - the DM
  • local - the local Vec to be communicated
  • mode - insert mode of the resulting vector
  • nlocal - the local Vec to receive the result

Calling sequence of end:

  • dm - the DM
  • local - the local Vec to be communicated
  • mode - insert mode of the resulting vector
  • nlocal - the local Vec to receive the result

Level: advanced

See also: DM, DMSHELL, DMShellSetGlobalToLocal(), DMLocalToLocalBeginDefaultShell(), DMLocalToLocalEndDefaultShell(), DMLocalToLocalBegin(), DMLocalToLocalEnd()

External Links

source
PETSc.LibPETSc.DMShellSetLocalToLocalVecScatter — Method
DMShellSetLocalToLocalVecScatter(petsclib::PetscLibType, dm::AbstractPetscDM, 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

See also: DM, DMSHELL, DMShellSetLocalToLocal(), DMLocalToLocalBeginDefaultShell(), DMLocalToLocalEndDefaultShell()

External Links

source
PETSc.LibPETSc.DMShellSetLocalVector — Method
DMShellSetLocalVector(petsclib::PetscLibType, dm::AbstractPetscDM, X::AbstractPetscVec)

sets a template local vector associated with the DMSHELL

Logically Collective

Input Parameters:

  • dm - DMSHELL
  • X - template vector

Level: advanced

See also: DM, DMSHELL, DMCreateLocalVector(), DMShellSetMatrix(), DMShellSetCreateLocalVector()

External Links

source
PETSc.LibPETSc.DMShellSetMatrix — Method
DMShellSetMatrix(petsclib::PetscLibType, dm::AbstractPetscDM, J::AbstractPetscMat)

sets a template matrix associated with the DMSHELL

Collective

Input Parameters:

  • dm - DMSHELL
  • J - template matrix

Level: advanced

See also: DM, DMSHELL, DMCreateMatrix(), DMShellSetCreateMatrix(), DMShellSetContext(), DMShellGetContext()

External Links

source
PETSc.LibPETSc.DMShellSetRefine — Method
DMShellSetRefine(petsclib::PetscLibType, dm::AbstractPetscDM, refine::external)

Set the routine used to refine the DMSHELL

Logically Collective

Input Parameters:

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

Calling sequence of refine:

  • coarse - the DM to refine
  • comm - the MPI_Comm to share the finer DM
  • fine - the resulting fine DM

Level: advanced

See also: DM, DMSHELL, DMShellSetCoarsen(), DMRefine(), DMShellGetRefine(), DMShellSetContext(), DMShellGetContext()

External Links

source

DMProduct Functions

PETSc.LibPETSc.DMProductGetDM — Method
subdm::PetscDM = DMProductGetDM(petsclib::PetscLibType, dm::AbstractPetscDM, slot::PetscInt)

Get sub-DM whose coordinates will be associated with a particular dimension of the DMPRODUCT

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

See also: DMPRODUCT, DMProductSetDM(), DMProductGetDimensionIndex(), DMProductSetDimensionIndex()

External Links

source
PETSc.LibPETSc.DMProductGetDimensionIndex — Method
idx::PetscInt = DMProductGetDimensionIndex(petsclib::PetscLibType, dm::AbstractPetscDM, slot::PetscInt)

Get which dimension idx of the sub-DM coordinates will be used associated with the DMPRODUCT dimension slot

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

See also: DMPRODUCT, DMProductGetDM(), DMProductSetDimensionIndex()

External Links

source
PETSc.LibPETSc.DMProductSetDM — Method
DMProductSetDM(petsclib::PetscLibType, dm::AbstractPetscDM, slot::PetscInt, subdm::AbstractPetscDM)

Set sub-DM whose coordinates will be associated with a particular dimension of the DMPRODUCT

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

See also: DMPRODUCT, DMProductGetDM(), DMProductSetDimensionIndex(), DMProductGetDimensionIndex()

External Links

source
PETSc.LibPETSc.DMProductSetDimensionIndex — Method
DMProductSetDimensionIndex(petsclib::PetscLibType, dm::AbstractPetscDM, slot::PetscInt, idx::PetscInt)

Set which dimension idx of the sub-DM coordinates will be used associated with the DMPRODUCT dimension slot

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

See also: DMPRODUCT, DMProductGetDM(), DMProductGetDimensionIndex()

External Links

source

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 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

See also: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMCreateMatrix(), DMCompositeAddDM(), DMSetType(), DMRedundantSetSize(), DMRedundantGetSize()

External Links

source
PETSc.LibPETSc.DMRedundantGetSize — Method
rank::PetscMPIInt,N::PetscInt = DMRedundantGetSize(petsclib::PetscLibType, dm::AbstractPetscDM)

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

See also: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMRedundantCreate(), DMRedundantSetSize()

External Links

source
PETSc.LibPETSc.DMRedundantSetSize — Method
DMRedundantSetSize(petsclib::PetscLibType, dm::AbstractPetscDM, 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

See also: DM, DMREDUNDANT, DMDestroy(), DMCreateGlobalVector(), DMRedundantCreate(), DMRedundantGetSize()

External Links

source

DMComposite Functions

PETSc.LibPETSc.DMCompositeAddDM — Method
DMCompositeAddDM(petsclib::PetscLibType, dmc::AbstractPetscDM, dm::AbstractPetscDM)

adds a DM vector to a DMCOMPOSITE

Collective

Input Parameters:

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

Level: advanced

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

External Links

source
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 - the DMCOMPOSITE object

Level: advanced

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

External Links

source
PETSc.LibPETSc.DMCompositeGatherArray — Method
DMCompositeGatherArray(petsclib::PetscLibType, dm::AbstractPetscDM, imode::InsertMode, gvec::AbstractPetscVec, lvecs::AbstractPetscVec)

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

See also: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeScatter(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()

External Links

source
PETSc.LibPETSc.DMCompositeGetAccessArray — Method
DMCompositeGetAccessArray(petsclib::PetscLibType, dm::AbstractPetscDM, pvec::AbstractPetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{<:AbstractPetscVec})

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

See also: DMCOMPOSITE, DM, DMCompositeGetAccess(), DMCompositeGetEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeGetEntriesArray — Method
DMCompositeGetEntriesArray(petsclib::PetscLibType, dm::AbstractPetscDM, dms::Vector{<:AbstractPetscDM})

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

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

External Links

source
PETSc.LibPETSc.DMCompositeGetGlobalISs — Method
is::Ptr{CIS} = DMCompositeGetGlobalISs(petsclib::PetscLibType, dm::AbstractPetscDM)

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

See also: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGather(), DMCompositeCreate(), DMCompositeGetAccess(), DMCompositeScatter(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()

External Links

source
PETSc.LibPETSc.DMCompositeGetISLocalToGlobalMappings — Method
ltogs::Ptr{ISLocalToGlobalMapping} = DMCompositeGetISLocalToGlobalMappings(petsclib::PetscLibType, dm::AbstractPetscDM)

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

See also: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGather(), DMCompositeCreate(), DMCompositeGetAccess(), DMCompositeScatter(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()

External Links

source
PETSc.LibPETSc.DMCompositeGetLocalAccessArray — Method
DMCompositeGetLocalAccessArray(petsclib::PetscLibType, dm::AbstractPetscDM, pvec::AbstractPetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{<:AbstractPetscVec})

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

See also: DMCOMPOSITE, DM, DMCompositeRestoreLocalAccessArray(), DMCompositeGetAccess(), DMCompositeGetEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeGetLocalISs — Method
is::Ptr{CIS} = DMCompositeGetLocalISs(petsclib::PetscLibType, dm::AbstractPetscDM)

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

See also: DMCOMPOSITE, DM, DMCompositeGetGlobalISs(), DMCompositeGetISLocalToGlobalMappings(), MatGetLocalSubMatrix(), MatCreateLocalRef(), DMCompositeGetNumberDM()

External Links

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

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

See also: DMCOMPOSITE, DM

External Links

source
PETSc.LibPETSc.DMCompositeRestoreAccessArray — Method
DMCompositeRestoreAccessArray(petsclib::PetscLibType, dm::AbstractPetscDM, pvec::AbstractPetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::Vector{<:AbstractPetscVec})

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

See also: DMCOMPOSITE, DM, DMCompositeRestoreAccess(), DMCompositeRestoreEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeRestoreLocalAccessArray — Method
DMCompositeRestoreLocalAccessArray(petsclib::PetscLibType, dm::AbstractPetscDM, pvec::AbstractPetscVec, nwanted::PetscInt, wanted::Vector{PetscInt}, vecs::AbstractPetscVec)

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

See also: DMCOMPOSITE, DM, DMCompositeGetLocalAccessArray(), DMCompositeRestoreAccessArray(), DMCompositeRestoreAccess(), DMCompositeRestoreEntries(), DMCompositeScatter(), DMCompositeGather()

External Links

source
PETSc.LibPETSc.DMCompositeScatterArray — Method
DMCompositeScatterArray(petsclib::PetscLibType, dm::AbstractPetscDM, gvec::AbstractPetscVec, lvecs::AbstractPetscVec)

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

See also: DMCOMPOSITE, DM, DMDestroy(), DMCompositeAddDM(), DMCreateGlobalVector(), DMCompositeGather(), DMCompositeCreate(), DMCompositeGetISLocalToGlobalMappings(), DMCompositeGetAccess(), DMCompositeGetLocalVectors(), DMCompositeRestoreLocalVectors(), DMCompositeGetEntries()

External Links

source
PETSc.LibPETSc.DMCompositeSetCoupling — Method
DMCompositeSetCoupling(petsclib::PetscLibType, dm::AbstractPetscDM, 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

See also: DMCOMPOSITE, DM

External Links

source