template<class Scalar>
Rodin::Assembly::ConstraintMap class

Read-only expansion map for value and identification constraints.

Identification constraints are stored as rows of the expansion map $ x_s = \sum_k c_k x_{m_k} + d_s $ . For unconstrained DOFs, expand() returns the identity row { { i, 1 } }.

The map supports canonicalization of identification constraints:

  • duplicate masters are merged;
  • zero coefficients are pruned;
  • self-references are removed algebraically;
  • identity constraints are ignored;
  • constraints such as $ x_s = c x_s + d_s $ , $ c \ne 1 $ , are converted to fixed constraints;
  • transitive identifications are flattened by finalize.

After calling finalize, this object can be shared by OpenMP assembly loops as a read-only expansion map.

Public types

struct Entry
One master DOF contribution in an expansion row.
using Expansion = std::vector<Entry>
Expansion row for a constrained DOF.

Constructors, destructors, conversion operators

ConstraintMap(size_t size) explicit
Constructs an identity constraint map.

Public functions

void reset(size_t size)
Resets the map to the identity expansion on size DOFs.
auto size() const -> size_t
Gets the number of DOFs represented by the map.
auto isFixed(Index i) const -> bool
Tests whether a DOF is fixed to a value.
auto isIdentified(Index i) const -> bool
Tests whether a DOF is identified with master DOFs.
auto getFixedValue(Index i) const -> Scalar
Gets the prescribed value for a fixed DOF.
auto expand(Index i) const -> const Expansion&
Expands a DOF into its master DOF row.
auto getIdentifiedRows() const -> const std::vector<Index>&
Gets the indices of rows carrying identification constraints.
auto getIdentificationValue(Index i) const -> Scalar
Gets the affine defect value for an identified DOF.
void setFixed(Index i, Scalar value)
Marks a DOF as fixed to a prescribed value.
template<class Entries>
void setIdentification(Index slave, const Entries& entries)
Sets a homogeneous identification row.
template<class Entries>
void setIdentification(Index slave, const Entries& entries, Scalar value)
Sets an affine identification row.
void finalize()
Flattens transitive identification constraints.

Function documentation

template<class Scalar>
Rodin::Assembly::ConstraintMap<Scalar>::ConstraintMap(size_t size) explicit

Constructs an identity constraint map.

Parameters
size Number of DOFs represented by the map.

template<class Scalar>
void Rodin::Assembly::ConstraintMap<Scalar>::reset(size_t size)

Resets the map to the identity expansion on size DOFs.

Parameters
size Number of DOFs represented by the map.

template<class Scalar>
size_t Rodin::Assembly::ConstraintMap<Scalar>::size() const

Gets the number of DOFs represented by the map.

Returns Number of expansion rows.

template<class Scalar>
bool Rodin::Assembly::ConstraintMap<Scalar>::isFixed(Index i) const

Tests whether a DOF is fixed to a value.

Parameters
i DOF index.

template<class Scalar>
bool Rodin::Assembly::ConstraintMap<Scalar>::isIdentified(Index i) const

Tests whether a DOF is identified with master DOFs.

Parameters
i DOF index.

template<class Scalar>
Scalar Rodin::Assembly::ConstraintMap<Scalar>::getFixedValue(Index i) const

Gets the prescribed value for a fixed DOF.

Parameters
i Fixed DOF index.
Returns Prescribed scalar value.

template<class Scalar>
const Expansion& Rodin::Assembly::ConstraintMap<Scalar>::expand(Index i) const

Expands a DOF into its master DOF row.

Parameters
i DOF index.
Returns Expansion row for i.

template<class Scalar>
const std::vector<Index>& Rodin::Assembly::ConstraintMap<Scalar>::getIdentifiedRows() const

Gets the indices of rows carrying identification constraints.

Returns Identified slave DOF indices.

template<class Scalar>
Scalar Rodin::Assembly::ConstraintMap<Scalar>::getIdentificationValue(Index i) const

Gets the affine defect value for an identified DOF.

Parameters
i Identified slave DOF index.
Returns Constant term in the identification row.

template<class Scalar>
void Rodin::Assembly::ConstraintMap<Scalar>::setFixed(Index i, Scalar value)

Marks a DOF as fixed to a prescribed value.

Parameters
i DOF index.
value Prescribed scalar value.

template<class Scalar> template<class Entries>
void Rodin::Assembly::ConstraintMap<Scalar>::setIdentification(Index slave, const Entries& entries)

Sets a homogeneous identification row.

Parameters
slave Slave DOF index.
entries Master expansion entries.

template<class Scalar> template<class Entries>
void Rodin::Assembly::ConstraintMap<Scalar>::setIdentification(Index slave, const Entries& entries, Scalar value)

Sets an affine identification row.

Parameters
slave Slave DOF index.
entries Master expansion entries.
value Constant term in the identification.

template<class Scalar>
void Rodin::Assembly::ConstraintMap<Scalar>::finalize()

Flattens transitive identification constraints.

Example:

\[ x_1 = x_2, \qquad x_2 = x_3 \]

becomes:

\[ x_1 = x_3, \qquad x_2 = x_3. \]

Cycles such as $ x_1 = x_2 $ , $ x_2 = x_1 $ are rejected.