petsc4py.PETSc.DMComposite#

class petsc4py.PETSc.DMComposite#

Bases: DM

A DM object that is used to manage data for a collection of DMs.

Methods Summary

addDM(dm, *args)

Add a DM vector to the composite.

create([comm])

Create a composite object.

gather(gvec, imode, lvecs)

Gather split local vectors into a coupled global vector.

getAccess(gvec[, locs])

Get access to the individual vectors from the global vector.

getEntries()

Return sub-DMs contained in the composite.

getGlobalISs()

Return the index sets for each composed object in the composite.

getLGMaps()

Return a local-to-global mapping for each DM in the composite.

getLocalISs()

Return index sets for each component of a composite local vector.

getNumber()

Get number of sub-DMs contained in the composite.

scatter(gvec, lvecs)

Scatter coupled global vector into split local vectors.

Methods Documentation

addDM(dm, *args)#

Add a DM vector to the composite.

Collective.

Parameters:
  • dm (DM) – The DM object.

  • *args (DM) – Additional DM objects.

Return type:

None

See also

DMCompositeAddDM

Source code at petsc4py/PETSc/DMComposite.pyx:27

create(comm=None)#

Create a composite object.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/DMComposite.pyx:6

gather(gvec, imode, lvecs)#

Gather split local vectors into a coupled global vector.

Collective.

Parameters:
  • gvec (Vec) – The global vector.

  • imode (InsertModeSpec) – The insertion mode.

  • lvecs (Sequence[Vec]) – The individual sequential vectors.

Return type:

None

Source code at petsc4py/PETSc/DMComposite.pyx:114

getAccess(gvec, locs=None)#

Get access to the individual vectors from the global vector.

Not collective.

Use via The with statement context manager (PEP 343).

Parameters:
  • gvec (Vec) – The global vector.

  • locs (Sequence[int] | None) – Indices of vectors wanted, or None to get all vectors.

Return type:

Any

Source code at petsc4py/PETSc/DMComposite.pyx:218

getEntries()#

Return sub-DMs contained in the composite.

Not collective.

Source code at petsc4py/PETSc/DMComposite.pyx:65

Return type:

list[DM]

getGlobalISs()#

Return the index sets for each composed object in the composite.

Collective.

These could be used to extract a subset of vector entries for a “multi-physics” preconditioner.

Use getLocalISs for index sets in the packed local numbering, and getLGMaps for to map local sub-DM (including ghost) indices to packed global indices.

Source code at petsc4py/PETSc/DMComposite.pyx:142

Return type:

list[IS]

getLGMaps()#

Return a local-to-global mapping for each DM in the composite.

Collective.

Note that this includes all the ghost points that individual ghosted DMDA may have.

Source code at petsc4py/PETSc/DMComposite.pyx:195

Return type:

list[LGMap]

getLocalISs()#

Return index sets for each component of a composite local vector.

Not collective.

To get the composite global indices at all local points (including ghosts), use getLGMaps.

To get index sets for pieces of the composite global vector, use getGlobalISs.

Source code at petsc4py/PETSc/DMComposite.pyx:169

Return type:

list[IS]

getNumber()#

Get number of sub-DMs contained in the composite.

Not collective.

Source code at petsc4py/PETSc/DMComposite.pyx:50

Return type:

int

scatter(gvec, lvecs)#

Scatter coupled global vector into split local vectors.

Collective.

Parameters:
  • gvec (Vec) – The global vector.

  • lvecs (Sequence[Vec]) – Array of local vectors.

Return type:

None

Source code at petsc4py/PETSc/DMComposite.pyx:89