petsc4py.PETSc.Section#
- class petsc4py.PETSc.Section#
Bases:
Object
Mapping from integers in a range to unstructured set of integers.
Methods Summary
addConstraintDof
(point, numDof)Increment the number of constrained DOFs for a given point.
addDof
(point, numDof)Add
numDof
degrees of freedom associated with a given point.addFieldConstraintDof
(point, field, numDof)Add
numDof
constrained DOFs for a given field on a point.addFieldDof
(point, field, numDof)Add
numDof
DOFs associated with a field on a given point.clone
()Return a copy of the section.
create
([comm])Allocate a section and set the map contents to the default.
Create a section describing the global field layout.
destroy
()Destroy a section.
getChart
()Return the range in which points (indices) lie for this section.
Return the size capable of holding all unconstrained DOFs in a section.
getConstraintDof
(point)Return the number of constrained DOFs associated with a given point.
getConstraintIndices
(point)Return the point DOFs numbers which are constrained for a given point.
getDof
(point)Return the number of degrees of freedom for a given point.
getFieldComponents
(field)Return the number of field components for the given field.
getFieldConstraintDof
(point, field)Return the number of constrained DOFs for a given field on a point.
getFieldConstraintIndices
(point, field)Return the field DOFs numbers, in [0, DOFs), which are constrained.
getFieldDof
(point, field)Return the number of DOFs associated with a field on a given point.
getFieldName
(field)Return the name of a field in the section.
getFieldOffset
(point, field)Return the offset for the field DOFs on the given point.
Return the maximum number of DOFs for any point in the section.
Return the number of fields in a section.
getOffset
(point)Return the offset for the DOFs associated with the given point.
Return the full range of offsets, [start, end), for a section.
Return the permutation that was set with
setPermutation
.Return the size capable of holding all the DOFs defined in a section.
reset
()Free all section data.
setChart
(pStart, pEnd)Set the range in which points (indices) lie for this section.
setConstraintDof
(point, numDof)Set the number of constrained DOFs associated with a given point.
setConstraintIndices
(point, indices)Set the point DOFs numbers, in [0, DOFs), which are constrained.
setDof
(point, numDof)Set the number of degrees of freedom associated with a given point.
setFieldComponents
(field, numComp)Set the number of field components for the given field.
setFieldConstraintDof
(point, field, numDof)Set the number of constrained DOFs for a given field on a point.
setFieldConstraintIndices
(point, field, indices)Set the field DOFs numbers, in [0, DOFs), which are constrained.
setFieldDof
(point, field, numDof)Set the number of DOFs associated with a field on a given point.
setFieldName
(field, fieldName)Set the name of a field in the section.
setFieldOffset
(point, field, offset)Set the offset for the DOFs on the given field at a point.
setNumFields
(numFields)Set the number of fields in a section.
setOffset
(point, offset)Set the offset for the DOFs associated with the given point.
setPermutation
(perm)Set the permutation for [0, pEnd - pStart).
setUp
()Calculate offsets.
view
([viewer])View the section.
Methods Documentation
- addConstraintDof(point, numDof)#
Increment the number of constrained DOFs for a given point.
Not collective.
- Parameters:
- Return type:
- addDof(point, numDof)#
Add
numDof
degrees of freedom associated with a given point.Not collective.
- Parameters:
- Return type:
See also
- addFieldConstraintDof(point, field, numDof)#
Add
numDof
constrained DOFs for a given field on a point.Not collective.
- Parameters:
- Return type:
- addFieldDof(point, field, numDof)#
Add
numDof
DOFs associated with a field on a given point.Not collective.
- Parameters:
- Return type:
See also
- clone()#
Return a copy of the section.
Collective.
The copy is shallow, if possible.
See also
Source code at petsc4py/PETSc/Section.pyx:80
- Return type:
- create(comm=None)#
Allocate a section and set the map contents to the default.
Collective.
Typical calling sequence: -
create
-setNumFields
-setChart
-setDof
-setUp
-getOffset
-destroy
The
Section
object and methods are intended to be used in the PETSc Vec and Mat implementations. The indices returned by theSection
are appropriate for the kind ofVec
it is associated with. For example, if the vector being indexed is a local vector, we call the section a local section. If the section indexes a global vector, we call it a global section. For parallel vectors, like global vectors, we use negative indices to indicate DOFs owned by other processes.- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm
.- Return type:
See also
- createGlobalSection(sf)#
Create a section describing the global field layout.
Collective.
The section describes the global field layout using the local section and an
SF
describing the section point overlap.If we have a set of local sections defining the layout of a set of local vectors, and also an
SF
to determine which section points are shared and the ownership, we can calculate a global section defining the parallel data layout, and the associated global vector.This gives negative sizes and offsets to points not owned by this process.
includeConstraints
andlocalOffsets
parameters of the C API are always set toFalse
.- Parameters:
sf (SF) – The
SF
describing the parallel layout of the section points (leaves are unowned local points).- Return type:
See also
- destroy()#
Destroy a section.
Not collective.
See also
Source code at petsc4py/PETSc/Section.pyx:29
- Return type:
- getChart()#
Return the range in which points (indices) lie for this section.
Not collective.
The range is [pStart, pEnd), i.e., from the first point to one past the last point.
See also
- getConstrainedStorageSize()#
Return the size capable of holding all unconstrained DOFs in a section.
Not collective.
Source code at petsc4py/PETSc/Section.pyx:720
- Return type:
- getConstraintDof(point)#
Return the number of constrained DOFs associated with a given point.
Not collective.
See also
- getConstraintIndices(point)#
Return the point DOFs numbers which are constrained for a given point.
Not collective.
The range is in [0, DOFs).
- getDof(point)#
Return the number of degrees of freedom for a given point.
Not collective.
In a global section, this value will be negative for points not owned by this process.
See also
- getFieldComponents(field)#
Return the number of field components for the given field.
Not collective.
- getFieldConstraintDof(point, field)#
Return the number of constrained DOFs for a given field on a point.
Not collective.
- getFieldConstraintIndices(point, field)#
Return the field DOFs numbers, in [0, DOFs), which are constrained.
Not collective.
The constrained DOFs are sorted in ascending order.
- getFieldDof(point, field)#
Return the number of DOFs associated with a field on a given point.
Not collective.
See also
- getFieldName(field)#
Return the name of a field in the section.
Not collective.
See also
- getFieldOffset(point, field)#
Return the offset for the field DOFs on the given point.
Not collective.
In a global section, this offset will be negative for points not owned by this process.
See also
- getMaxDof()#
Return the maximum number of DOFs for any point in the section.
Not collective.
See also
Source code at petsc4py/PETSc/Section.pyx:692
- Return type:
- getNumFields()#
Return the number of fields in a section.
Not collective.
Returns
0
if no fields were defined.See also
Source code at petsc4py/PETSc/Section.pyx:122
- Return type:
- getOffset(point)#
Return the offset for the DOFs associated with the given point.
Not collective.
In a global section, this offset will be negative for points not owned by this process.
See also
- getOffsetRange()#
Return the full range of offsets, [start, end), for a section.
Not collective.
See also
- getPermutation()#
Return the permutation that was set with
setPermutation
.Not collective.
See also
Source code at petsc4py/PETSc/Section.pyx:279
- Return type:
- getStorageSize()#
Return the size capable of holding all the DOFs defined in a section.
Not collective.
Source code at petsc4py/PETSc/Section.pyx:706
- Return type:
- reset()#
Free all section data.
Not collective.
See also
Source code at petsc4py/PETSc/Section.pyx:110
- Return type:
- setChart(pStart, pEnd)#
Set the range in which points (indices) lie for this section.
Not collective.
The range is [pStart, pEnd), i.e., from the first point to one past the last point.
See also
- setConstraintDof(point, numDof)#
Set the number of constrained DOFs associated with a given point.
Not collective.
- Parameters:
- Return type:
- setConstraintIndices(point, indices)#
Set the point DOFs numbers, in [0, DOFs), which are constrained.
Not collective.
- Parameters:
- Return type:
- setDof(point, numDof)#
Set the number of degrees of freedom associated with a given point.
Not collective.
See also
- setFieldComponents(field, numComp)#
Set the number of field components for the given field.
Not collective.
- Parameters:
- Return type:
- setFieldConstraintDof(point, field, numDof)#
Set the number of constrained DOFs for a given field on a point.
Not collective.
- Parameters:
- Return type:
- setFieldConstraintIndices(point, field, indices)#
Set the field DOFs numbers, in [0, DOFs), which are constrained.
Not collective.
- Parameters:
- Return type:
- setFieldDof(point, field, numDof)#
Set the number of DOFs associated with a field on a given point.
Not collective.
- Parameters:
- Return type:
See also
- setFieldName(field, fieldName)#
Set the name of a field in the section.
Not collective.
See also
- setFieldOffset(point, field, offset)#
Set the offset for the DOFs on the given field at a point.
Not collective.
The user usually does not call this function, but uses
setUp
.- Parameters:
- Return type:
See also
- setNumFields(numFields)#
Set the number of fields in a section.
Not collective.
See also
- setOffset(point, offset)#
Set the offset for the DOFs associated with the given point.
Not collective.
The user usually does not call this function, but uses
setUp
.See also
- setPermutation(perm)#
Set the permutation for [0, pEnd - pStart).
Not collective.
See also
- setUp()#
Calculate offsets.
Not collective.
Offsets are based on the number of degrees of freedom for each point.
See also
Source code at petsc4py/PETSc/Section.pyx:96
- Return type:
- view(viewer=None)#
View the section.
Collective.
See also