petsc4py.PETSc.DM

class petsc4py.PETSc.DM

Bases: Object

An object describing a computational grid or mesh.

Enumerations

BoundaryType

DM Boundary types.

PolytopeType

Type

DM types.

Methods Summary

adaptLabel(label)

Adapt a DM based on a DMLabel.

adaptMetric(metric[, bdLabel, rgLabel])

Return a mesh adapted to the specified metric field.

addCoarsenHook(coarsenhook, restricthook[, ...])

Add a callback to be executed when restricting to a coarser grid.

addField(field[, label])

Add a field to a DM object.

appendOptionsPrefix(prefix)

Append to the prefix used for searching for options in the database.

clearDS()

Remove all discrete systems from the DM.

clearFields()

Remove all fields from the DM.

clearLabelStratum(name, value)

Remove all points from a stratum.

clearLabelValue(name, point, value)

Remove a point from a DMLabel with given value.

clone()

Return the cloned DM .

coarsen([comm])

Return a coarsened DM object.

coarsenHierarchy(nlevels)

Coarsen this DM and return the coarsened DM hierarchy.

convert(dm_type)

Return a DM converted to another DM.

copyDS(dm)

Copy the discrete systems for this DM into another DM.

copyDisc(dm)

Copy fields and discrete systems of a DM into another DM.

copyFields(dm)

Copy the discretizations of this DM into another DM.

create([comm])

Return an empty DM.

createDS()

Create discrete systems.

createFieldDecomposition()

Return a list of IS objects.

createGlobalVec()

Return a global vector.

createInjection(dm)

Return the injection matrix into a finer DM.

createInterpolation(dm)

Return the interpolation matrix to a finer DM.

createLabel(name)

Create a label of the given name if it does not already exist.

createLocalVec()

Return a local vector.

createMassMatrix(dmf)

Return the mass matrix between this DM and the given DM.

createMat()

Return an empty matrix.

createRestriction(dm)

Return the restriction matrix between this DM and the given DM.

createSectionSF(localsec, globalsec)

Create the SF encoding the parallel DOF overlap for the DM.

createSubDM(fields)

Return IS and DM encapsulating a subproblem.

destroy()

Destroy the object.

getAppCtx()

Source code at petsc4py/PETSc/DM.pyx:352

getAuxiliaryVec([label, value, part])

Return an auxiliary vector for region.

getBasicAdjacency()

Return the flags for determining variable influence.

getBlockSize()

Return the inherent block size associated with a DM.

getBoundingBox()

Return the dimension of embedding space for coordinates values.

getCoarseDM()

Return the coarse DM.

getCoarsenLevel()

Return the number of coarsenings.

getCoordinateDM()

Return the coordinate DM.

getCoordinateDim()

Return the dimension of embedding space for coordinates values.

getCoordinateSection()

Return coordinate values layout over the mesh.

getCoordinates()

Return a global vector with the coordinates associated.

getCoordinatesLocal()

Return a local vector with the coordinates associated.

getDS()

Return default DS.

getDimension()

Return the topological dimension of the DM.

getField(index)

Return the discretization object for a given DM field.

getFieldAdjacency(field)

Return the flags for determining variable influence.

getGlobalSection()

Return the Section encoding the global data layout for the DM.

getGlobalVec()

Return a global vector.

getLGMap()

Return local mapping to global mapping.

getLabel(name)

Return the label of a given name.

getLabelIdIS(name)

Return an IS of all values that the DMLabel takes.

getLabelName(index)

Return the name of nth label.

getLabelOutput(name)

Return the output flag for a given label.

getLabelSize(name)

Return the number of values that the DMLabel takes.

getLabelValue(name, point)

Return the value in DMLabel for the given point.

getLocalBoundingBox()

Return the bounding box for the piece of the DM.

getLocalSection()

Return the Section encoding the local data layout for the DM.

getLocalVec()

Return a local vector.

getNumFields()

Return the number of fields in the DM.

getNumLabels()

Return the number of labels defined by on the DM.

getOptionsPrefix()

Return the prefix used for searching for options in the database.

getPointSF()

Return the SF encoding the parallel DOF overlap for the DM.

getRefineLevel()

Return the refinement level.

getSectionSF()

Return the Section encoding the parallel DOF overlap.

getStratumIS(name, value)

Return the points in a label stratum.

getStratumSize(name, value)

Return the number of points in a label stratum.

getType()

Return the DM type name.

globalToLocal(vg, vl[, addv])

Update local vectors from global vector.

hasLabel(name)

Determine whether the DM has a label.

load(viewer)

Return a DM stored in binary.

localToGlobal(vl, vg[, addv])

Update global vectors from local vector.

localToLocal(vl, vlg[, addv])

Map the values from a local vector to another local vector.

localizeCoordinates()

Create local coordinates for cells having periodic faces.

projectCoordinates(disc)

Project coordinates to a different space.

refine([comm])

Return a refined DM object.

refineHierarchy(nlevels)

Refine this DM and return the refined DM hierarchy.

removeLabel(name)

Remove and destroy the label by name.

restoreGlobalVec(vg)

Restore a global vector.

restoreLocalVec(vl)

Restore a local vector.

setAppCtx(appctx)

Source code at petsc4py/PETSc/DM.pyx:349

setAuxiliaryVec(aux, label[, value, part])

Set an auxiliary vector for a specific region.

setBasicAdjacency(useCone, useClosure)

Set the flags for determining variable influence.

setCoarseDM(dm)

Set the coarse DM.

setCoordinateDim(dim)

Set the dimension of embedding space for coordinates values.

setCoordinates(c)

Set a global vector that holds the coordinates.

setCoordinatesLocal(c)

Set a local vector with the ghost point holding the coordinates.

setDimension(dim)

Set the topological dimension of the DM.

setField(index, field[, label])

Set the discretization object for a given DM field.

setFieldAdjacency(field, useCone, useClosure)

Set the flags for determining variable influence.

setFromOptions()

Configure the object from the options database.

setGlobalSection(sec)

Set the Section encoding the global data layout for the DM.

setKSPComputeOperators(operators[, args, kargs])

Matrix associated with the linear system.

setLabelOutput(name, output)

Set if a given label should be saved to a view.

setLabelValue(name, point, value)

Set a point to a DMLabel with a given value.

setLocalSection(sec)

Set the Section encoding the local data layout for the DM.

setMatType(mat_type)

Set matrix type to be used by DM.createMat.

setNumFields(numFields)

Set the number of fields in the DM.

setOptionsPrefix(prefix)

Set the prefix used for searching for options in the database.

setPointSF(sf)

Set the SF encoding the parallel DOF overlap for the DM.

setRefineLevel(level)

Set the number of refinements.

setSNESFunction(function[, args, kargs])

Set SNES residual evaluation function.

setSNESJacobian(jacobian[, args, kargs])

Set the SNES Jacobian evaluation function.

setSectionSF(sf)

Set the Section encoding the parallel DOF overlap for the DM.

setType(dm_type)

Build a DM.

setUp()

Return the data structure.

setVecType(vec_type)

Set the type of vector.

view([viewer])

View the DM.

viewFromOptions(name[, obj])

View a DM based in the options.

Attributes Summary

appctx

ds

Methods Documentation

adaptLabel(label)

Adapt a DM based on a DMLabel.

Collective.

Parameters:

label (str) – The name of the DMLabel.

Return type:

DM

See also

petsc.DMAdaptLabel

Source code at petsc4py/PETSc/DM.pyx:1431

adaptMetric(metric, bdLabel=None, rgLabel=None)

Return a mesh adapted to the specified metric field.

Parameters:
  • metric (Vec) – The metric to which the mesh is adapted, defined vertex-wise.

  • bdLabel (str | None) – Label for boundary tags.

  • rgLabel (str | None) – Label for cell tag.

Return type:

DM

See also

petsc.DMAdaptMetric

Source code at petsc4py/PETSc/DM.pyx:1454

addCoarsenHook(coarsenhook, restricthook, args=None, kargs=None)

Add a callback to be executed when restricting to a coarser grid.

Logically collective.

Parameters:
Return type:

None

See also

petsc.DMCoarsenHookAdd

Source code at petsc4py/PETSc/DM.pyx:2103

addField(field, label=None)

Add a field to a DM object.

Logically collective.

Parameters:
  • field (Object) – The discretization object.

  • label (str | None) – The name of the label indicating the support of the field, or None for the entire mesh.

Return type:

None

See also

petsc.DMAddField

Source code at petsc4py/PETSc/DM.pyx:619

appendOptionsPrefix(prefix)

Append to the prefix used for searching for options in the database.

Logically collective.

See also

Working with PETSc options (TODO), setOptionsPrefix, petsc.DMAppendOptionsPrefix

Source code at petsc4py/PETSc/DM.pyx:285

Parameters:

prefix (str)

Return type:

None

clearDS()

Remove all discrete systems from the DM.

Logically collective.

See also

petsc.DMClearDS

Source code at petsc4py/PETSc/DM.pyx:683

Return type:

None

clearFields()

Remove all fields from the DM.

Logically collective.

See also

petsc.DMClearFields

Source code at petsc4py/PETSc/DM.pyx:642

Return type:

None

clearLabelStratum(name, value)

Remove all points from a stratum.

Not collective.

Parameters:
  • name (str) – The label name.

  • value (int) – The stratum value.

Return type:

None

See also

petsc.DMClearLabelStratum

Source code at petsc4py/PETSc/DM.pyx:1891

clearLabelValue(name, point, value)

Remove a point from a DMLabel with given value.

Not collective.

Parameters:
  • name (str) – The label name.

  • point (int) – The mesh point.

  • value (int) – The label value for the point.

Return type:

None

See also

petsc.DMClearLabelValue

Source code at petsc4py/PETSc/DM.pyx:1777

clone()

Return the cloned DM .

Collective.

See also

petsc.DMClone

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

Return type:

DM

coarsen(comm=None)

Return a coarsened DM object.

Collective.

Parameters:

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

Return type:

DM

See also

petsc.DMCoarsen

Source code at petsc4py/PETSc/DM.pyx:1305

coarsenHierarchy(nlevels)

Coarsen this DM and return the coarsened DM hierarchy.

Collective.

Parameters:

nlevels (int) – The number of levels of coarsening.

Return type:

list

See also

petsc.DMCoarsenHierarchy

Source code at petsc4py/PETSc/DM.pyx:1356

convert(dm_type)

Return a DM converted to another DM.

Collective.

Parameters:

dm_type (Type | str) – The new DM.Type, use “same” for the same type.

Return type:

DM

See also

DM.Type, petsc.DMConvert

Source code at petsc4py/PETSc/DM.pyx:1258

copyDS(dm)

Copy the discrete systems for this DM into another DM.

Collective.

Parameters:

dm (DM) – The DM that the discrete fields are copied into.

Return type:

None

See also

petsc.DMCopyDS

Source code at petsc4py/PETSc/DM.pyx:710

copyDisc(dm)

Copy fields and discrete systems of a DM into another DM.

Collective.

Parameters:

dm (DM) – The DM that the fields and discrete systems are copied into.

Return type:

None

See also

petsc.DMCopyDisc

Source code at petsc4py/PETSc/DM.pyx:727

copyFields(dm)

Copy the discretizations of this DM into another DM.

Collective.

Parameters:

dm (DM) – The DM that the fields are copied into.

Return type:

None

See also

petsc.DMCopyFields

Source code at petsc4py/PETSc/DM.pyx:654

create(comm=None)

Return an empty DM.

Collective.

Parameters:

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

Return type:

Self

See also

petsc.DMCreate

Source code at petsc4py/PETSc/DM.pyx:121

createDS()

Create discrete systems.

Collective.

See also

petsc.DMCreateDS

Source code at petsc4py/PETSc/DM.pyx:671

Return type:

None

createFieldDecomposition()

Return a list of IS objects.

Not collective.

Notes

The user is responsible for freeing all requested arrays.

See also

petsc.DMCreateFieldDecomposition

Source code at petsc4py/PETSc/DM.pyx:1990

Return type:

tuple[list, list, list]

createGlobalVec()

Return a global vector.

Collective.

See also

petsc.DMCreateGlobalVector

Source code at petsc4py/PETSc/DM.pyx:774

Return type:

Vec

createInjection(dm)

Return the injection matrix into a finer DM.

Collective.

Parameters:

dm (DM) – The second, finer DM object.

Return type:

Mat

See also

petsc.DMCreateInjection

Source code at petsc4py/PETSc/DM.pyx:1220

createInterpolation(dm)

Return the interpolation matrix to a finer DM.

Collective.

Parameters:

dm (DM) – The second, finer DM.

Return type:

tuple[Mat, Vec]

See also

petsc.DMCreateInterpolation

Source code at petsc4py/PETSc/DM.pyx:1199

createLabel(name)

Create a label of the given name if it does not already exist.

Not collective.

Parameters:

name (str) – The label name.

Return type:

None

See also

petsc.DMCreateLabel

Source code at petsc4py/PETSc/DM.pyx:1689

createLocalVec()

Return a local vector.

Not collective.

See also

petsc.DMCreateLocalVector

Source code at petsc4py/PETSc/DM.pyx:788

Return type:

Vec

createMassMatrix(dmf)

Return the mass matrix between this DM and the given DM.

Collective.

Parameters:

dmf (DM) – The second DM.

Return type:

Mat

See also

petsc.DMCreateMassMatrix

Source code at petsc4py/PETSc/DM.pyx:1180

createMat()

Return an empty matrix.

Collective.

See also

petsc.DMCreateMatrix

Source code at petsc4py/PETSc/DM.pyx:1166

Return type:

Mat

createRestriction(dm)

Return the restriction matrix between this DM and the given DM.

Collective.

Parameters:

dm (DM) – The second, finer DM object.

Return type:

Mat

See also

petsc.DMCreateRestriction

Source code at petsc4py/PETSc/DM.pyx:1239

createSectionSF(localsec, globalsec)

Create the SF encoding the parallel DOF overlap for the DM.

Parameters:
  • localsec (Section) – Describe the local data layout.

  • globalsec (Section) – Describe the global data layout.

Return type:

None

Notes

Encoding based on the Section describing the data layout.

See also

DM.getSectionSF, petsc.DMCreateSectionSF

Source code at petsc4py/PETSc/DM.pyx:1563

createSubDM(fields)

Return IS and DM encapsulating a subproblem.

Not collective.

Returns:

  • iset (IS) – The global indices for all the degrees of freedom.

  • subdm (DM) – The DM for the subproblem.

Parameters:

fields (Sequence[int])

Return type:

tuple[IS, DM]

See also

petsc.DMCreateSubDM

Source code at petsc4py/PETSc/DM.pyx:454

destroy()

Destroy the object.

Collective.

See also

petsc.DMDestroy

Source code at petsc4py/PETSc/DM.pyx:108

Return type:

Self

getAppCtx()

Source code at petsc4py/PETSc/DM.pyx:352

getAuxiliaryVec(label=None, value=0, part=0)

Return an auxiliary vector for region.

Not collective.

Parameters:
  • label (str | None) – The name of the DMLabel.

  • value (int | None) – Indicate the region.

  • part (int | None) – The equation part, or 0 is unused.

Return type:

Vec

See also

DM.getLabel, petsc.DMGetAuxiliaryVec

Source code at petsc4py/PETSc/DM.pyx:511

getBasicAdjacency()

Return the flags for determining variable influence.

Not collective.

Returns:

  • useCone (bool) – Whether adjacency uses cone information.

  • useClosure (bool) – Whether adjacency is computed using full closure information.

Return type:

tuple[bool, bool]

See also

petsc.DMGetBasicAdjacency

Source code at petsc4py/PETSc/DM.pyx:378

getBlockSize()

Return the inherent block size associated with a DM.

Not collective.

See also

petsc.DMGetBlockSize

Source code at petsc4py/PETSc/DM.pyx:746

Return type:

int

getBoundingBox()

Return the dimension of embedding space for coordinates values.

Not collective.

See also

petsc.DMGetBoundingBox

Source code at petsc4py/PETSc/DM.pyx:1092

Return type:

tuple[tuple[float, float], …]

getCoarseDM()

Return the coarse DM.

Collective.

See also

petsc.DMGetCoarseDM

Source code at petsc4py/PETSc/DM.pyx:954

Return type:

DM

getCoarsenLevel()

Return the number of coarsenings.

Not collective.

See also

petsc.DMGetCoarsenLevel

Source code at petsc4py/PETSc/DM.pyx:1415

Return type:

int

getCoordinateDM()

Return the coordinate DM.

Collective.

See also

petsc.DMGetCoordinateDM

Source code at petsc4py/PETSc/DM.pyx:982

Return type:

DM

getCoordinateDim()

Return the dimension of embedding space for coordinates values.

Not collective.

See also

petsc.DMGetCoordinateDim

Source code at petsc4py/PETSc/DM.pyx:225

Return type:

int

getCoordinateSection()

Return coordinate values layout over the mesh.

Collective.

See also

petsc.DMGetCoordinateSection

Source code at petsc4py/PETSc/DM.pyx:997

Return type:

Section

getCoordinates()

Return a global vector with the coordinates associated.

Collective.

See also

petsc.DMGetCoordinates

Source code at petsc4py/PETSc/DM.pyx:1029

Return type:

Vec

getCoordinatesLocal()

Return a local vector with the coordinates associated.

Collective the first time it is called.

See also

petsc.DMGetCoordinatesLocal

Source code at petsc4py/PETSc/DM.pyx:1061

Return type:

Vec

getDS()

Return default DS.

Not collective.

See also

petsc.DMGetDS

Source code at petsc4py/PETSc/DM.pyx:695

Return type:

DS

getDimension()

Return the topological dimension of the DM.

Not collective.

See also

petsc.DMGetDimension

Source code at petsc4py/PETSc/DM.pyx:193

Return type:

int

getField(index)

Return the discretization object for a given DM field.

Not collective.

Parameters:

index (int) – The field number.

Return type:

tuple[Object, None]

See also

petsc.DMGetField

Source code at petsc4py/PETSc/DM.pyx:594

getFieldAdjacency(field)

Return the flags for determining variable influence.

Not collective.

Parameters:

field (int) – The field number.

Returns:

  • useCone (bool) – Whether adjacency uses cone information.

  • useClosure (bool) – Whether adjacency is computed using full closure information.

Return type:

tuple[bool, bool]

See also

petsc.DMGetAdjacency

Source code at petsc4py/PETSc/DM.pyx:424

getGlobalSection()

Return the Section encoding the global data layout for the DM.

See also

petsc.DMGetGlobalSection

Source code at petsc4py/PETSc/DM.pyx:1541

Return type:

Section

getGlobalVec()

Return a global vector.

Collective.

See also

petsc.DMGetGlobalVector

Source code at petsc4py/PETSc/DM.pyx:802

Return type:

Vec

getLGMap()

Return local mapping to global mapping.

Collective.

See also

petsc.DMGetLocalToGlobalMapping

Source code at petsc4py/PETSc/DM.pyx:937

Return type:

LGMap

getLabel(name)

Return the label of a given name.

Not collective.

See also

petsc.DMGetLabel

Source code at petsc4py/PETSc/DM.pyx:1489

Parameters:

name (str)

Return type:

DMLabel

getLabelIdIS(name)

Return an IS of all values that the DMLabel takes.

Not collective.

Parameters:

name (str) – The label name.

Return type:

IS

See also

petsc.DMLabelGetValueIS, petsc.DMGetLabelIdIS

Source code at petsc4py/PETSc/DM.pyx:1822

getLabelName(index)

Return the name of nth label.

Not collective.

Parameters:

index (int) – The label number.

Return type:

str

See also

petsc.DMGetLabelName

Source code at petsc4py/PETSc/DM.pyx:1648

getLabelOutput(name)

Return the output flag for a given label.

Not collective.

Parameters:

name (str) – The label name.

Return type:

bool

See also

petsc.DMGetLabelOutput

Source code at petsc4py/PETSc/DM.pyx:1935

getLabelSize(name)

Return the number of values that the DMLabel takes.

Not collective.

Parameters:

name (str) – The label name.

Return type:

int

See also

petsc.DMLabelGetNumValues, petsc.DMGetLabelSize

Source code at petsc4py/PETSc/DM.pyx:1801

getLabelValue(name, point)

Return the value in DMLabel for the given point.

Not collective.

Parameters:
  • name (str) – The label name.

  • point (int) – The mesh point

Return type:

int

See also

petsc.DMGetLabelValue

Source code at petsc4py/PETSc/DM.pyx:1730

getLocalBoundingBox()

Return the bounding box for the piece of the DM.

Not collective.

See also

petsc.DMGetLocalBoundingBox

Source code at petsc4py/PETSc/DM.pyx:1109

Return type:

tuple[tuple[float, float], …]

getLocalSection()

Return the Section encoding the local data layout for the DM.

See also

petsc.DMGetGlobalSection

Source code at petsc4py/PETSc/DM.pyx:1518

Return type:

Section

getLocalVec()

Return a local vector.

Not collective.

See also

petsc.DMGetLocalVector

Source code at petsc4py/PETSc/DM.pyx:835

Return type:

Vec

getNumFields()

Return the number of fields in the DM.

Not collective.

See also

petsc.DMGetNumFields

Source code at petsc4py/PETSc/DM.pyx:554

Return type:

int

getNumLabels()

Return the number of labels defined by on the DM.

Not collective.

See also

petsc.DMGetNumLabels

Source code at petsc4py/PETSc/DM.pyx:1634

Return type:

int

getOptionsPrefix()

Return the prefix used for searching for options in the database.

Not collective.

See also

Working with PETSc options (TODO), setOptionsPrefix, petsc.DMGetOptionsPrefix

Source code at petsc4py/PETSc/DM.pyx:271

Return type:

str

getPointSF()

Return the SF encoding the parallel DOF overlap for the DM.

See also

petsc.DMGetPointSF

Source code at petsc4py/PETSc/DM.pyx:1611

Return type:

SF

getRefineLevel()

Return the refinement level.

Not collective.

See also

petsc.DMGetRefineLevel

Source code at petsc4py/PETSc/DM.pyx:1383

Return type:

int

getSectionSF()

Return the Section encoding the parallel DOF overlap.

See also

petsc.DMGetSectionSF

Source code at petsc4py/PETSc/DM.pyx:1584

Return type:

SF

getStratumIS(name, value)

Return the points in a label stratum.

Not collective.

Parameters:
  • name (str) – The label name.

  • value (int) – The stratum value.

Return type:

IS

See also

petsc.DMGetStratumIS

Source code at petsc4py/PETSc/DM.pyx:1867

getStratumSize(name, value)

Return the number of points in a label stratum.

Not collective.

Parameters:
  • name (str) – The label name.

  • value (int) – The stratum value.

Return type:

int

See also

petsc.DMGetStratumSize

Source code at petsc4py/PETSc/DM.pyx:1843

getType()

Return the DM type name.

Not collective.

See also

petsc.DMGetType

Source code at petsc4py/PETSc/DM.pyx:179

Return type:

str

globalToLocal(vg, vl, addv=None)

Update local vectors from global vector.

Neighborwise collective.

Parameters:
Return type:

None

See also

petsc.DMGlobalToLocalBegin, petsc.DMGlobalToLocalEnd

Source code at petsc4py/PETSc/DM.pyx:868

hasLabel(name)

Determine whether the DM has a label.

Not collective.

Parameters:

name (str) – The label name.

Return type:

bool

See also

petsc.DMHasLabel

Source code at petsc4py/PETSc/DM.pyx:1668

load(viewer)

Return a DM stored in binary.

Collective.

Parameters:

viewer (Viewer) – Viewer used to store the DM, like Viewer.Type.BINARY or Viewer.Type.HDF5.

Return type:

Self

Notes

When using Viewer.Type.HDF5 format, one can save multiple DMPlex meshes in a single HDF5 files. This in turn requires one to name the DMPlex object with Object.setName before saving it with DM.view and before loading it with DM.load for identification of the mesh object.

See also

DM.view, DM.load, Object.setName, petsc.DMLoad

Source code at petsc4py/PETSc/DM.pyx:82

localToGlobal(vl, vg, addv=None)

Update global vectors from local vector.

Neighborwise collective.

Parameters:
Return type:

None

See also

petsc.DMLocalToGlobalBegin, petsc.DMLocalToGlobalEnd

Source code at petsc4py/PETSc/DM.pyx:891

localToLocal(vl, vlg, addv=None)

Map the values from a local vector to another local vector.

Neighborwise collective.

Parameters:
Return type:

None

See also

petsc.DMLocalToLocalBegin, petsc.DMLocalToLocalEnd

Source code at petsc4py/PETSc/DM.pyx:914

localizeCoordinates()

Create local coordinates for cells having periodic faces.

Collective.

Notes

Used if the mesh is periodic.

See also

petsc.DMLocalizeCoordinates

Source code at petsc4py/PETSc/DM.pyx:1126

Return type:

None

projectCoordinates(disc)

Project coordinates to a different space.

Parameters:

disc (FE) – The new coordinates discretization.

Return type:

Self

See also

petsc.DMProjectCoordinates

Source code at petsc4py/PETSc/DM.pyx:1076

refine(comm=None)

Return a refined DM object.

Collective.

Parameters:

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

Return type:

DM

See also

petsc.DMRefine

Source code at petsc4py/PETSc/DM.pyx:1281

refineHierarchy(nlevels)

Refine this DM and return the refined DM hierarchy.

Collective.

Parameters:

nlevels (int) – The number of levels of refinement.

Return type:

list

See also

petsc.DMRefineHierarchy

Source code at petsc4py/PETSc/DM.pyx:1329

removeLabel(name)

Remove and destroy the label by name.

Not collective.

Parameters:

name (str) – The label name.

Return type:

None

See also

petsc.DMRemoveLabel

Source code at petsc4py/PETSc/DM.pyx:1708

restoreGlobalVec(vg)

Restore a global vector.

Not collective.

Parameters:

vg (Vec) – The global vector.

Return type:

None

See also

petsc.DMRestoreGlobalVector

Source code at petsc4py/PETSc/DM.pyx:817

restoreLocalVec(vl)

Restore a local vector.

Not collective.

Parameters:

vl (Vec) – The local vector.

Return type:

None

See also

petsc.DMRestoreLocalVector

Source code at petsc4py/PETSc/DM.pyx:850

setAppCtx(appctx)

Source code at petsc4py/PETSc/DM.pyx:349

setAuxiliaryVec(aux, label, value=0, part=0)

Set an auxiliary vector for a specific region.

Not collective.

Parameters:
  • aux (Vec) – The auxiliary vector.

  • label (DMLabel | None) – The name of the DMLabel.

  • value – Indicate the region.

  • part – The equation part, or 0 is unused.

Return type:

None

See also

petsc.DMGetLabel, petsc.DMSetAuxiliaryVec

Source code at petsc4py/PETSc/DM.pyx:481

setBasicAdjacency(useCone, useClosure)

Set the flags for determining variable influence.

Not collective.

Parameters:
  • useCone (bool) – Whether adjacency uses cone information.

  • useClosure (bool) – Whether adjacency is computed using full closure information.

Return type:

None

See also

petsc.DMSetBasicAdjacency

Source code at petsc4py/PETSc/DM.pyx:357

setCoarseDM(dm)

Set the coarse DM.

Collective.

See also

petsc.DMSetCoarseDM

Source code at petsc4py/PETSc/DM.pyx:969

Parameters:

dm (DM)

Return type:

None

setCoordinateDim(dim)

Set the dimension of embedding space for coordinates values.

Not collective.

Parameters:

dim (int) – The embedding dimension.

Return type:

None

See also

petsc.DMSetCoordinateDim

Source code at petsc4py/PETSc/DM.pyx:239

setCoordinates(c)

Set a global vector that holds the coordinates.

Collective.

Parameters:

c (Vec) – Coordinate Vector.

Return type:

None

See also

petsc.DMSetCoordinates

Source code at petsc4py/PETSc/DM.pyx:1012

setCoordinatesLocal(c)

Set a local vector with the ghost point holding the coordinates.

Not collective.

Parameters:

c (Vec) – Coordinate Vector.

Return type:

None

See also

petsc.DMSetCoordinatesLocal

Source code at petsc4py/PETSc/DM.pyx:1044

setDimension(dim)

Set the topological dimension of the DM.

Collective.

Parameters:

dim (int) – Topological dimension.

Return type:

None

See also

petsc.DMSetDimension

Source code at petsc4py/PETSc/DM.pyx:207

setField(index, field, label=None)

Set the discretization object for a given DM field.

Logically collective.

Parameters:
  • index (int) – The field number.

  • field (Object) – The discretization object.

  • label (str | None) – The name of the label indicating the support of the field, or None for the entire mesh.

Return type:

None

See also

petsc.DMSetField

Source code at petsc4py/PETSc/DM.pyx:568

setFieldAdjacency(field, useCone, useClosure)

Set the flags for determining variable influence.

Not collective.

Parameters:
  • field (int) – The field number.

  • useCone (bool) – Whether adjacency uses cone information.

  • useClosure (bool) – Whether adjacency is computed using full closure information.

Return type:

None

See also

petsc.DMSetAdjacency

Source code at petsc4py/PETSc/DM.pyx:400

setFromOptions()

Configure the object from the options database.

Collective.

See also

Working with PETSc options (TODO), petsc.DMSetFromOptions

Source code at petsc4py/PETSc/DM.pyx:299

Return type:

None

setGlobalSection(sec)

Set the Section encoding the global data layout for the DM.

See also

petsc.DMSetGlobalSection

Source code at petsc4py/PETSc/DM.pyx:1531

Parameters:

sec (Section)

Return type:

None

setKSPComputeOperators(operators, args=None, kargs=None)

Matrix associated with the linear system.

Collective.

Parameters:
  • operator – Callback function to compute the operators.

  • args (tuple[Any, ...] | None) – Positional arguments for the callback.

  • kargs (dict[str, Any] | None) – Keyword arguments for the callback.

Return type:

None

See also

petsc.DMKSPSetComputeOperators

Source code at petsc4py/PETSc/DM.pyx:1961

setLabelOutput(name, output)

Set if a given label should be saved to a view.

Not collective.

Parameters:
  • name (str) – The label name.

  • output (bool) – If True, the label is saved to the viewer.

Return type:

None

See also

petsc.DMSetLabelOutput

Source code at petsc4py/PETSc/DM.pyx:1913

setLabelValue(name, point, value)

Set a point to a DMLabel with a given value.

Not collective.

Parameters:
  • name (str) – The label name.

  • point (int) – The mesh point.

  • value (int) – The label value for the point.

Return type:

None

See also

petsc.DMSetLabelValue

Source code at petsc4py/PETSc/DM.pyx:1753

setLocalSection(sec)

Set the Section encoding the local data layout for the DM.

See also

petsc.DMSetLocalSection

Source code at petsc4py/PETSc/DM.pyx:1508

Parameters:

sec (Section)

Return type:

None

setMatType(mat_type)

Set matrix type to be used by DM.createMat.

Logically collective.

Parameters:

mat_type (Type | str) – The matrix type.

Return type:

None

Notes

The option -dm_mat_type is used to set the matrix type.

See also

Working with PETSc options (TODO), petsc.DMSetMatType

Source code at petsc4py/PETSc/DM.pyx:1143

setNumFields(numFields)

Set the number of fields in the DM.

Logically collective.

See also

petsc.DMSetNumFields

Source code at petsc4py/PETSc/DM.pyx:541

Parameters:

numFields (int)

Return type:

None

setOptionsPrefix(prefix)

Set the prefix used for searching for options in the database.

Logically collective.

See also

Working with PETSc options (TODO), getOptionsPrefix, petsc.DMSetOptionsPrefix

Source code at petsc4py/PETSc/DM.pyx:257

Parameters:

prefix (str)

Return type:

None

setPointSF(sf)

Set the SF encoding the parallel DOF overlap for the DM.

See also

petsc.DMSetPointSF

Source code at petsc4py/PETSc/DM.pyx:1624

Parameters:

sf (SF)

Return type:

None

setRefineLevel(level)

Set the number of refinements.

Not collective.

Parameters:
  • nlevels – The number of refinement.

  • level (int)

Return type:

None

See also

petsc.DMSetRefineLevel

Source code at petsc4py/PETSc/DM.pyx:1397

setSNESFunction(function, args=None, kargs=None)

Set SNES residual evaluation function.

Not collective.

Parameters:
  • function (SNESFunction) – The callback.

  • args (tuple[Any, ...] | None) – Positional arguments for the callback.

  • kargs (dict[str, Any] | None) – Keyword arguments for the callback.

Return type:

None

See also

SNES.setFunction, petsc.DMSNESSetFunction

Source code at petsc4py/PETSc/DM.pyx:2038

setSNESJacobian(jacobian, args=None, kargs=None)

Set the SNES Jacobian evaluation function.

Not collective.

Parameters:
  • jacobian (SNESJacobianFunction) – The Jacobian callback.

  • args (tuple[Any, ...] | None) – Positional arguments for the callback.

  • kargs (dict[str, Any] | None) – Keyword arguments for the callback.

Return type:

None

See also

SNES.setJacobian, petsc.DMSNESSetJacobian

Source code at petsc4py/PETSc/DM.pyx:2071

setSectionSF(sf)

Set the Section encoding the parallel DOF overlap for the DM.

See also

petsc.DMSetSectionSF

Source code at petsc4py/PETSc/DM.pyx:1597

Parameters:

sf (SF)

Return type:

None

setType(dm_type)

Build a DM.

Collective.

Parameters:

dm_type (Type | str) – The type of DM.

Return type:

None

Notes

DM types are available in DM.Type class.

See also

DM.Type, petsc.DMSetType

Source code at petsc4py/PETSc/DM.pyx:156

setUp()

Return the data structure.

Collective.

See also

petsc.DMSetUp

Source code at petsc4py/PETSc/DM.pyx:334

Return type:

Self

setVecType(vec_type)

Set the type of vector.

Logically collective.

See also

Vec.Type, petsc.DMSetVecType

Source code at petsc4py/PETSc/DM.pyx:760

Parameters:

vec_type (Type | str)

Return type:

None

view(viewer=None)

View the DM.

Collective.

Parameters:

viewer (Viewer | None) – The DM viewer.

Return type:

None

See also

petsc.DMView

Source code at petsc4py/PETSc/DM.pyx:63

viewFromOptions(name, obj=None)

View a DM based in the options.

Collective.

Parameters:
  • name (str) – Name used to activate the viewing.

  • obj (Object | None) – Object provides the prefix for the options database.

Return type:

None

See also

petsc.DMViewFromOptions

Source code at petsc4py/PETSc/DM.pyx:311

Attributes Documentation

appctx
ds