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:
See also
setConstraintDof
,getConstraintDof
,petsc.PetscSectionAddConstraintDof
- addDof(point, numDof)
Add
numDof
degrees of freedom associated with a given point.Not collective.
- Parameters:
- Return type:
- addFieldConstraintDof(point, field, numDof)
Add
numDof
constrained DOFs for a given field on a point.Not collective.
- Parameters:
- Return type:
See also
setFieldConstraintDof
,getFieldConstraintDof
,petsc.PetscSectionAddFieldConstraintDof
- addFieldDof(point, field, numDof)
Add
numDof
DOFs associated with a field on a given point.Not collective.
- Parameters:
- Return type:
See also
setFieldDof
,getFieldDof
,petsc.PetscSectionAddFieldDof
- clone()
Return a copy of the section.
Collective.
The copy is shallow, if possible.
See also
petsc.PetscSectionClone
Source code at petsc4py/PETSc/Section.pyx:84
- 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
petsc.PetscSectionCreate
- 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
petsc.PetscSectionCreateGlobalSection
- destroy()
Destroy a section.
Not collective.
See also
petsc.PetscSectionDestroy
Source code at petsc4py/PETSc/Section.pyx:33
- 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
petsc.PetscSectionGetChart
- getConstrainedStorageSize()
Return the size capable of holding all unconstrained DOFs in a section.
Not collective.
See also
getStorageSize
,petsc.PetscSectionGetConstrainedStorageSize
Source code at petsc4py/PETSc/Section.pyx:727
- Return type:
- getConstraintDof(point)
Return the number of constrained DOFs associated with a given point.
Not collective.
See also
setConstraintDof
,petsc.PetscSectionGetConstraintDof
- getConstraintIndices(point)
Return the point DOFs numbers which are constrained for a given point.
Not collective.
The range is in [0, DOFs).
See also
setConstraintIndices
,petsc.PetscSectionGetConstraintIndices
- 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.
- getFieldComponents(field)
Return the number of field components for the given field.
Not collective.
See also
setFieldComponents
,petsc.PetscSectionGetFieldComponents
- getFieldConstraintDof(point, field)
Return the number of constrained DOFs for a given field on a point.
Not collective.
See also
setFieldConstraintDof
,petsc.PetscSectionGetFieldConstraintDof
- getFieldConstraintIndices(point, field)
Return the field DOFs numbers, in [0, DOFs), which are constrained.
Not collective.
The constrained DOFs are sorted in ascending order.
See also
setFieldConstraintIndices
,petsc.PetscSectionGetFieldConstraintIndices
- getFieldDof(point, field)
Return the number of DOFs associated with a field on a given point.
Not collective.
See also
setFieldDof
,petsc.PetscSectionGetFieldDof
- getFieldName(field)
Return the name of a field in the section.
Not collective.
See also
setFieldName
,petsc.PetscSectionGetFieldName
- 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
setFieldOffset
,petsc.PetscSectionGetFieldOffset
- getMaxDof()
Return the maximum number of DOFs for any point in the section.
Not collective.
See also
petsc.PetscSectionGetMaxDof
Source code at petsc4py/PETSc/Section.pyx:699
- Return type:
- getNumFields()
Return the number of fields in a section.
Not collective.
Returns
0
if no fields were defined.See also
setNumFields
,petsc.PetscSectionGetNumFields
Source code at petsc4py/PETSc/Section.pyx:126
- 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
setOffset
,petsc.PetscSectionGetOffset
- getOffsetRange()
Return the full range of offsets, [start, end), for a section.
Not collective.
See also
petsc.PetscSectionGetOffsetRange
- getPermutation()
Return the permutation that was set with
setPermutation
.Not collective.
See also
setPermutation
,petsc.PetscSectionGetPermutation
Source code at petsc4py/PETSc/Section.pyx:283
- Return type:
- getStorageSize()
Return the size capable of holding all the DOFs defined in a section.
Not collective.
See also
getConstrainedStorageSize
,petsc.PetscSectionGetStorageSize
Source code at petsc4py/PETSc/Section.pyx:713
- Return type:
- reset()
Free all section data.
Not collective.
See also
petsc.PetscSectionReset
Source code at petsc4py/PETSc/Section.pyx:114
- 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
petsc.PetscSectionSetChart
- setConstraintDof(point, numDof)
Set the number of constrained DOFs associated with a given point.
Not collective.
- Parameters:
- Return type:
See also
getConstraintDof
,addConstraintDof
,petsc.PetscSectionSetConstraintDof
- setConstraintIndices(point, indices)
Set the point DOFs numbers, in [0, DOFs), which are constrained.
Not collective.
- Parameters:
- Return type:
See also
getConstraintIndices
,petsc.PetscSectionSetConstraintIndices
- setDof(point, numDof)
Set the number of degrees of freedom associated with a given point.
Not collective.
- setFieldComponents(field, numComp)
Set the number of field components for the given field.
Not collective.
- Parameters:
- Return type:
See also
getFieldComponents
,petsc.PetscSectionSetFieldComponents
- setFieldConstraintDof(point, field, numDof)
Set the number of constrained DOFs for a given field on a point.
Not collective.
- Parameters:
- Return type:
See also
getFieldConstraintDof
,addFieldConstraintDof
,petsc.PetscSectionSetFieldConstraintDof
- setFieldConstraintIndices(point, field, indices)
Set the field DOFs numbers, in [0, DOFs), which are constrained.
Not collective.
- Parameters:
- Return type:
See also
getFieldConstraintIndices
,petsc.PetscSectionSetFieldConstraintIndices
- setFieldDof(point, field, numDof)
Set the number of DOFs associated with a field on a given point.
Not collective.
- Parameters:
- Return type:
See also
getFieldDof
,addFieldDof
,petsc.PetscSectionSetFieldDof
- setFieldName(field, fieldName)
Set the name of a field in the section.
Not collective.
See also
getFieldName
,petsc.PetscSectionSetFieldName
- 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
getFieldOffset
,petsc.PetscSectionSetFieldOffset
- setNumFields(numFields)
Set the number of fields in a section.
Not collective.
See also
getNumFields
,petsc.PetscSectionSetNumFields
- 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
getOffset
,petsc.PetscSectionSetOffset
- setPermutation(perm)
Set the permutation for [0, pEnd - pStart).
Not collective.
See also
getPermutation
,petsc.PetscSectionSetPermutation
- setUp()
Calculate offsets.
Not collective.
Offsets are based on the number of degrees of freedom for each point.
See also
petsc.PetscSectionSetUp
Source code at petsc4py/PETSc/Section.pyx:100
- Return type: