petsc4py.PETSc.DM¶
- class petsc4py.PETSc.DM¶
Bases:
ObjectAn object describing a computational grid or mesh.
Enumerations
DMBoundary types.DMtypes.Methods Summary
adaptLabel(label)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
DMobject.appendOptionsPrefix(prefix)Append to the prefix used for searching for options in the database.
clearDS()Remove all discrete systems from the
DM.Remove all fields from the
DM.clearLabelStratum(name, value)Remove all points from a stratum.
clearLabelValue(name, point, value)Remove a point from a
DMLabelwith given value.clone()Return the cloned
DM.coarsen([comm])Return a coarsened
DMobject.coarsenHierarchy(nlevels)convert(dm_type)copyDS(dm)copyDisc(dm)copyFields(dm)create([comm])Return an empty
DM.createDS()Create discrete systems.
Return a list of
ISobjects.Return a global vector.
createInjection(dm)Return the injection matrix into a finer
DM.Return the interpolation matrix to a finer
DM.createLabel(name)Create a label of the given name if it does not already exist.
Return a local vector.
createMassMatrix(dmf)Return an empty matrix.
Return the restriction matrix between this
DMand the givenDM.createSectionSF(localsec, globalsec)createSubDM(fields)destroy()Destroy the object.
getAuxiliaryVec([label, value, part])Return an auxiliary vector for region.
Return the flags for determining variable influence.
Return the inherent block size associated with a
DM.Return the dimension of embedding space for coordinates values.
Return the coarse
DM.Return the number of coarsenings.
Return the coordinate
DM.Return the dimension of embedding space for coordinates values.
Return coordinate values layout over the mesh.
Return a global vector with the coordinates associated.
Return a local vector with the coordinates associated.
getDS()Return default
DS.Return the topological dimension of the
DM.getField(index)Return the discretization object for a given
DMfield.getFieldAdjacency(field)Return the flags for determining variable influence.
Return the
Sectionencoding the global data layout for theDM.Return a global vector.
getLGMap()Return local mapping to global mapping.
getLabel(name)Return the label of a given name.
getLabelIdIS(name)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
DMLabeltakes.getLabelValue(name, point)Return the value in
DMLabelfor the given point.Return the bounding box for the piece of the
DM.Return the
Sectionencoding the local data layout for theDM.Return a local vector.
Return the number of fields in the
DM.Return the number of labels defined by on the
DM.Return the prefix used for searching for options in the database.
Return the refinement level.
Return the
Sectionencoding 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
DMtype name.globalToLocal(vg, vl[, addv])Update local vectors from global vector.
hasLabel(name)Determine whether the
DMhas a label.load(viewer)Return a
DMstored 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.
Create local coordinates for cells having periodic faces.
projectCoordinates(disc)Project coordinates to a different space.
refine([comm])Return a refined
DMobject.refineHierarchy(nlevels)removeLabel(name)Remove and destroy the label by name.
restoreGlobalVec(vg)Restore a global vector.
restoreLocalVec(vl)Restore a local vector.
setAppCtx(appctx)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.
Set a global vector that holds the coordinates.
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
DMfield.setFieldAdjacency(field, useCone, useClosure)Set the flags for determining variable influence.
Configure the object from the options database.
setGlobalSection(sec)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
DMLabelwith a given value.setLocalSection(sec)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)setRefineLevel(level)Set the number of refinements.
setSNESFunction(function[, args, kargs])Set
SNESresidual evaluation function.setSNESJacobian(jacobian[, args, kargs])Set the
SNESJacobian evaluation function.setSectionSF(sf)Set the
Sectionencoding the parallel DOF overlap for theDM.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
DMbased in the options.Attributes Summary
Methods Documentation
- adaptMetric(metric, bdLabel=None, rgLabel=None)¶
Return a mesh adapted to the specified metric field.
- Parameters:
- Return type:
See also
petsc.DMAdaptMetric
- addCoarsenHook(coarsenhook, restricthook, args=None, kargs=None)¶
Add a callback to be executed when restricting to a coarser grid.
Logically collective.
- Parameters:
coarsenhook (DMCoarsenHookFunction) – The coarsen hook function.
restricthook (DMRestrictHookFunction) – The restrict hook function.
args (tuple[Any, ...] | None) – Positional arguments for the hooks.
kargs (dict[str, Any] | None) – Keyword arguments for the hooks.
- Return type:
See also
petsc.DMCoarsenHookAdd
- addField(field, label=None)¶
Add a field to a
DMobject.Logically collective.
- Parameters:
- Return type:
See also
petsc.DMAddField
- 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
- clearDS()¶
Remove all discrete systems from the
DM.Logically collective.
See also
petsc.DMClearDSSource code at petsc4py/PETSc/DM.pyx:683
- Return type:
- clearFields()¶
Remove all fields from the
DM.Logically collective.
See also
petsc.DMClearFieldsSource code at petsc4py/PETSc/DM.pyx:642
- Return type:
- clearLabelStratum(name, value)¶
Remove all points from a stratum.
Not collective.
See also
petsc.DMClearLabelStratum
- clearLabelValue(name, point, value)¶
Remove a point from a
DMLabelwith given value.Not collective.
- Parameters:
- Return type:
See also
petsc.DMClearLabelValue
- clone()¶
Return the cloned
DM.Collective.
See also
petsc.DMCloneSource code at petsc4py/PETSc/DM.pyx:142
- Return type:
- coarsen(comm=None)¶
Return a coarsened
DMobject.Collective.
- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm.- Return type:
See also
petsc.DMCoarsen
- coarsenHierarchy(nlevels)¶
Coarsen this
DMand return the coarsenedDMhierarchy.Collective.
See also
petsc.DMCoarsenHierarchy
- convert(dm_type)¶
Return a
DMconverted to anotherDM.Collective.
See also
DM.Type,petsc.DMConvert
- copyDS(dm)¶
Copy the discrete systems for this
DMinto anotherDM.Collective.
See also
petsc.DMCopyDS
- copyDisc(dm)¶
Copy fields and discrete systems of a
DMinto anotherDM.Collective.
See also
petsc.DMCopyDisc
- copyFields(dm)¶
Copy the discretizations of this
DMinto anotherDM.Collective.
See also
petsc.DMCopyFields
- create(comm=None)¶
Return an empty
DM.Collective.
- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm.- Return type:
See also
petsc.DMCreate
- createDS()¶
Create discrete systems.
Collective.
See also
petsc.DMCreateDSSource code at petsc4py/PETSc/DM.pyx:671
- Return type:
- createFieldDecomposition()¶
Return a list of
ISobjects.Not collective.
Notes
The user is responsible for freeing all requested arrays.
See also
petsc.DMCreateFieldDecomposition
- createGlobalVec()¶
Return a global vector.
Collective.
See also
petsc.DMCreateGlobalVectorSource code at petsc4py/PETSc/DM.pyx:774
- Return type:
- createInjection(dm)¶
Return the injection matrix into a finer
DM.Collective.
See also
petsc.DMCreateInjection
- createInterpolation(dm)¶
Return the interpolation matrix to a finer
DM.Collective.
See also
petsc.DMCreateInterpolation
- createLabel(name)¶
Create a label of the given name if it does not already exist.
Not collective.
See also
petsc.DMCreateLabel
- createLocalVec()¶
Return a local vector.
Not collective.
See also
petsc.DMCreateLocalVectorSource code at petsc4py/PETSc/DM.pyx:788
- Return type:
- createMassMatrix(dmf)¶
Return the mass matrix between this
DMand the givenDM.Collective.
See also
petsc.DMCreateMassMatrix
- createMat()¶
Return an empty matrix.
Collective.
See also
petsc.DMCreateMatrixSource code at petsc4py/PETSc/DM.pyx:1166
- Return type:
- createRestriction(dm)¶
Return the restriction matrix between this
DMand the givenDM.Collective.
See also
petsc.DMCreateRestriction
- createSectionSF(localsec, globalsec)¶
Create the
SFencoding the parallel DOF overlap for theDM.- Parameters:
- Return type:
Notes
Encoding based on the
Sectiondescribing the data layout.See also
DM.getSectionSF,petsc.DMCreateSectionSF
- createSubDM(fields)¶
Return
ISandDMencapsulating a subproblem.Not collective.
- Returns:
- Parameters:
- Return type:
See also
petsc.DMCreateSubDM
- destroy()¶
Destroy the object.
Collective.
See also
petsc.DMDestroySource code at petsc4py/PETSc/DM.pyx:108
- Return type:
- getAppCtx()¶
- getAuxiliaryVec(label=None, value=0, part=0)¶
Return an auxiliary vector for region.
Not collective.
- Parameters:
- Return type:
See also
DM.getLabel,petsc.DMGetAuxiliaryVec
- getBasicAdjacency()¶
Return the flags for determining variable influence.
Not collective.
- Returns:
- Return type:
See also
petsc.DMGetBasicAdjacency
- getBlockSize()¶
Return the inherent block size associated with a
DM.Not collective.
See also
petsc.DMGetBlockSizeSource code at petsc4py/PETSc/DM.pyx:746
- Return type:
- getBoundingBox()¶
Return the dimension of embedding space for coordinates values.
Not collective.
See also
petsc.DMGetBoundingBox
- getCoarseDM()¶
Return the coarse
DM.Collective.
See also
petsc.DMGetCoarseDMSource code at petsc4py/PETSc/DM.pyx:954
- Return type:
- getCoarsenLevel()¶
Return the number of coarsenings.
Not collective.
See also
petsc.DMGetCoarsenLevelSource code at petsc4py/PETSc/DM.pyx:1415
- Return type:
- getCoordinateDM()¶
Return the coordinate
DM.Collective.
See also
petsc.DMGetCoordinateDMSource code at petsc4py/PETSc/DM.pyx:982
- Return type:
- getCoordinateDim()¶
Return the dimension of embedding space for coordinates values.
Not collective.
See also
petsc.DMGetCoordinateDimSource code at petsc4py/PETSc/DM.pyx:225
- Return type:
- getCoordinateSection()¶
Return coordinate values layout over the mesh.
Collective.
See also
petsc.DMGetCoordinateSectionSource code at petsc4py/PETSc/DM.pyx:997
- Return type:
- getCoordinates()¶
Return a global vector with the coordinates associated.
Collective.
See also
petsc.DMGetCoordinatesSource code at petsc4py/PETSc/DM.pyx:1029
- Return type:
- getCoordinatesLocal()¶
Return a local vector with the coordinates associated.
Collective the first time it is called.
See also
petsc.DMGetCoordinatesLocalSource code at petsc4py/PETSc/DM.pyx:1061
- Return type:
- getDS()¶
Return default
DS.Not collective.
See also
petsc.DMGetDSSource code at petsc4py/PETSc/DM.pyx:695
- Return type:
- getDimension()¶
Return the topological dimension of the
DM.Not collective.
See also
petsc.DMGetDimensionSource code at petsc4py/PETSc/DM.pyx:193
- Return type:
- getField(index)¶
Return the discretization object for a given
DMfield.Not collective.
See also
petsc.DMGetField
- getFieldAdjacency(field)¶
Return the flags for determining variable influence.
Not collective.
- Parameters:
field (int) – The field number.
- Returns:
- Return type:
See also
petsc.DMGetAdjacency
- getGlobalSection()¶
Return the
Sectionencoding the global data layout for theDM.See also
petsc.DMGetGlobalSectionSource code at petsc4py/PETSc/DM.pyx:1541
- Return type:
- getGlobalVec()¶
Return a global vector.
Collective.
See also
petsc.DMGetGlobalVectorSource code at petsc4py/PETSc/DM.pyx:802
- Return type:
- getLGMap()¶
Return local mapping to global mapping.
Collective.
See also
petsc.DMGetLocalToGlobalMappingSource code at petsc4py/PETSc/DM.pyx:937
- Return type:
- getLabel(name)¶
Return the label of a given name.
Not collective.
See also
petsc.DMGetLabel
- getLabelIdIS(name)¶
Return an
ISof all values that theDMLabeltakes.Not collective.
See also
petsc.DMLabelGetValueIS,petsc.DMGetLabelIdIS
- getLabelName(index)¶
Return the name of nth label.
Not collective.
See also
petsc.DMGetLabelName
- getLabelOutput(name)¶
Return the output flag for a given label.
Not collective.
See also
petsc.DMGetLabelOutput
- getLabelSize(name)¶
Return the number of values that the
DMLabeltakes.Not collective.
See also
petsc.DMLabelGetNumValues,petsc.DMGetLabelSize
- getLabelValue(name, point)¶
Return the value in
DMLabelfor the given point.Not collective.
See also
petsc.DMGetLabelValue
- getLocalBoundingBox()¶
Return the bounding box for the piece of the
DM.Not collective.
See also
petsc.DMGetLocalBoundingBox
- getLocalSection()¶
Return the
Sectionencoding the local data layout for theDM.See also
petsc.DMGetGlobalSectionSource code at petsc4py/PETSc/DM.pyx:1518
- Return type:
- getLocalVec()¶
Return a local vector.
Not collective.
See also
petsc.DMGetLocalVectorSource code at petsc4py/PETSc/DM.pyx:835
- Return type:
- getNumFields()¶
Return the number of fields in the
DM.Not collective.
See also
petsc.DMGetNumFieldsSource code at petsc4py/PETSc/DM.pyx:554
- Return type:
- getNumLabels()¶
Return the number of labels defined by on the
DM.Not collective.
See also
petsc.DMGetNumLabelsSource code at petsc4py/PETSc/DM.pyx:1634
- Return type:
- getOptionsPrefix()¶
Return the prefix used for searching for options in the database.
Not collective.
See also
Working with PETSc options (TODO),
setOptionsPrefix,petsc.DMGetOptionsPrefixSource code at petsc4py/PETSc/DM.pyx:271
- Return type:
- getPointSF()¶
Return the
SFencoding the parallel DOF overlap for theDM.See also
petsc.DMGetPointSFSource code at petsc4py/PETSc/DM.pyx:1611
- Return type:
- getRefineLevel()¶
Return the refinement level.
Not collective.
See also
petsc.DMGetRefineLevelSource code at petsc4py/PETSc/DM.pyx:1383
- Return type:
- getSectionSF()¶
Return the
Sectionencoding the parallel DOF overlap.See also
petsc.DMGetSectionSFSource code at petsc4py/PETSc/DM.pyx:1584
- Return type:
- getStratumIS(name, value)¶
Return the points in a label stratum.
Not collective.
See also
petsc.DMGetStratumIS
- getStratumSize(name, value)¶
Return the number of points in a label stratum.
Not collective.
See also
petsc.DMGetStratumSize
- getType()¶
Return the
DMtype name.Not collective.
See also
petsc.DMGetTypeSource code at petsc4py/PETSc/DM.pyx:179
- Return type:
- globalToLocal(vg, vl, addv=None)¶
Update local vectors from global vector.
Neighborwise collective.
- Parameters:
vg (Vec) – The global vector.
vl (Vec) – The local vector.
addv (InsertModeSpec | None) – Insertion mode.
- Return type:
See also
petsc.DMGlobalToLocalBegin,petsc.DMGlobalToLocalEnd
- load(viewer)¶
Return a
DMstored in binary.Collective.
- Parameters:
viewer (Viewer) – Viewer used to store the
DM, likeViewer.Type.BINARYorViewer.Type.HDF5.- Return type:
Notes
When using
Viewer.Type.HDF5format, one can save multipleDMPlexmeshes in a single HDF5 files. This in turn requires one to name theDMPlexobject withObject.setNamebefore saving it withDM.viewand before loading it withDM.loadfor identification of the mesh object.See also
DM.view,DM.load,Object.setName,petsc.DMLoad
- localToGlobal(vl, vg, addv=None)¶
Update global vectors from local vector.
Neighborwise collective.
- Parameters:
vl (Vec) – The local vector.
vg (Vec) – The global vector.
addv (InsertModeSpec | None) – Insertion mode.
- Return type:
See also
petsc.DMLocalToGlobalBegin,petsc.DMLocalToGlobalEnd
- localToLocal(vl, vlg, addv=None)¶
Map the values from a local vector to another local vector.
Neighborwise collective.
- Parameters:
vl (Vec) – The local vector.
vlg (Vec) – The global vector.
addv (InsertModeSpec | None) – Insertion mode.
- Return type:
See also
petsc.DMLocalToLocalBegin,petsc.DMLocalToLocalEnd
- localizeCoordinates()¶
Create local coordinates for cells having periodic faces.
Collective.
Notes
Used if the mesh is periodic.
See also
petsc.DMLocalizeCoordinatesSource code at petsc4py/PETSc/DM.pyx:1126
- Return type:
- projectCoordinates(disc)¶
Project coordinates to a different space.
See also
petsc.DMProjectCoordinates
- refine(comm=None)¶
Return a refined
DMobject.Collective.
- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm.- Return type:
See also
petsc.DMRefine
- refineHierarchy(nlevels)¶
Refine this
DMand return the refinedDMhierarchy.Collective.
See also
petsc.DMRefineHierarchy
- removeLabel(name)¶
Remove and destroy the label by name.
Not collective.
See also
petsc.DMRemoveLabel
- restoreGlobalVec(vg)¶
Restore a global vector.
Not collective.
See also
petsc.DMRestoreGlobalVector
- restoreLocalVec(vl)¶
Restore a local vector.
Not collective.
See also
petsc.DMRestoreLocalVector
- setAppCtx(appctx)¶
- setAuxiliaryVec(aux, label, value=0, part=0)¶
Set an auxiliary vector for a specific region.
Not collective.
- Parameters:
- Return type:
See also
petsc.DMGetLabel,petsc.DMSetAuxiliaryVec
- setBasicAdjacency(useCone, useClosure)¶
Set the flags for determining variable influence.
Not collective.
- Parameters:
- Return type:
See also
petsc.DMSetBasicAdjacency
- setCoordinateDim(dim)¶
Set the dimension of embedding space for coordinates values.
Not collective.
See also
petsc.DMSetCoordinateDim
- setCoordinates(c)¶
Set a global vector that holds the coordinates.
Collective.
See also
petsc.DMSetCoordinates
- setCoordinatesLocal(c)¶
Set a local vector with the ghost point holding the coordinates.
Not collective.
See also
petsc.DMSetCoordinatesLocal
- setDimension(dim)¶
Set the topological dimension of the
DM.Collective.
See also
petsc.DMSetDimension
- setField(index, field, label=None)¶
Set the discretization object for a given
DMfield.Logically collective.
- Parameters:
- Return type:
See also
petsc.DMSetField
- setFieldAdjacency(field, useCone, useClosure)¶
Set the flags for determining variable influence.
Not collective.
- Parameters:
- Return type:
See also
petsc.DMSetAdjacency
- setFromOptions()¶
Configure the object from the options database.
Collective.
See also
Working with PETSc options (TODO),
petsc.DMSetFromOptionsSource code at petsc4py/PETSc/DM.pyx:299
- Return type:
- setGlobalSection(sec)¶
Set the
Sectionencoding the global data layout for theDM.See also
petsc.DMSetGlobalSection
- setKSPComputeOperators(operators, args=None, kargs=None)¶
Matrix associated with the linear system.
Collective.
- Parameters:
- Return type:
See also
petsc.DMKSPSetComputeOperators
- setLabelOutput(name, output)¶
Set if a given label should be saved to a view.
Not collective.
- Parameters:
- Return type:
See also
petsc.DMSetLabelOutput
- setLabelValue(name, point, value)¶
Set a point to a
DMLabelwith a given value.Not collective.
- Parameters:
- Return type:
See also
petsc.DMSetLabelValue
- setLocalSection(sec)¶
Set the
Sectionencoding the local data layout for theDM.See also
petsc.DMSetLocalSection
- setMatType(mat_type)¶
Set matrix type to be used by
DM.createMat.Logically collective.
Notes
The option
-dm_mat_typeis used to set the matrix type.See also
Working with PETSc options (TODO),
petsc.DMSetMatType
- setNumFields(numFields)¶
Set the number of fields in the
DM.Logically collective.
See also
petsc.DMSetNumFields
- 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
- setPointSF(sf)¶
Set the
SFencoding the parallel DOF overlap for theDM.See also
petsc.DMSetPointSF
- setRefineLevel(level)¶
Set the number of refinements.
Not collective.
See also
petsc.DMSetRefineLevel
- setSNESFunction(function, args=None, kargs=None)¶
Set
SNESresidual evaluation function.Not collective.
- Parameters:
- Return type:
See also
SNES.setFunction,petsc.DMSNESSetFunction
- setSNESJacobian(jacobian, args=None, kargs=None)¶
Set the
SNESJacobian evaluation function.Not collective.
- Parameters:
- Return type:
See also
SNES.setJacobian,petsc.DMSNESSetJacobian
- setSectionSF(sf)¶
Set the
Sectionencoding the parallel DOF overlap for theDM.See also
petsc.DMSetSectionSF
- setType(dm_type)¶
Build a
DM.Collective.
Notes
DMtypes are available inDM.Typeclass.See also
DM.Type,petsc.DMSetType
- setUp()¶
Return the data structure.
Collective.
See also
petsc.DMSetUpSource code at petsc4py/PETSc/DM.pyx:334
- Return type:
- setVecType(vec_type)¶
Set the type of vector.
Logically collective.
See also
Vec.Type,petsc.DMSetVecType
- viewFromOptions(name, obj=None)¶
View a
DMbased in the options.Collective.
- Parameters:
- Return type:
See also
petsc.DMViewFromOptions
Attributes Documentation
- appctx¶
- ds¶