PetscSection - Low-level Interface
The PetscSection component provides a flexible mechanism for describing the layout of degrees of freedom (DOFs) in a discretization, particularly for finite element methods and other multi-field problems where different points have different numbers of DOFs.
Overview
PetscSection is used to:
- Define DOF layouts: Specify how many DOFs exist at each point (vertex, edge, face, cell)
- Multi-field problems: Handle systems with multiple variables per point
- Local-to-global mapping: Convert between local and global numbering
- FEM discretizations: Manage DOF distributions for finite elements
- DM integration: Work with DM objects for mesh-based computations
A section maps from points (mesh entities like vertices, cells) to DOF ranges, answering:
- How many DOFs are at point
p? - What is the offset of the DOFs for point
p? - Which field do specific DOFs belong to?
Basic Usage
using PETSc, MPI
# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)
PetscInt = petsclib.PetscInt
# Create a section
section = LibPETSc.PetscSectionCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
# Set chart: range of valid point indices [pStart, pEnd)
LibPETSc.PetscSectionSetChart(petsclib, section, 0, 10)
# Set DOF count for each point
for p in 0:9
num_dofs = (p < 4) ? 1 : 2 # Different DOFs per point
LibPETSc.PetscSectionSetDof(petsclib, section, p, num_dofs)
end
# Setup: compute offsets
LibPETSc.PetscSectionSetUp(petsclib, section)
# Query the section
dof = LibPETSc.PetscSectionGetDof(petsclib, section, 5)
println("DOF count for point 5: ", dof)
offset = LibPETSc.PetscSectionGetOffset(petsclib, section, 5)
println("Offset for point 5: ", offset)
# Get total storage size
storage_size = LibPETSc.PetscSectionGetStorageSize(petsclib, section)
println("Total storage size: ", storage_size)
# Cleanup
LibPETSc.PetscSectionDestroy(petsclib, section)
PETSc.finalize(petsclib)
MPI.Finalize()Multi-Field Sections
For problems with multiple fields (e.g., velocity + pressure):
# Create section with 2 fields
section = LibPETSc.PetscSectionCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
LibPETSc.PetscSectionSetNumFields(petsclib, section, 2)
# Set field names
LibPETSc.PetscSectionSetFieldName(petsclib, section, 0, "velocity")
LibPETSc.PetscSectionSetFieldName(petsclib, section, 1, "pressure")
# Set chart
LibPETSc.PetscSectionSetChart(petsclib, section, 0, 10)
# Set field components: velocity has 3 components (vx, vy, vz), pressure has 1
LibPETSc.PetscSectionSetFieldComponents(petsclib, section, 0, 3)
LibPETSc.PetscSectionSetFieldComponents(petsclib, section, 1, 1)
# Set DOFs per field per point
for p in 0:9
LibPETSc.PetscSectionSetFieldDof(petsclib, section, p, 0, 3) # 3 velocity DOFs
LibPETSc.PetscSectionSetFieldDof(petsclib, section, p, 1, 1) # 1 pressure DOF
LibPETSc.PetscSectionSetDof(petsclib, section, p, 4) # Total: 4 DOFs
end
LibPETSc.PetscSectionSetUp(petsclib, section)Constrained DOFs
Mark certain DOFs as constrained (e.g., for boundary conditions):
# Set chart and DOFs, then before PetscSectionSetUp:
# Set constraint DOF count
LibPETSc.PetscSectionSetConstraintDof(petsclib, section, point, num_constrained)
LibPETSc.PetscSectionSetUp(petsclib, section)
# After set-up: specify which of the point's DOFs are constrained
constrained_indices = PetscInt[0, 2]
LibPETSc.PetscSectionSetConstraintIndices(petsclib, section, point, constrained_indices)
# Storage size excluding the constrained DOFs
LibPETSc.PetscSectionGetConstrainedStorageSize(petsclib, section)Integration with DM
Sections are commonly used with DM objects:
# Get the local (ghosted) section of a DM; the DM owns it
local_section = LibPETSc.DMGetLocalSection(petsclib, dm)
# Set a section on a DM
LibPETSc.DMSetLocalSection(petsclib, dm, section)
# Get the global section (owned DOFs only, built on demand)
global_section = LibPETSc.DMGetGlobalSection(petsclib, dm)Common Workflows
1. FEM Discretization
# Create section for Q1 finite elements on structured grid
# - Vertices: 1 DOF each
# - Cells: 0 DOFs
section = LibPETSc.PetscSectionCreate(petsclib, comm)
LibPETSc.PetscSectionSetChart(petsclib, section, vStart, cEnd)
# Set DOFs (vStart to vEnd are vertices, vEnd to cEnd are cells)
for v in vStart:vEnd-1
LibPETSc.PetscSectionSetDof(petsclib, section, v, 1)
end
LibPETSc.PetscSectionSetUp(petsclib, section)2. Point Closure
Get all DOFs in the closure of a point (point + its boundary):
# Get the closure of a cell: `closure` holds 2 * npoints entries, (point, orientation) pairs
npoints, closure = LibPETSc.DMPlexGetTransitiveClosure(petsclib, dm, cell, LibPETSc.PETSC_TRUE)
# Map closure points to DOF offsets using the section
for i in 1:npoints
p = closure[2i - 1]
dof = LibPETSc.PetscSectionGetDof(petsclib, section, p)
off = LibPETSc.PetscSectionGetOffset(petsclib, section, p)
# ... DOFs of point p are off:off+dof-1 ...
end
# Hand the closure array back to PETSc
LibPETSc.DMPlexRestoreTransitiveClosure(petsclib, dm, cell, LibPETSc.PETSC_TRUE, npoints, closure)Querying Section Properties
# Get total number of fields
num_fields = LibPETSc.PetscSectionGetNumFields(petsclib, section)
# Get field components
components = LibPETSc.PetscSectionGetFieldComponents(petsclib, section, field)
# Get field name (returns String directly)
name = LibPETSc.PetscSectionGetFieldName(petsclib, section, field)
# Get maximum DOF count across all points
max_dof = LibPETSc.PetscSectionGetMaxDof(petsclib, section)Cloning and Permutation
# Clone a section
new_section = LibPETSc.PetscSectionClone(petsclib, section)Function Reference
PETSc.LibPETSc.PetscSectionAddConstraintDof — Method
PetscSectionAddConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt)Increment the number of constrained degrees of freedom associated with a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointnumDof- the number of additional dof which are fixed by constraints
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionAddDof(), PetscSectionGetConstraintDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionAddConstraintDof
PETSc.LibPETSc.PetscSectionAddDof — Method
PetscSectionAddDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt)Adds to the total number of degrees of freedom associated with a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointnumDof- the number of additional dof
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionSetDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionAddDof
PETSc.LibPETSc.PetscSectionAddFieldConstraintDof — Method
PetscSectionAddFieldConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt)Increment the number of constrained degrees of freedom associated with a given field on a point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the fieldnumDof- the number of additional dof which are fixed by constraints
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionAddDof(), PetscSectionGetFieldConstraintDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionAddFieldConstraintDof
PETSc.LibPETSc.PetscSectionAddFieldDof — Method
PetscSectionAddFieldDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt)Adds a number of degrees of freedom associated with a field on a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the fieldnumDof- the number of dof
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetFieldDof(), PetscSectionGetFieldDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionAddFieldDof
PETSc.LibPETSc.PetscSectionArrayView — Method
PetscSectionArrayView(petsclib::PetscLibType, s::PetscSection, array::Ptr{Cvoid}, data_type::PetscDataType, viewer::PetscViewer)View an array, using the section to structure the values
Collective
Input Parameters:
s- the organizingPetscSectionarray- the array of valuesdata_type- thePetscDataTypeof the arrayviewer- thePetscViewer
Level: developer
See also: PetscSection, PetscViewer, PetscSectionCreate(), VecSetValuesSection(), PetscSectionVecView()
External Links
- PETSc Manual:
PetscSection/PetscSectionArrayView
PETSc.LibPETSc.PetscSectionClone — Method
newSection::PetscSection = PetscSectionClone(petsclib::PetscLibType, section::PetscSection)Creates a shallow (if possible) copy of the PetscSection
Collective
Input Parameter:
section- thePetscSection
Output Parameter:
newSection- the copy
Level: beginner
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy(), PetscSectionCopy()
External Links
- PETSc Manual:
PetscSection/PetscSectionClone
PETSc.LibPETSc.PetscSectionCompare — Method
congruent::PetscBool = PetscSectionCompare(petsclib::PetscLibType, s1::PetscSection, s2::PetscSection)Compares two sections
Collective
Input Parameters:
s1- the firstPetscSections2- the secondPetscSection
Output Parameter:
congruent-PETSC_TRUEif the two sections are congruent,PETSC_FALSEotherwise
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionCopy(), PetscSectionClone()
External Links
- PETSc Manual:
PetscSection/PetscSectionCompare
PETSc.LibPETSc.PetscSectionCopy — Method
PetscSectionCopy(petsclib::PetscLibType, section::PetscSection, newSection::PetscSection)Creates a shallow (if possible) copy of the PetscSection
Collective
Input Parameter:
section- thePetscSection
Output Parameter:
newSection- the copy
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy()
External Links
- PETSc Manual:
PetscSection/PetscSectionCopy
PETSc.LibPETSc.PetscSectionCreate — Method
s::PetscSection = PetscSectionCreate(petsclib::PetscLibType, comm::MPI_Comm)Allocates a PetscSection and sets the map contents to the default.
Collective
Input Parameters:
comm- the MPI communicators- pointer to the section
Level: beginner
See also: PetscSection, PetscSection, PetscSectionSetChart(), PetscSectionDestroy(), PetscSectionCreateGlobalSection()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreate
PETSc.LibPETSc.PetscSectionCreateComponentSubsection — Method
subs::PetscSection = PetscSectionCreateComponentSubsection(petsclib::PetscLibType, s::PetscSection, len::PetscInt, comps::Vector{PetscInt})Create a new, smaller PetscSection composed of only selected components
Collective
Input Parameters:
s- thePetscSectionlen- the number of componentscomps- the component numbers
Output Parameter:
subs- the subsection
Level: advanced
See also: PetscSection, PetscSection, PetscSectionCreateSupersection(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateComponentSubsection
PETSc.LibPETSc.PetscSectionCreateGlobalSection — Method
gsection::PetscSection = PetscSectionCreateGlobalSection(petsclib::PetscLibType, s::PetscSection, sf::PetscSF, usePermutation::PetscBool, includeConstraints::PetscBool, localOffsets::PetscBool)Create a parallel section describing the global layout using a local (sequential) PetscSection on each MPI process and a PetscSF describing the section point overlap.
Input Parameters:
s- ThePetscSectionfor the local field layoutsf- ThePetscSFdescribing parallel layout of the section points (leaves are unowned local points)usePermutation- By default this isPETSC_TRUE, meaning any permutation of the local section is transferred to the global sectionincludeConstraints- By default this isPETSC_FALSE, meaning that the global field vector will not possess constrained dofslocalOffsets- IfPETSC_TRUE, use local rather than global offsets for the points
Output Parameter:
gsection- ThePetscSectionfor the global field layout
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionCreateGlobalSectionCensored()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateGlobalSection
PETSc.LibPETSc.PetscSectionCreateGlobalSectionCensored — Method
gsection::PetscSection = PetscSectionCreateGlobalSectionCensored(petsclib::PetscLibType, s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, numExcludes::PetscInt, excludes::Vector{PetscInt})Create a PetscSection describing the globallayout using a local (sequential) PetscSection on each MPI process and an PetscSF describing the section point overlap.
Input Parameters:
s- ThePetscSectionfor the local field layoutsf- ThePetscSFdescribing parallel layout of the section pointsincludeConstraints- By default this isPETSC_FALSE, meaning that the global vector will not possess constrained dofsnumExcludes- The number of exclusion ranges, this must have the same value on all MPI processesexcludes- An array [start0, end0, start1, end1, ...] where there arenumExcludespairs and must have the same values on all MPI processes
Output Parameter:
gsection- ThePetscSectionfor the global field layout
Level: advanced
See also: PetscSection, PetscSection, PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateGlobalSectionCensored
PETSc.LibPETSc.PetscSectionCreateGlobalSectionLabel — Method
gsection::PetscSection = PetscSectionCreateGlobalSectionLabel(petsclib::PetscLibType, s::PetscSection, sf::PetscSF, includeConstraints::PetscBool, label::DMLabel, labelValue::PetscInt)Create a section describing the global field layout using the local section and an PetscSF describing the section point overlap.
Collective
Input Parameters:
s- ThePetscSectionfor the local field layoutsf- ThePetscSFdescribing parallel layout of the section pointsincludeConstraints- By default this isPETSC_FALSE, meaning that the global field vector will not possess constrained dofslabel- The label specifying the pointslabelValue- The label stratum specifying the points
Output Parameter:
gsection- ThePetscSectionfor the global field layout
Level: developer
See also: DMLabel, DM, PetscSectionCreate()
External Links
- PETSc Manual:
DMLabel/PetscSectionCreateGlobalSectionLabel
PETSc.LibPETSc.PetscSectionCreateSubdomainSection — Method
subs::PetscSection = PetscSectionCreateSubdomainSection(petsclib::PetscLibType, s::PetscSection, subpointMap::AbstractIS)Create a new, smaller section with support on a subdomain of the mesh
Collective
Input Parameters:
s- thePetscSectionsubpointMap- a sorted list of points in the original mesh which are in the subdomain
Output Parameter:
subs- the subsection
Level: advanced
See also: PetscSection, PetscSection, PetscSectionCreateSubmeshSection(), PetscSectionCreateSubsection(), DMPlexGetSubpointMap(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateSubdomainSection
PETSc.LibPETSc.PetscSectionCreateSubmeshSection — Method
subs::PetscSection = PetscSectionCreateSubmeshSection(petsclib::PetscLibType, s::PetscSection, subpointIS::AbstractIS)Create a new, smaller section with support on the submesh
Collective
Input Parameters:
s- thePetscSectionsubpointIS- a sorted list of points in the original mesh which are in the submesh
Output Parameter:
subs- the subsection
Level: advanced
See also: PetscSection, PetscSection, PetscSectionCreateSubdomainSection(), PetscSectionCreateSubsection(), DMPlexGetSubpointMap(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateSubmeshSection
PETSc.LibPETSc.PetscSectionCreateSubsection — Method
subs::PetscSection = PetscSectionCreateSubsection(petsclib::PetscLibType, s::PetscSection, len::PetscInt, fields::Vector{PetscInt})Create a new, smaller PetscSection composed of only selected fields
Collective
Input Parameters:
s- thePetscSectionlen- the number of subfieldsfields- the subfield numbers
Output Parameter:
subs- the subsection
Level: advanced
See also: PetscSection, PetscSection, PetscSectionCreateSupersection(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateSubsection
PETSc.LibPETSc.PetscSectionCreateSupersection — Method
supers::PetscSection = PetscSectionCreateSupersection(petsclib::PetscLibType, s::Vector{PetscSection}, len::PetscInt)Create a new, larger section composed of multiple PetscSections
Collective
Input Parameters:
s- the input sectionslen- the number of input sections
Output Parameter:
supers- the supersection
Level: advanced
See also: PetscSection, PetscSection, PetscSectionCreateSubsection(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionCreateSupersection
PETSc.LibPETSc.PetscSectionDestroy — Method
PetscSectionDestroy(petsclib::PetscLibType, s::Union{PetscSection, Ref{PetscSection}})Frees a PetscSection
Not Collective
Input Parameter:
s- thePetscSection
Level: beginner
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionReset()
External Links
- PETSc Manual:
PetscSection/PetscSectionDestroy
PETSc.LibPETSc.PetscSectionGetBlockStarts — Method
blockStarts::PetscBT = PetscSectionGetBlockStarts(petsclib::PetscLibType, s::PetscSection)Returns a table indicating which points start new blocks
Not Collective, No Fortran Support
Input Parameter:
s- thePetscSection
Output Parameter:
blockStarts- ThePetscBTwith a 1 for each point that begins a block
See also: IS, PetscSection, PetscSectionSetBlockStarts(), PetscSectionCreate(), DMCreateMatrix(), MatSetVariableBlockSizes()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetBlockStarts
PETSc.LibPETSc.PetscSectionGetChart — Method
pStart::PetscInt,pEnd::PetscInt = PetscSectionGetChart(petsclib::PetscLibType, s::PetscSection)Returns the range [pStart, pEnd) in which points (indices) lie for this PetscSection on this MPI process
Not Collective
Input Parameter:
s- thePetscSection
Output Parameters:
pStart- the first pointpEnd- one past the last point
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetChart(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetChart
PETSc.LibPETSc.PetscSectionGetClosureIndex — Method
clSection::PetscSection,clPoints::IS = PetscSectionGetClosureIndex(petsclib::PetscLibType, section::PetscSection, obj)Get the cache of points in the closure of each point in the section set with PetscSectionSetClosureIndex()
Collective
Input Parameters:
section- ThePetscSectionobj- APetscObjectwhich serves as the key for this index
Output Parameters:
clSection-PetscSectiongiving the size of the closure of each pointclPoints-ISgiving the points in each closure
Level: advanced
See also: PetscSection, PetscSectionSetClosureIndex(), DMPlexCreateClosureIndex()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetClosureIndex
PETSc.LibPETSc.PetscSectionGetClosureInversePermutation — Method
perm::IS = PetscSectionGetClosureInversePermutation(petsclib::PetscLibType, section::PetscSection, obj, depth::PetscInt, clSize::PetscInt)Get the inverse dof permutation for the closure of each cell in the section, meaning clPerm[oldIndex] = newIndex.
Not Collective
Input Parameters:
section- ThePetscSectionobj- APetscObjectwhich serves as the key for this index (usually aDM)depth- Depth stratum on which to obtain closure permutationclSize- Closure size to be permuted (e.g., may vary with element topology and degree)
Output Parameter:
perm- The dof closure permutation
Level: intermediate
See also: PetscSection, PetscSection, IS, PetscSectionSetClosurePermutation(), PetscSectionGetClosureIndex(), PetscSectionSetClosureIndex(), DMPlexCreateClosureIndex()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetClosureInversePermutation
PETSc.LibPETSc.PetscSectionGetClosurePermutation — Method
perm::IS = PetscSectionGetClosurePermutation(petsclib::PetscLibType, section::PetscSection, obj, depth::PetscInt, clSize::PetscInt)Get the dof permutation for the closure of each cell in the section, meaning clPerm[newIndex] = oldIndex.
Not Collective
Input Parameters:
section- ThePetscSectionobj- APetscObjectwhich serves as the key for this index (usually a DM)depth- Depth stratum on which to obtain closure permutationclSize- Closure size to be permuted (e.g., may vary with element topology and degree)
Output Parameter:
perm- The dof closure permutation
Level: intermediate
See also: PetscSection, PetscSection, IS, PetscSectionSetClosurePermutation(), PetscSectionGetClosureInversePermutation(), PetscSectionGetClosureIndex(), PetscSectionSetClosureIndex(), DMPlexCreateClosureIndex()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetClosurePermutation
PETSc.LibPETSc.PetscSectionGetComponentName — Method
compName::String = PetscSectionGetComponentName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, comp::PetscInt)Gets the name of a field component in the PetscSection
Not Collective
Input Parameters:
s- thePetscSectionfield- the field numbercomp- the component number
Output Parameter:
compName- the component name
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetFieldName(), PetscSectionSetNumFields(), PetscSectionGetNumFields(), PetscSectionSetComponentName(), PetscSectionSetFieldName(), PetscSectionGetFieldComponents(), PetscSectionSetFieldComponents()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetComponentName
PETSc.LibPETSc.PetscSectionGetConstrainedStorageSize — Method
size::PetscInt = PetscSectionGetConstrainedStorageSize(petsclib::PetscLibType, s::PetscSection)Return the size of an array or local Vec capable of holding all unconstrained degrees of freedom in a PetscSection
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
size- the size of an array which can hold all unconstrained dofs
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetStorageSize(), PetscSectionGetOffset(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetConstrainedStorageSize
PETSc.LibPETSc.PetscSectionGetConstraintDof — Method
numDof::PetscInt = PetscSectionGetConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt)Return the number of constrained degrees of freedom associated with a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the point
Output Parameter:
numDof- the number of dof which are fixed by constraints
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionSetConstraintDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetConstraintDof
PETSc.LibPETSc.PetscSectionGetConstraintIndices — Method
indices::Vector{PetscInt} = PetscSectionGetConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt)Get the point dof numbers, in [0, dof), which are constrained for a given point
Not Collective
Input Parameters:
s- ThePetscSectionpoint- The point
Output Parameter:
indices- The constrained dofs
Level: intermediate
See also: PetscSection, PetscSectionSetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection
External Links
- PETSc Manual:
PetscSection/PetscSectionGetConstraintIndices
PETSc.LibPETSc.PetscSectionGetDof — Method
numDof::PetscInt = PetscSectionGetDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt)Return the total number of degrees of freedom associated with a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the point
Output Parameter:
numDof- the number of dof
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetDof
PETSc.LibPETSc.PetscSectionGetField — Method
subs::PetscSection = PetscSectionGetField(petsclib::PetscLibType, s::PetscSection, field::PetscInt)Get the PetscSection associated with a single field
Input Parameters:
s- ThePetscSectionfield- The field number
Output Parameter:
subs- ThePetscSectionfor the given field, note the chart ofsubsis not set
Level: intermediate
See also: PetscSection, PetscSection, IS, PetscSectionSetNumFields()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetField
PETSc.LibPETSc.PetscSectionGetFieldComponents — Method
numComp::PetscInt = PetscSectionGetFieldComponents(petsclib::PetscLibType, s::PetscSection, field::PetscInt)Returns the number of field components for the given field.
Not Collective
Input Parameters:
s- thePetscSectionfield- the field number
Output Parameter:
numComp- the number of field components
Level: advanced
See also: PetscSection, PetscSection, PetscSectionSetFieldComponents(), PetscSectionGetNumFields(), PetscSectionSetComponentName(), PetscSectionGetComponentName()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldComponents
PETSc.LibPETSc.PetscSectionGetFieldConstraintDof — Method
numDof::PetscInt = PetscSectionGetFieldConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt)Return the number of constrained degrees of freedom associated with a given field on a point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the field
Output Parameter:
numDof- the number of dof which are fixed by constraints
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionSetFieldConstraintDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldConstraintDof
PETSc.LibPETSc.PetscSectionGetFieldConstraintIndices — Method
indices::Vector{PetscInt} = PetscSectionGetFieldConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt)Get the field dof numbers, in [0, fdof), which are constrained
Not Collective
Input Parameters:
s- ThePetscSectionfield- The field numberpoint- The point
Output Parameter:
indices- The constrained dofs sorted in ascending order, the length is returned byPetscSectionGetConstraintDof().
Level: intermediate
See also: PetscSection, PetscSectionSetFieldConstraintIndices(), PetscSectionGetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldConstraintIndices
PETSc.LibPETSc.PetscSectionGetFieldDof — Method
numDof::PetscInt = PetscSectionGetFieldDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt)Return the number of degrees of freedom associated with a field on a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the field
Output Parameter:
numDof- the number of dof
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetFieldDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldDof
PETSc.LibPETSc.PetscSectionGetFieldName — Method
fieldName::String = PetscSectionGetFieldName(petsclib::PetscLibType, s::PetscSection, field::PetscInt)Returns the name of a field in the PetscSection
Not Collective
Input Parameters:
s- thePetscSectionfield- the field number
Output Parameter:
fieldName- the field name
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetFieldName(), PetscSectionSetNumFields(), PetscSectionGetNumFields()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldName
PETSc.LibPETSc.PetscSectionGetFieldOffset — Method
offset::PetscInt = PetscSectionGetFieldOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt)Return the offset into an array or Vec for the field dof associated with the given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the field
Output Parameter:
offset- the offset
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionCreate(), PetscSectionGetFieldPointOffset()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldOffset
PETSc.LibPETSc.PetscSectionGetFieldPointOffset — Method
offset::PetscInt = PetscSectionGetFieldPointOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt)Return the offset for the first field dof associated with the given point relative to the offset for that point for the unnamed default field's first dof
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the field
Output Parameter:
offset- the offset
Level: advanced
See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionCreate(), PetscSectionGetFieldOffset()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldPointOffset
PETSc.LibPETSc.PetscSectionGetFieldPointSyms — Method
perms::Ptr{PetscInt},rots::Ptr{PetscScalar} = PetscSectionGetFieldPointSyms(petsclib::PetscLibType, section::PetscSection, field::PetscInt, numPoints::PetscInt, points::Vector{PetscInt})Get the symmetries for a set of points in a field of a PetscSection under specific orientations.
Not Collective
Input Parameters:
section- the sectionfield- the field of the sectionnumPoints- the number of pointspoints- an array of size 2 *numPoints, containing a list of (point, orientation) pairs. (An orientation is an
arbitrary integer: its interpretation is up to sym. Orientations are used by DM: for their interpretation in that context, see DMPlexGetConeOrientation()).
Output Parameters:
perms- The permutations for the given orientations (orNULLif there is no symmetry or the permutation is the identity).rots- The field rotations symmetries for the given orientations (orNULLif there is no symmetry or the rotations are all
identity).
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionGetPointSyms(), PetscSectionRestoreFieldPointSyms()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldPointSyms
PETSc.LibPETSc.PetscSectionGetFieldSym — Method
sym::PetscSectionSym = PetscSectionGetFieldSym(petsclib::PetscLibType, section::PetscSection, field::PetscInt)Get the symmetries for the data referred to by a field of the section
Collective
Input Parameters:
section- the section describing data layoutfield- the field number
Output Parameter:
sym- the symmetry describing the affect of orientation on the access of the data
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSetFieldSym(), PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetFieldSym
PETSc.LibPETSc.PetscSectionGetIncludesConstraints — Method
includesConstraints::PetscBool = PetscSectionGetIncludesConstraints(petsclib::PetscLibType, s::PetscSection)Returns the flag indicating if constrained dofs were included when computing offsets in the PetscSection. The value is set with PetscSectionSetIncludesConstraints()
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
includesConstraints- the flag indicating if constrained dofs were included when computing offsets
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetIncludesConstraints()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetIncludesConstraints
PETSc.LibPETSc.PetscSectionGetMaxDof — Method
maxDof::PetscInt = PetscSectionGetMaxDof(petsclib::PetscLibType, s::PetscSection)Return the maximum number of degrees of freedom on any point in the PetscSection
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
maxDof- the maximum dof
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionSetDof(), PetscSectionAddDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetMaxDof
PETSc.LibPETSc.PetscSectionGetNumFields — Method
numFields::PetscInt = PetscSectionGetNumFields(petsclib::PetscLibType, s::PetscSection)Returns the number of fields in a PetscSection, or 0 if no fields were defined.
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
numFields- the number of fields defined, or 0 if none were defined
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetNumFields()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetNumFields
PETSc.LibPETSc.PetscSectionGetOffset — Method
offset::PetscInt = PetscSectionGetOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt)Return the offset into an array or Vec for the dof associated with the given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the point
Output Parameter:
offset- the offset
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetFieldOffset(), PetscSectionCreate(), PetscSectionSetPointMajor()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetOffset
PETSc.LibPETSc.PetscSectionGetOffsetRange — Method
start::PetscInt,end_::PetscInt = PetscSectionGetOffsetRange(petsclib::PetscLibType, s::PetscSection)Return the full range of offsets [start, end) for a PetscSection
Not Collective
Input Parameter:
s- thePetscSection
Output Parameters:
start- the minimum offsetend- one more than the maximum offset
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetOffsetRange
PETSc.LibPETSc.PetscSectionGetPermutation — Method
perm::IS = PetscSectionGetPermutation(petsclib::PetscLibType, s::PetscSection)Returns the permutation of [0, pEnd - pStart) or NULL that was set with PetscSectionSetPermutation()
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
perm- The permutation as anIS
Level: intermediate
See also: IS, PetscSection, PetscSectionSetPermutation(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetPermutation
PETSc.LibPETSc.PetscSectionGetPointLayout — Method
layout::PetscLayout = PetscSectionGetPointLayout(petsclib::PetscLibType, comm::MPI_Comm, s::PetscSection)Get a PetscLayout for the points with nonzero dof counts of the unnamed default field within this PetscSections local chart
Collective
Input Parameters:
comm- TheMPI_Comms- ThePetscSection
Output Parameter:
layout- The point layout for the data that defines the section
Level: advanced
See also: PetscSection, PetscSection, PetscSectionGetValueLayout(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetPointLayout
PETSc.LibPETSc.PetscSectionGetPointMajor — Method
pm::PetscBool = PetscSectionGetPointMajor(petsclib::PetscLibType, s::PetscSection)Returns the flag for dof ordering, PETSC_TRUE if it is point major, PETSC_FALSE if it is field major
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
pm- the flag for point major ordering
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetPointMajor()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetPointMajor
PETSc.LibPETSc.PetscSectionGetPointSyms — Method
perms::Ptr{PetscInt},rots::Ptr{PetscScalar} = PetscSectionGetPointSyms(petsclib::PetscLibType, section::PetscSection, numPoints::PetscInt, points::Vector{PetscInt})Get the symmetries for a set of points in a PetscSection under specific orientations.
Not Collective
Input Parameters:
section- the sectionnumPoints- the number of pointspoints- an array of size 2 *numPoints, containing a list of (point, orientation) pairs. (An orientation is an
arbitrary integer: its interpretation is up to sym. Orientations are used by DM: for their interpretation in that context, see DMPlexGetConeOrientation()).
Output Parameters:
perms- The permutations for the given orientations (orNULLif there is no symmetry or the permutation is the identity).rots- The field rotations symmetries for the given orientations (orNULLif there is no symmetry or the rotations are all
identity).
Example of usage, gathering dofs into a local array (lArray) from a section array (sArray): `` const PetscInt **perms; const PetscScalar **rots; PetscInt lOffset;
PetscSectionGetPointSyms(section,numPoints,points,&perms,&rots); for (i = 0, lOffset = 0; i < numPoints; i++) { PetscInt point = points[2*i], dof, sOffset; const PetscInt *perm = perms ? perms[i] : NULL; const PetscScalar *rot = rots ? rots[i] : NULL;
PetscSectionGetDof(section,point,&dof); PetscSectionGetOffset(section,point,&sOffset);
if (perm) { for (j = 0; j < dof; j++) lArray[lOffset + perm[j]] = sArray[sOffset + j]; } else { for (j = 0; j < dof; j++) lArray[lOffset + j ] = sArray[sOffset + j]; } if (rot) { for (j = 0; j < dof; j++) lArray[lOffset + j ] *= rot[j]; } lOffset += dof; } PetscSectionRestorePointSyms(section,numPoints,points,&perms,&rots); ``
Example of usage, adding dofs into a section array (sArray) from a local array (lArray): `` const PetscInt **perms; const PetscScalar **rots; PetscInt lOffset;
PetscSectionGetPointSyms(section,numPoints,points,&perms,&rots); for (i = 0, lOffset = 0; i < numPoints; i++) { PetscInt point = points[2*i], dof, sOffset; const PetscInt *perm = perms ? perms[i] : NULL; const PetscScalar *rot = rots ? rots[i] : NULL;
PetscSectionGetDof(section,point,&dof); PetscSectionGetOffset(section,point,&sOff);
if (perm) { for (j = 0; j < dof; j++) sArray[sOffset + j] += lArray[lOffset + perm[j]] * (rot ? PetscConj(rot[perm[j]]) : 1.); } else { for (j = 0; j < dof; j++) sArray[sOffset + j] += lArray[lOffset + j ] * (rot ? PetscConj(rot[ j ]) : 1.); } offset += dof; } PetscSectionRestorePointSyms(section,numPoints,points,&perms,&rots); ``
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionRestorePointSyms(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetPointSyms
PETSc.LibPETSc.PetscSectionGetStorageSize — Method
size::PetscInt = PetscSectionGetStorageSize(petsclib::PetscLibType, s::PetscSection)Return the size of an array or local Vec capable of holding all the degrees of freedom defined in a PetscSection
Not Collective
Input Parameter:
s- thePetscSection
Output Parameter:
size- the size of an array which can hold all the dofs
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionGetConstrainedStorageSize(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetStorageSize
PETSc.LibPETSc.PetscSectionGetSym — Method
sym::PetscSectionSym = PetscSectionGetSym(petsclib::PetscLibType, section::PetscSection)Get the symmetries for the data referred to by the section
Not Collective
Input Parameter:
section- the section describing data layout
Output Parameter:
sym- the symmetry describing the affect of orientation on the access of the data, provided previously byPetscSectionSetSym()
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSetSym(), PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetSym
PETSc.LibPETSc.PetscSectionGetUseFieldOffsets — Method
flg::PetscBool = PetscSectionGetUseFieldOffsets(petsclib::PetscLibType, s::PetscSection)Get the flag indicating if field offsets are used directly in a global section, rather than just the point offset
Not Collective
Input Parameter:
s- the globalPetscSection
Output Parameter:
flg- the flag
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSetChart(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetUseFieldOffsets
PETSc.LibPETSc.PetscSectionGetValueLayout — Method
layout::PetscLayout = PetscSectionGetValueLayout(petsclib::PetscLibType, comm::MPI_Comm, s::PetscSection)Get the PetscLayout associated with the section dofs of a PetscSection
Collective
Input Parameters:
comm- TheMPI_Comms- ThePetscSection
Output Parameter:
layout- The dof layout for the section
Level: advanced
See also: PetscSection, PetscSection, PetscSectionGetPointLayout(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionGetValueLayout
PETSc.LibPETSc.PetscSectionHasConstraints — Method
hasConstraints::PetscBool = PetscSectionHasConstraints(petsclib::PetscLibType, s::PetscSection)Determine whether a PetscSection has constrained dofs
Not Collective
Input Parameter:
s- ThePetscSection
Output Parameter:
hasConstraints- flag indicating that the section has constrained dofs
Level: intermediate
See also: PetscSection, PetscSectionSetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection
External Links
- PETSc Manual:
PetscSection/PetscSectionHasConstraints
PETSc.LibPETSc.PetscSectionLoad — Method
PetscSectionLoad(petsclib::PetscLibType, s::PetscSection, viewer::PetscViewer)Loads a PetscSection
Collective
Input Parameters:
s- thePetscSectionobject to loadviewer- the viewer
Level: beginner
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy(), PetscSectionView()
External Links
- PETSc Manual:
PetscSection/PetscSectionLoad
PETSc.LibPETSc.PetscSectionPermute — Method
sectionNew::PetscSection = PetscSectionPermute(petsclib::PetscLibType, section::PetscSection, permutation::AbstractIS)Reorder the section according to the input point permutation
Collective
Input Parameters:
section- ThePetscSectionobjectpermutation- The point permutation, old point p becomes new point perm[p]
Output Parameter:
sectionNew- The permutedPetscSection
Level: intermediate
See also: PetscSection, IS, PetscSection, MatPermute(), PetscSectionSetPermutation()
External Links
- PETSc Manual:
PetscSection/PetscSectionPermute
PETSc.LibPETSc.PetscSectionReset — Method
PetscSectionReset(petsclib::PetscLibType, s::PetscSection)Frees all section data, the section is then as if PetscSectionCreate() had just been called.
Not Collective
Input Parameter:
s- thePetscSection
Level: beginner
See also: PetscSection, PetscSection, PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionReset
PETSc.LibPETSc.PetscSectionResetClosurePermutation — Method
PetscSectionResetClosurePermutation(petsclib::PetscLibType, section::PetscSection)Remove any existing closure permutation
Input Parameter:
section- ThePetscSection
Level: intermediate
See also: PetscSectionSetClosurePermutation(), PetscSectionSetClosureIndex(), PetscSectionReset()
External Links
- PETSc Manual:
PetscSection/PetscSectionResetClosurePermutation
PETSc.LibPETSc.PetscSectionRestoreFieldPointSyms — Method
PetscSectionRestoreFieldPointSyms(petsclib::PetscLibType, section::PetscSection, field::PetscInt, numPoints::PetscInt, points::PetscInt, perms::PetscInt, rots::PetscScalar)Restore the symmetries returned by PetscSectionGetFieldPointSyms()
Not Collective
Input Parameters:
section- the sectionfield- the field numbernumPoints- the number of pointspoints- an array of size 2 *numPoints, containing a list of (point, orientation) pairs. (An orientation is an
arbitrary integer: its interpretation is up to sym. Orientations are used by DM: for their interpretation in that context, see DMPlexGetConeOrientation()).
perms- The permutations for the given orientations: set to NULL at conclusionrots- The field rotations symmetries for the given orientations: set to NULL at conclusion
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionRestorePointSyms(), petscSectionGetFieldPointSyms(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym()
External Links
- PETSc Manual:
PetscSection/PetscSectionRestoreFieldPointSyms
PETSc.LibPETSc.PetscSectionRestorePointSyms — Method
PetscSectionRestorePointSyms(petsclib::PetscLibType, section::PetscSection, numPoints::PetscInt, points::PetscInt, perms::PetscInt, rots::PetscScalar)Restore the symmetries returned by PetscSectionGetPointSyms()
Not Collective
Input Parameters:
section- the sectionnumPoints- the number of pointspoints- an array of size 2 *numPoints, containing a list of (point, orientation) pairs. (An orientation is an
arbitrary integer: its interpretation is up to sym. Orientations are used by DM: for their interpretation in that context, see DMPlexGetConeOrientation()).
perms- The permutations for the given orientations: set toNULLat conclusionrots- The field rotations symmetries for the given orientations: set toNULLat conclusion
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionGetPointSyms(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym()
External Links
- PETSc Manual:
PetscSection/PetscSectionRestorePointSyms
PETSc.LibPETSc.PetscSectionSetBlockStarts — Method
PetscSectionSetBlockStarts(petsclib::PetscLibType, s::PetscSection, blockStarts::PetscBT)Sets a table indicating which points start new blocks
Not Collective, No Fortran Support
Input Parameters:
s- thePetscSectionblockStarts- ThePetscBTwith a 1 for each point that begins a block
Level: intermediate
See also: IS, PetscSection, PetscSectionGetBlockStarts(), PetscSectionCreate(), DMCreateMatrix(), MatSetVariableBlockSizes()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetBlockStarts
PETSc.LibPETSc.PetscSectionSetChart — Method
PetscSectionSetChart(petsclib::PetscLibType, s::PetscSection, pStart::PetscInt, pEnd::PetscInt)Sets the range [pStart, pEnd) in which points (indices) lie for this PetscSection on this MPI process
Not Collective
Input Parameters:
s- thePetscSectionpStart- the firstpointpEnd- one past the last point,pStart\lepEnd
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetChart(), PetscSectionCreate(), PetscSectionSetNumFields()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetChart
PETSc.LibPETSc.PetscSectionSetClosureIndex — Method
PetscSectionSetClosureIndex(petsclib::PetscLibType, section::PetscSection, obj, clSection::PetscSection, clPoints::AbstractIS)Create an internal data structure to speed up closure queries.
Collective
Input Parameters:
section- ThePetscSectionobj- APetscObjectwhich serves as the key for this indexclSection-PetscSectiongiving the size of the closure of each pointclPoints-ISgiving the points in each closure
Level: advanced
See also: PetscSection, PetscSection, PetscSectionGetClosureIndex(), DMPlexCreateClosureIndex()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetClosureIndex
PETSc.LibPETSc.PetscSectionSetClosurePermutation — Method
PetscSectionSetClosurePermutation(petsclib::PetscLibType, section::PetscSection, obj, depth::PetscInt, perm::AbstractIS)Set the dof permutation for the closure of each cell in the section, meaning clPerm[newIndex] = oldIndex.
Not Collective
Input Parameters:
section- ThePetscSectionobj- APetscObjectwhich serves as the key for this index (usually aDM)depth- Depth of points on which to apply the given permutationperm- Permutation of the cell dof closure
Level: intermediate
See also: PetscSection, PetscSection, IS, PetscSectionGetClosurePermutation(), PetscSectionGetClosureIndex(), DMPlexCreateClosureIndex(), PetscCopyMode
External Links
- PETSc Manual:
PetscSection/PetscSectionSetClosurePermutation
PETSc.LibPETSc.PetscSectionSetComponentName — Method
PetscSectionSetComponentName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, comp::PetscInt, compName::String)Sets the name of a field component in the PetscSection
Not Collective
Input Parameters:
s- thePetscSectionfield- the field numbercomp- the component numbercompName- the component name
Level: advanced
See also: PetscSection, PetscSection, PetscSectionGetComponentName(), PetscSectionSetNumFields(), PetscSectionGetNumFields(), PetscSectionSetFieldName(), PetscSectionGetFieldComponents(), PetscSectionSetFieldComponents()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetComponentName
PETSc.LibPETSc.PetscSectionSetConstraintDof — Method
PetscSectionSetConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt)Set the number of constrained degrees of freedom associated with a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointnumDof- the number of dof which are fixed by constraints
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetDof(), PetscSectionGetConstraintDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetConstraintDof
PETSc.LibPETSc.PetscSectionSetConstraintIndices — Method
PetscSectionSetConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt, indices::Vector{PetscInt})Set the point dof numbers, in [0, dof), which are constrained
Not Collective
Input Parameters:
s- ThePetscSectionpoint- The pointindices- The constrained dofs
Level: intermediate
See also: PetscSection, PetscSectionGetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection
External Links
- PETSc Manual:
PetscSection/PetscSectionSetConstraintIndices
PETSc.LibPETSc.PetscSectionSetDof — Method
PetscSectionSetDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, numDof::PetscInt)Sets the total number of degrees of freedom associated with a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointnumDof- the number of dof, these values may be negative -(dof+1) to indicate they are off process
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionAddDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetDof
PETSc.LibPETSc.PetscSectionSetFieldComponents — Method
PetscSectionSetFieldComponents(petsclib::PetscLibType, s::PetscSection, field::PetscInt, numComp::PetscInt)Sets the number of field components for the given field.
Not Collective
Input Parameters:
s- thePetscSectionfield- the field numbernumComp- the number of field components
Level: advanced
See also: PetscSection, PetscSection, PetscSectionGetFieldComponents(), PetscSectionSetComponentName(), PetscSectionGetComponentName(), PetscSectionGetNumFields()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldComponents
PETSc.LibPETSc.PetscSectionSetFieldConstraintDof — Method
PetscSectionSetFieldConstraintDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt)Set the number of constrained degrees of freedom associated with a given field on a point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the fieldnumDof- the number of dof which are fixed by constraints
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionSetDof(), PetscSectionGetFieldConstraintDof(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldConstraintDof
PETSc.LibPETSc.PetscSectionSetFieldConstraintIndices — Method
PetscSectionSetFieldConstraintIndices(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, indices::Vector{PetscInt})Set the field dof numbers, in [0, fdof), which are constrained
Not Collective
Input Parameters:
s- ThePetscSectionpoint- The pointfield- The field numberindices- The constrained dofs
Level: intermediate
See also: PetscSection, PetscSectionSetConstraintIndices(), PetscSectionGetFieldConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldConstraintIndices
PETSc.LibPETSc.PetscSectionSetFieldDof — Method
PetscSectionSetFieldDof(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, numDof::PetscInt)Sets the number of degrees of freedom associated with a field on a given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the fieldnumDof- the number of dof, these values may be negative -(dof+1) to indicate they are off process
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetFieldDof(), PetscSectionCreate(), PetscSectionAddDof(), PetscSectionSetDof()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldDof
PETSc.LibPETSc.PetscSectionSetFieldName — Method
PetscSectionSetFieldName(petsclib::PetscLibType, s::PetscSection, field::PetscInt, fieldName::String)Sets the name of a field in the PetscSection
Not Collective
Input Parameters:
s- thePetscSectionfield- the field numberfieldName- the field name
Level: intermediate
See also: PetscSection, PetscSectionGetFieldName(), PetscSectionSetNumFields(), PetscSectionGetNumFields()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldName
PETSc.LibPETSc.PetscSectionSetFieldOffset — Method
PetscSectionSetFieldOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, field::PetscInt, offset::PetscInt)Set the offset into an array or Vec for the dof associated with the given field at a point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointfield- the fieldoffset- the offset, these values may be negative indicating the values are off process
Level: developer
See also: PetscSection, PetscSection, PetscSectionGetFieldOffset(), PetscSectionSetOffset(), PetscSectionCreate(), PetscSectionSetUp()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldOffset
PETSc.LibPETSc.PetscSectionSetFieldSym — Method
PetscSectionSetFieldSym(petsclib::PetscLibType, section::PetscSection, field::PetscInt, sym::PetscSectionSym)Set the symmetries for the data referred to by a field of the section
Collective
Input Parameters:
section- the section describing data layoutfield- the field numbersym- the symmetry describing the affect of orientation on the access of the data
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionGetFieldSym(), PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFieldSym
PETSc.LibPETSc.PetscSectionSetFromOptions — Method
PetscSectionSetFromOptions(petsclib::PetscLibType, s::PetscSection)sets parameters in a PetscSection from the options database
Collective
Input Parameter:
s- thePetscSection
Options Database Key:
-petscsection_point_major-PETSC_TRUEfor point-major order
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetFromOptions
PETSc.LibPETSc.PetscSectionSetIncludesConstraints — Method
PetscSectionSetIncludesConstraints(petsclib::PetscLibType, s::PetscSection, includesConstraints::PetscBool)Sets the flag indicating if constrained dofs are to be included when computing offsets
Not Collective
Input Parameters:
s- thePetscSectionincludesConstraints- the flag indicating if constrained dofs are to be included when computing offsets
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetIncludesConstraints()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetIncludesConstraints
PETSc.LibPETSc.PetscSectionSetNumFields — Method
PetscSectionSetNumFields(petsclib::PetscLibType, s::PetscSection, numFields::PetscInt)Sets the number of fields in a PetscSection
Not Collective
Input Parameters:
s- thePetscSectionnumFields- the number of fields
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetNumFields(), PetscSectionSetChart(), PetscSectionReset()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetNumFields
PETSc.LibPETSc.PetscSectionSetOffset — Method
PetscSectionSetOffset(petsclib::PetscLibType, s::PetscSection, point::PetscInt, offset::PetscInt)Set the offset into an array or Vec for the dof associated with the given point.
Not Collective
Input Parameters:
s- thePetscSectionpoint- the pointoffset- the offset, these values may be negative indicating the values are off process
Level: developer
See also: PetscSection, PetscSection, PetscSectionGetFieldOffset(), PetscSectionCreate(), PetscSectionSetUp()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetOffset
PETSc.LibPETSc.PetscSectionSetPermutation — Method
PetscSectionSetPermutation(petsclib::PetscLibType, s::PetscSection, perm::AbstractIS)Sets a permutation of the chart for this section, [0, pEnd - pStart), which determines the order to store the PetscSection information
Not Collective
Input Parameters:
s- thePetscSectionperm- the permutation of points
Level: intermediate
See also: IS, PetscSection, PetscSectionSetUp(), PetscSectionGetPermutation(), PetscSectionPermute(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetPermutation
PETSc.LibPETSc.PetscSectionSetPointMajor — Method
PetscSectionSetPointMajor(petsclib::PetscLibType, s::PetscSection, pm::PetscBool)Sets the flag for dof ordering, PETSC_TRUE for point major, otherwise it will be field major
Not Collective
Input Parameters:
s- thePetscSectionpm- the flag for point major ordering
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionGetPointMajor(), PetscSectionSetPermutation()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetPointMajor
PETSc.LibPETSc.PetscSectionSetSym — Method
PetscSectionSetSym(petsclib::PetscLibType, section::PetscSection, sym::PetscSectionSym)Set the symmetries for the data referred to by the section
Collective
Input Parameters:
section- the section describing data layoutsym- the symmetry describing the affect of orientation on the access of the data
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionGetSym(), PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetSym
PETSc.LibPETSc.PetscSectionSetUp — Method
PetscSectionSetUp(petsclib::PetscLibType, s::PetscSection)Calculate offsets based upon the number of degrees of freedom for each point in preparation for use of the PetscSection
Not Collective
Input Parameter:
s- thePetscSection
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionSetPermutation()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetUp
PETSc.LibPETSc.PetscSectionSetUpBC — Method
PetscSectionSetUpBC(petsclib::PetscLibType, s::PetscSection)Setup the subsections describing boundary conditions.
Not Collective
Input Parameter:
s- thePetscSection
Level: advanced
See also: PetscSection, PetscSection, PetscSectionSetUp(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetUpBC
PETSc.LibPETSc.PetscSectionSetUseFieldOffsets — Method
PetscSectionSetUseFieldOffsets(petsclib::PetscLibType, s::PetscSection, flg::PetscBool)Set the flag to use field offsets directly in a global section, rather than just the point offset
Not Collective
Input Parameters:
s- the globalPetscSectionflg- the flag
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionGetUseFieldOffsets(), PetscSectionSetChart(), PetscSectionCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSetUseFieldOffsets
PETSc.LibPETSc.PetscSectionSymCopy — Method
PetscSectionSymCopy(petsclib::PetscLibType, sym::PetscSectionSym, nsym::PetscSectionSym)Copy the symmetries, assuming that the point structure is compatible
Not Collective
Input Parameter:
sym- thePetscSectionSym
Output Parameter:
nsym- the equivalent symmetries
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym(), PetscSectionSymLabelSetStratum(), PetscSectionGetPointSyms()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymCopy
PETSc.LibPETSc.PetscSectionSymCreate — Method
sym::PetscSectionSym = PetscSectionSymCreate(petsclib::PetscLibType, comm::MPI_Comm)Creates an empty PetscSectionSym object.
Collective
Input Parameter:
comm- the MPI communicator
Output Parameter:
sym- pointer to the new set of symmetries
Level: developer
See also: PetscSection, PetscSection, PetscSectionSym, PetscSectionSymDestroy()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymCreate
PETSc.LibPETSc.PetscSectionSymCreateLabel — Method
sym::PetscSectionSym = PetscSectionSymCreateLabel(petsclib::PetscLibType, comm::MPI_Comm, label::DMLabel)Create a section symmetry that assigns one symmetry to each stratum of a label
Collective
Input Parameters:
comm- the MPI communicator for the new symmetrylabel- the label defining the strata
Output Parameter:
sym- the section symmetries
Level: developer
See also: DMLabel, DM, PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym(), PetscSectionSymLabelSetStratum(), PetscSectionGetPointSyms()
External Links
- PETSc Manual:
DMLabel/PetscSectionSymCreateLabel
PETSc.LibPETSc.PetscSectionSymDestroy — Method
PetscSectionSymDestroy(petsclib::PetscLibType, sym::Union{PetscSectionSym, Ref{PetscSectionSym}})Destroys a section symmetry.
Collective
Input Parameter:
sym- the section symmetry
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymDestroy
PETSc.LibPETSc.PetscSectionSymDistribute — Method
dsym::PetscSectionSym = PetscSectionSymDistribute(petsclib::PetscLibType, sym::PetscSectionSym, migrationSF::PetscSF)Distribute the symmetries in accordance with the input PetscSF
Collective
Input Parameters:
sym- thePetscSectionSymmigrationSF- the distribution map from roots to leaves
Output Parameter:
dsym- the redistributed symmetries
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym(), PetscSectionSymLabelSetStratum(), PetscSectionGetPointSyms()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymDistribute
PETSc.LibPETSc.PetscSectionSymGetType — Method
type::String = PetscSectionSymGetType(petsclib::PetscLibType, sym::PetscSectionSym)Gets the section symmetry type name (as a string) from the PetscSectionSym.
Not Collective
Input Parameter:
sym- The section symmetry
Output Parameter:
type- The index set type name
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSymType, PetscSectionSymSetType(), PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymGetType
PETSc.LibPETSc.PetscSectionSymLabelGetStratum — Method
size::PetscInt,minOrient::PetscInt,maxOrient::PetscInt,perms::Ptr{PetscInt},rots::Ptr{PetscScalar} = PetscSectionSymLabelGetStratum(petsclib::PetscLibType, sym::PetscSectionSym, stratum::PetscInt)get the symmetries for the orientations of a stratum
Logically Collective
Input Parameters:
sym- the section symmetriesstratum- the stratum value in the label that we are assigning symmetries for
Output Parameters:
size- the number of dofs for points in thestratumof the labelminOrient- the smallest orientation for a point in thisstratummaxOrient- one greater than the largest orientation for a ppoint in thisstratum(i.e., orientations are in the range [minOrient,maxOrient))perms-NULLif there are no permutations, or (maxOrient-minOrient) permutations, one for each orientation. ANULLpermutation is the identityrots-NULLif there are no rotations, or (maxOrient-minOrient) sets of rotations, one for each orientation. ANULLset of orientations is the identity
Level: developer
See also: DMLabel, DM, PetscSectionSymLabelSetStratum(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetPointSyms(), PetscSectionSymCreateLabel()
External Links
- PETSc Manual:
DMLabel/PetscSectionSymLabelGetStratum
PETSc.LibPETSc.PetscSectionSymLabelSetLabel — Method
PetscSectionSymLabelSetLabel(petsclib::PetscLibType, sym::PetscSectionSym, label::DMLabel)set the label whose strata will define the points that receive symmetries
Logically
Input Parameters:
sym- the section symmetrieslabel- theDMLabeldescribing the types of points
Level: developer:
See also: DMLabel, DM, PetscSectionSymLabelSetStratum(), PetscSectionSymCreateLabel(), PetscSectionGetPointSyms()
External Links
- PETSc Manual:
DMLabel/PetscSectionSymLabelSetLabel
PETSc.LibPETSc.PetscSectionSymLabelSetStratum — Method
PetscSectionSymLabelSetStratum(petsclib::PetscLibType, sym::PetscSectionSym, stratum::PetscInt, size::PetscInt, minOrient::PetscInt, maxOrient::PetscInt, mode::PetscCopyMode, perms::PetscInt, rots::PetscScalar)set the symmetries for the orientations of a stratum
Logically
Input Parameters:
sym- the section symmetriesstratum- the stratum value in the label that we are assigning symmetries forsize- the number of dofs for points in thestratumof the labelminOrient- the smallest orientation for a point in thisstratummaxOrient- one greater than the largest orientation for a point in thisstratum(i.e., orientations are in the range [minOrient,maxOrient))mode- howsymshould copy thepermsandrotsarraysperms-NULLif there are no permutations, or (maxOrient-minOrient) permutations, one for each orientation. ANULLpermutation is the identityrots-NULLif there are no rotations, or (maxOrient-minOrient) sets of rotations, one for each orientation. ANULLset of orientations is the identity
Level: developer
See also: DMLabel, DM, PetscSectionSymLabelGetStratum(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetPointSyms(), PetscSectionSymCreateLabel()
External Links
- PETSc Manual:
DMLabel/PetscSectionSymLabelSetStratum
PETSc.LibPETSc.PetscSectionSymRegister — Method
PetscSectionSymRegister(petsclib::PetscLibType, sname::String, fnc::external)Registers a new section symmetry implementation
Not Collective, No Fortran Support
Input Parameters:
sname- The name of a new user-defined creation routinefunction- The creation routine itself
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSymType, PetscSectionSymCreate(), PetscSectionSymSetType()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymRegister
PETSc.LibPETSc.PetscSectionSymSetType — Method
PetscSectionSymSetType(petsclib::PetscLibType, sym::PetscSectionSym, method::String)Builds a PetscSectionSym, for a particular implementation.
Collective
Input Parameters:
sym- The section symmetry objectmethod- The name of the section symmetry type
Level: developer
See also: PetscSection, PetscSectionSym, PetscSectionSymType, PetscSectionSymGetType(), PetscSectionSymCreate()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymSetType
PETSc.LibPETSc.PetscSectionSymView — Method
PetscSectionSymView(petsclib::PetscLibType, sym::PetscSectionSym, viewer::PetscViewer)Displays a section symmetry
Collective
Input Parameters:
sym- the index setviewer- viewer used to display the set, for examplePETSC_VIEWER_STDOUT_SELF.
Level: developer
See also: PetscSectionSym, PetscViewer, PetscViewerASCIIOpen()
External Links
- PETSc Manual:
PetscSection/PetscSectionSymView
PETSc.LibPETSc.PetscSectionVecNorm — Method
PetscSectionVecNorm(petsclib::PetscLibType, s::PetscSection, gs::PetscSection, x::AbstractPetscVec, type::NormType, val::Vector{PetscReal})Computes the vector norm of each field
Input Parameters:
s- the local Sectiongs- the global sectionx- the vectortype- one ofNORM_1,NORM_2,NORM_INFINITY.
Output Parameter:
val- the array of norms
Level: intermediate
See also: VecNorm(), PetscSectionCreate()
External Links
- PETSc Manual:
Vec/PetscSectionVecNorm
PETSc.LibPETSc.PetscSectionVecView — Method
PetscSectionVecView(petsclib::PetscLibType, s::PetscSection, v::AbstractPetscVec, viewer::PetscViewer)View a vector, using the section to structure the values
Collective
Input Parameters:
s- the organizingPetscSectionv- theVecviewer- thePetscViewer
Level: developer
See also: PetscSection, PetscViewer, PetscSectionCreate(), VecSetValuesSection(), PetscSectionArrayView()
External Links
- PETSc Manual:
Vec/PetscSectionVecView
PETSc.LibPETSc.PetscSectionView — Method
PetscSectionView(petsclib::PetscLibType, s::PetscSection, viewer::PetscViewer)Views a PetscSection
Collective
Input Parameters:
s- thePetscSectionobject to viewviewer- the viewer
Level: beginner
See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy(), PetscSectionLoad(), PetscViewer
External Links
- PETSc Manual:
PetscSection/PetscSectionView
PETSc.LibPETSc.PetscSectionViewFromOptions — Method
PetscSectionViewFromOptions(petsclib::PetscLibType, A::PetscSection, obj, name::String)View the PetscSection based on values in the options database
Collective
Input Parameters:
A- thePetscSectionobject to viewobj- Optional object that provides the options prefix used for the optionsname- command line option
Options Database Key:
-name [viewertype][:...]- option name and values. SeePetscObjectViewFromOptions()for the possible arguments
Level: intermediate
See also: PetscSection, PetscSection, PetscSectionView, PetscObjectViewFromOptions(), PetscSectionCreate(), PetscSectionView()
External Links
- PETSc Manual:
PetscSection/PetscSectionViewFromOptions