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 - the PetscSection
  • point - the point
  • numDof - the number of additional dof which are fixed by constraints

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionAddDof(), PetscSectionGetConstraintDof(), PetscSectionCreate()

External Links

source
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 - the PetscSection
  • point - the point
  • numDof - the number of additional dof

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionSetDof(), PetscSectionCreate()

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field
  • numDof - the number of additional dof which are fixed by constraints

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionAddDof(), PetscSectionGetFieldConstraintDof(), PetscSectionCreate()

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field
  • numDof - the number of dof

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetFieldDof(), PetscSectionGetFieldDof(), PetscSectionCreate()

External Links

source
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 organizing PetscSection
  • array - the array of values
  • data_type - the PetscDataType of the array
  • viewer - the PetscViewer

Level: developer

See also: PetscSection, PetscViewer, PetscSectionCreate(), VecSetValuesSection(), PetscSectionVecView()

External Links

source
PETSc.LibPETSc.PetscSectionClone — Method
newSection::PetscSection = PetscSectionClone(petsclib::PetscLibType, section::PetscSection)

Creates a shallow (if possible) copy of the PetscSection

Collective

Input Parameter:

  • section - the PetscSection

Output Parameter:

  • newSection - the copy

Level: beginner

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy(), PetscSectionCopy()

External Links

source
PETSc.LibPETSc.PetscSectionCompare — Method
congruent::PetscBool = PetscSectionCompare(petsclib::PetscLibType, s1::PetscSection, s2::PetscSection)

Compares two sections

Collective

Input Parameters:

  • s1 - the first PetscSection
  • s2 - the second PetscSection

Output Parameter:

  • congruent - PETSC_TRUE if the two sections are congruent, PETSC_FALSE otherwise

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionCopy(), PetscSectionClone()

External Links

source
PETSc.LibPETSc.PetscSectionCopy — Method
PetscSectionCopy(petsclib::PetscLibType, section::PetscSection, newSection::PetscSection)

Creates a shallow (if possible) copy of the PetscSection

Collective

Input Parameter:

  • section - the PetscSection

Output Parameter:

  • newSection - the copy

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy()

External Links

source
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 communicator
  • s - pointer to the section

Level: beginner

See also: PetscSection, PetscSection, PetscSectionSetChart(), PetscSectionDestroy(), PetscSectionCreateGlobalSection()

External Links

source
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 - the PetscSection
  • len - the number of components
  • comps - the component numbers

Output Parameter:

  • subs - the subsection

Level: advanced

See also: PetscSection, PetscSection, PetscSectionCreateSupersection(), PetscSectionCreate()

External Links

source
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 - The PetscSection for the local field layout
  • sf - The PetscSF describing parallel layout of the section points (leaves are unowned local points)
  • usePermutation - By default this is PETSC_TRUE, meaning any permutation of the local section is transferred to the global section
  • includeConstraints - By default this is PETSC_FALSE, meaning that the global field vector will not possess constrained dofs
  • localOffsets - If PETSC_TRUE, use local rather than global offsets for the points

Output Parameter:

  • gsection - The PetscSection for the global field layout

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionCreateGlobalSectionCensored()

External Links

source
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 - The PetscSection for the local field layout
  • sf - The PetscSF describing parallel layout of the section points
  • includeConstraints - By default this is PETSC_FALSE, meaning that the global vector will not possess constrained dofs
  • numExcludes - The number of exclusion ranges, this must have the same value on all MPI processes
  • excludes - An array [start0, end0, start1, end1, ...] where there are numExcludes pairs and must have the same values on all MPI processes

Output Parameter:

  • gsection - The PetscSection for the global field layout

Level: advanced

See also: PetscSection, PetscSection, PetscSectionCreate()

External Links

source
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 - The PetscSection for the local field layout
  • sf - The PetscSF describing parallel layout of the section points
  • includeConstraints - By default this is PETSC_FALSE, meaning that the global field vector will not possess constrained dofs
  • label - The label specifying the points
  • labelValue - The label stratum specifying the points

Output Parameter:

  • gsection - The PetscSection for the global field layout

Level: developer

See also: DMLabel, DM, PetscSectionCreate()

External Links

source
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 - the PetscSection
  • subpointMap - 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

source
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 - the PetscSection
  • subpointIS - 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

source
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 - the PetscSection
  • len - the number of subfields
  • fields - the subfield numbers

Output Parameter:

  • subs - the subsection

Level: advanced

See also: PetscSection, PetscSection, PetscSectionCreateSupersection(), PetscSectionCreate()

External Links

source
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 sections
  • len - the number of input sections

Output Parameter:

  • supers - the supersection

Level: advanced

See also: PetscSection, PetscSection, PetscSectionCreateSubsection(), PetscSectionCreate()

External Links

source
PETSc.LibPETSc.PetscSectionDestroy — Method
PetscSectionDestroy(petsclib::PetscLibType, s::Union{PetscSection, Ref{PetscSection}})

Frees a PetscSection

Not Collective

Input Parameter:

  • s - the PetscSection

Level: beginner

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionReset()

External Links

source
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 - the PetscSection

Output Parameter:

  • blockStarts - The PetscBT with a 1 for each point that begins a block

See also: IS, PetscSection, PetscSectionSetBlockStarts(), PetscSectionCreate(), DMCreateMatrix(), MatSetVariableBlockSizes()

External Links

source
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 - the PetscSection

Output Parameters:

  • pStart - the first point
  • pEnd - one past the last point

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetChart(), PetscSectionCreate()

External Links

source
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 - The PetscSection
  • obj - A PetscObject which serves as the key for this index

Output Parameters:

  • clSection - PetscSection giving the size of the closure of each point
  • clPoints - IS giving the points in each closure

Level: advanced

See also: PetscSection, PetscSectionSetClosureIndex(), DMPlexCreateClosureIndex()

External Links

source
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 - The PetscSection
  • obj - A PetscObject which serves as the key for this index (usually a DM)
  • depth - Depth stratum on which to obtain closure permutation
  • clSize - 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

source
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 - The PetscSection
  • obj - A PetscObject which serves as the key for this index (usually a DM)
  • depth - Depth stratum on which to obtain closure permutation
  • clSize - 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

source
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 - the PetscSection
  • field - the field number
  • comp - the component number

Output Parameter:

  • compName - the component name

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetFieldName(), PetscSectionSetNumFields(), PetscSectionGetNumFields(), PetscSectionSetComponentName(), PetscSectionSetFieldName(), PetscSectionGetFieldComponents(), PetscSectionSetFieldComponents()

External Links

source
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 - the PetscSection

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

source
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 - the PetscSection
  • point - 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

source
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 - The PetscSection
  • point - The point

Output Parameter:

  • indices - The constrained dofs

Level: intermediate

See also: PetscSection, PetscSectionSetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection

External Links

source
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 - the PetscSection
  • point - the point

Output Parameter:

  • numDof - the number of dof

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetDof(), PetscSectionCreate()

External Links

source
PETSc.LibPETSc.PetscSectionGetField — Method
subs::PetscSection = PetscSectionGetField(petsclib::PetscLibType, s::PetscSection, field::PetscInt)

Get the PetscSection associated with a single field

Input Parameters:

  • s - The PetscSection
  • field - The field number

Output Parameter:

  • subs - The PetscSection for the given field, note the chart of subs is not set

Level: intermediate

See also: PetscSection, PetscSection, IS, PetscSectionSetNumFields()

External Links

source
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 - the PetscSection
  • field - the field number

Output Parameter:

  • numComp - the number of field components

Level: advanced

See also: PetscSection, PetscSection, PetscSectionSetFieldComponents(), PetscSectionGetNumFields(), PetscSectionSetComponentName(), PetscSectionGetComponentName()

External Links

source
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 - the PetscSection
  • point - the point
  • field - 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

source
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 - The PetscSection
  • field - The field number
  • point - The point

Output Parameter:

  • indices - The constrained dofs sorted in ascending order, the length is returned by PetscSectionGetConstraintDof().

Level: intermediate

See also: PetscSection, PetscSectionSetFieldConstraintIndices(), PetscSectionGetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field

Output Parameter:

  • numDof - the number of dof

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetFieldDof(), PetscSectionCreate()

External Links

source
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 - the PetscSection
  • field - the field number

Output Parameter:

  • fieldName - the field name

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetFieldName(), PetscSectionSetNumFields(), PetscSectionGetNumFields()

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field

Output Parameter:

  • offset - the offset

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionCreate(), PetscSectionGetFieldPointOffset()

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field

Output Parameter:

  • offset - the offset

Level: advanced

See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionCreate(), PetscSectionGetFieldOffset()

External Links

source
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 section
  • field - the field of the section
  • numPoints - the number of points
  • points - 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 (or NULL if there is no symmetry or the permutation is the identity).
  • rots - The field rotations symmetries for the given orientations (or NULL if there is no symmetry or the rotations are all

identity).

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionGetPointSyms(), PetscSectionRestoreFieldPointSyms()

External Links

source
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 layout
  • field - 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

source
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 - the PetscSection

Output Parameter:

  • includesConstraints - the flag indicating if constrained dofs were included when computing offsets

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetIncludesConstraints()

External Links

source
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 - the PetscSection

Output Parameter:

  • maxDof - the maximum dof

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetDof(), PetscSectionSetDof(), PetscSectionAddDof(), PetscSectionCreate()

External Links

source
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 - the PetscSection

Output Parameter:

  • numFields - the number of fields defined, or 0 if none were defined

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetNumFields()

External Links

source
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 - the PetscSection
  • point - the point

Output Parameter:

  • offset - the offset

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetFieldOffset(), PetscSectionCreate(), PetscSectionSetPointMajor()

External Links

source
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 - the PetscSection

Output Parameters:

  • start - the minimum offset
  • end - one more than the maximum offset

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetOffset(), PetscSectionCreate()

External Links

source
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 - the PetscSection

Output Parameter:

  • perm - The permutation as an IS

Level: intermediate

See also: IS, PetscSection, PetscSectionSetPermutation(), PetscSectionCreate()

External Links

source
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 - The MPI_Comm
  • s - The PetscSection

Output Parameter:

  • layout - The point layout for the data that defines the section

Level: advanced

See also: PetscSection, PetscSection, PetscSectionGetValueLayout(), PetscSectionCreate()

External Links

source
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 - the PetscSection

Output Parameter:

  • pm - the flag for point major ordering

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetPointMajor()

External Links

source
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 section
  • numPoints - the number of points
  • points - 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 (or NULL if there is no symmetry or the permutation is the identity).
  • rots - The field rotations symmetries for the given orientations (or NULL if 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

source
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 - the PetscSection

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

source
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 by PetscSectionSetSym()

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionSetSym(), PetscSectionSymCreate()

External Links

source
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 global PetscSection

Output Parameter:

  • flg - the flag

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionSetChart(), PetscSectionCreate()

External Links

source
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 - The MPI_Comm
  • s - The PetscSection

Output Parameter:

  • layout - The dof layout for the section

Level: advanced

See also: PetscSection, PetscSection, PetscSectionGetPointLayout(), PetscSectionCreate()

External Links

source
PETSc.LibPETSc.PetscSectionHasConstraints — Method
hasConstraints::PetscBool = PetscSectionHasConstraints(petsclib::PetscLibType, s::PetscSection)

Determine whether a PetscSection has constrained dofs

Not Collective

Input Parameter:

  • s - The PetscSection

Output Parameter:

  • hasConstraints - flag indicating that the section has constrained dofs

Level: intermediate

See also: PetscSection, PetscSectionSetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection

External Links

source
PETSc.LibPETSc.PetscSectionLoad — Method
PetscSectionLoad(petsclib::PetscLibType, s::PetscSection, viewer::PetscViewer)

Loads a PetscSection

Collective

Input Parameters:

  • s - the PetscSection object to load
  • viewer - the viewer

Level: beginner

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy(), PetscSectionView()

External Links

source
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 - The PetscSection object
  • permutation - The point permutation, old point p becomes new point perm[p]

Output Parameter:

  • sectionNew - The permuted PetscSection

Level: intermediate

See also: PetscSection, IS, PetscSection, MatPermute(), PetscSectionSetPermutation()

External Links

source
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 - the PetscSection

Level: beginner

See also: PetscSection, PetscSection, PetscSectionCreate()

External Links

source
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 section
  • field - the field number
  • numPoints - the number of points
  • points - 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 conclusion
  • rots - 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

source
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 section
  • numPoints - the number of points
  • points - 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 conclusion
  • rots - The field rotations symmetries for the given orientations: set to NULL at conclusion

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionGetPointSyms(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym()

External Links

source
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 - the PetscSection
  • blockStarts - The PetscBT with a 1 for each point that begins a block

Level: intermediate

See also: IS, PetscSection, PetscSectionGetBlockStarts(), PetscSectionCreate(), DMCreateMatrix(), MatSetVariableBlockSizes()

External Links

source
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 - the PetscSection
  • pStart - the first point
  • pEnd - one past the last point, pStart \le pEnd

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetChart(), PetscSectionCreate(), PetscSectionSetNumFields()

External Links

source
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 - The PetscSection
  • obj - A PetscObject which serves as the key for this index
  • clSection - PetscSection giving the size of the closure of each point
  • clPoints - IS giving the points in each closure

Level: advanced

See also: PetscSection, PetscSection, PetscSectionGetClosureIndex(), DMPlexCreateClosureIndex()

External Links

source
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 - The PetscSection
  • obj - A PetscObject which serves as the key for this index (usually a DM)
  • depth - Depth of points on which to apply the given permutation
  • perm - Permutation of the cell dof closure

Level: intermediate

See also: PetscSection, PetscSection, IS, PetscSectionGetClosurePermutation(), PetscSectionGetClosureIndex(), DMPlexCreateClosureIndex(), PetscCopyMode

External Links

source
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 - the PetscSection
  • field - the field number
  • comp - the component number
  • compName - the component name

Level: advanced

See also: PetscSection, PetscSection, PetscSectionGetComponentName(), PetscSectionSetNumFields(), PetscSectionGetNumFields(), PetscSectionSetFieldName(), PetscSectionGetFieldComponents(), PetscSectionSetFieldComponents()

External Links

source
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 - the PetscSection
  • point - the point
  • numDof - the number of dof which are fixed by constraints

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetDof(), PetscSectionGetConstraintDof(), PetscSectionCreate()

External Links

source
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 - The PetscSection
  • point - The point
  • indices - The constrained dofs

Level: intermediate

See also: PetscSection, PetscSectionGetConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection

External Links

source
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 - the PetscSection
  • point - the point
  • numDof - 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

source
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 - the PetscSection
  • field - the field number
  • numComp - the number of field components

Level: advanced

See also: PetscSection, PetscSection, PetscSectionGetFieldComponents(), PetscSectionSetComponentName(), PetscSectionGetComponentName(), PetscSectionGetNumFields()

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field
  • numDof - the number of dof which are fixed by constraints

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionSetDof(), PetscSectionGetFieldConstraintDof(), PetscSectionCreate()

External Links

source
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 - The PetscSection
  • point - The point
  • field - The field number
  • indices - The constrained dofs

Level: intermediate

See also: PetscSection, PetscSectionSetConstraintIndices(), PetscSectionGetFieldConstraintIndices(), PetscSectionGetConstraintDof(), PetscSection

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field
  • numDof - 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

source
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 - the PetscSection
  • field - the field number
  • fieldName - the field name

Level: intermediate

See also: PetscSection, PetscSectionGetFieldName(), PetscSectionSetNumFields(), PetscSectionGetNumFields()

External Links

source
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 - the PetscSection
  • point - the point
  • field - the field
  • offset - 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

source
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 layout
  • field - the field number
  • sym - the symmetry describing the affect of orientation on the access of the data

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionGetFieldSym(), PetscSectionSymCreate()

External Links

source
PETSc.LibPETSc.PetscSectionSetFromOptions — Method
PetscSectionSetFromOptions(petsclib::PetscLibType, s::PetscSection)

sets parameters in a PetscSection from the options database

Collective

Input Parameter:

  • s - the PetscSection

Options Database Key:

  • -petscsection_point_major - PETSC_TRUE for point-major order

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy()

External Links

source
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 - the PetscSection
  • includesConstraints - the flag indicating if constrained dofs are to be included when computing offsets

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetIncludesConstraints()

External Links

source
PETSc.LibPETSc.PetscSectionSetNumFields — Method
PetscSectionSetNumFields(petsclib::PetscLibType, s::PetscSection, numFields::PetscInt)

Sets the number of fields in a PetscSection

Not Collective

Input Parameters:

  • s - the PetscSection
  • numFields - the number of fields

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetNumFields(), PetscSectionSetChart(), PetscSectionReset()

External Links

source
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 - the PetscSection
  • point - the point
  • offset - the offset, these values may be negative indicating the values are off process

Level: developer

See also: PetscSection, PetscSection, PetscSectionGetFieldOffset(), PetscSectionCreate(), PetscSectionSetUp()

External Links

source
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 - the PetscSection
  • perm - the permutation of points

Level: intermediate

See also: IS, PetscSection, PetscSectionSetUp(), PetscSectionGetPermutation(), PetscSectionPermute(), PetscSectionCreate()

External Links

source
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 - the PetscSection
  • pm - the flag for point major ordering

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionGetPointMajor(), PetscSectionSetPermutation()

External Links

source
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 layout
  • sym - the symmetry describing the affect of orientation on the access of the data

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionGetSym(), PetscSectionSymCreate()

External Links

source
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 - the PetscSection

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionSetPermutation()

External Links

source
PETSc.LibPETSc.PetscSectionSetUpBC — Method
PetscSectionSetUpBC(petsclib::PetscLibType, s::PetscSection)

Setup the subsections describing boundary conditions.

Not Collective

Input Parameter:

  • s - the PetscSection

Level: advanced

See also: PetscSection, PetscSection, PetscSectionSetUp(), PetscSectionCreate()

External Links

source
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 global PetscSection
  • flg - the flag

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionGetUseFieldOffsets(), PetscSectionSetChart(), PetscSectionCreate()

External Links

source
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 - the PetscSectionSym

Output Parameter:

  • nsym - the equivalent symmetries

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym(), PetscSectionSymLabelSetStratum(), PetscSectionGetPointSyms()

External Links

source
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

source
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 symmetry
  • label - the label defining the strata

Output Parameter:

  • sym - the section symmetries

Level: developer

See also: DMLabel, DM, PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym(), PetscSectionSymLabelSetStratum(), PetscSectionGetPointSyms()

External Links

source
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 - the PetscSectionSym
  • migrationSF - 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

source
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

source
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 symmetries
  • stratum - the stratum value in the label that we are assigning symmetries for

Output Parameters:

  • size - the number of dofs for points in the stratum of the label
  • minOrient - the smallest orientation for a point in this stratum
  • maxOrient - one greater than the largest orientation for a ppoint in this stratum (i.e., orientations are in the range [minOrient, maxOrient))
  • perms - NULL if there are no permutations, or (maxOrient - minOrient) permutations, one for each orientation. A NULL permutation is the identity
  • rots - NULL if there are no rotations, or (maxOrient - minOrient) sets of rotations, one for each orientation. A NULL set of orientations is the identity

Level: developer

See also: DMLabel, DM, PetscSectionSymLabelSetStratum(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetPointSyms(), PetscSectionSymCreateLabel()

External Links

source
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 symmetries
  • label - the DMLabel describing the types of points

Level: developer:

See also: DMLabel, DM, PetscSectionSymLabelSetStratum(), PetscSectionSymCreateLabel(), PetscSectionGetPointSyms()

External Links

source
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 symmetries
  • stratum - the stratum value in the label that we are assigning symmetries for
  • size - the number of dofs for points in the stratum of the label
  • minOrient - the smallest orientation for a point in this stratum
  • maxOrient - one greater than the largest orientation for a point in this stratum (i.e., orientations are in the range [minOrient, maxOrient))
  • mode - how sym should copy the perms and rots arrays
  • perms - NULL if there are no permutations, or (maxOrient - minOrient) permutations, one for each orientation. A NULL permutation is the identity
  • rots - NULL if there are no rotations, or (maxOrient - minOrient) sets of rotations, one for each orientation. A NULL set of orientations is the identity

Level: developer

See also: DMLabel, DM, PetscSectionSymLabelGetStratum(), PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetPointSyms(), PetscSectionSymCreateLabel()

External Links

source
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 routine
  • function - The creation routine itself

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionSymType, PetscSectionSymCreate(), PetscSectionSymSetType()

External Links

source
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 object
  • method - The name of the section symmetry type

Level: developer

See also: PetscSection, PetscSectionSym, PetscSectionSymType, PetscSectionSymGetType(), PetscSectionSymCreate()

External Links

source
PETSc.LibPETSc.PetscSectionSymView — Method
PetscSectionSymView(petsclib::PetscLibType, sym::PetscSectionSym, viewer::PetscViewer)

Displays a section symmetry

Collective

Input Parameters:

  • sym - the index set
  • viewer - viewer used to display the set, for example PETSC_VIEWER_STDOUT_SELF.

Level: developer

See also: PetscSectionSym, PetscViewer, PetscViewerASCIIOpen()

External Links

source
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 Section
  • gs - the global section
  • x - the vector
  • type - one of NORM_1, NORM_2, NORM_INFINITY.

Output Parameter:

  • val - the array of norms

Level: intermediate

See also: VecNorm(), PetscSectionCreate()

External Links

source
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 organizing PetscSection
  • v - the Vec
  • viewer - the PetscViewer

Level: developer

See also: PetscSection, PetscViewer, PetscSectionCreate(), VecSetValuesSection(), PetscSectionArrayView()

External Links

source
PETSc.LibPETSc.PetscSectionView — Method
PetscSectionView(petsclib::PetscLibType, s::PetscSection, viewer::PetscViewer)

Views a PetscSection

Collective

Input Parameters:

  • s - the PetscSection object to view
  • viewer - the viewer

Level: beginner

See also: PetscSection, PetscSection, PetscSectionCreate(), PetscSectionDestroy(), PetscSectionLoad(), PetscViewer

External Links

source
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 - the PetscSection object to view
  • obj - Optional object that provides the options prefix used for the options
  • name - command line option

Options Database Key:

  • -name [viewertype][:...] - option name and values. See PetscObjectViewFromOptions() for the possible arguments

Level: intermediate

See also: PetscSection, PetscSection, PetscSectionView, PetscObjectViewFromOptions(), PetscSectionCreate(), PetscSectionView()

External Links

source