hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
hpfem::fespace::Constraints Class Reference

#include <constraints.hpp>

Classes

struct  Term
 

Public Member Functions

 Constraints (Index num_dofs)
 
void add (Index slave, std::vector< Term > terms)
 
void append (const Constraints &other)
 
Index num_dofs () const noexcept
 
Index num_constrained () const noexcept
 
Index num_free () const noexcept
 
bool is_constrained (Index dof) const
 
std::span< const Term > terms (Index slave) const
 
Index reduced_index (Index dof) const
 Index of a free DoF among the free DoFs (ascending), kInvalidIndex for a slave.
 
void set_test (const Constraints &test)
 
bool has_test () const noexcept
 True after set_test.
 
Complex test_coefficient (Index slave, std::size_t k) const
 
SparseMatrix prolongation () const
 Prolongation \( P \) (num_dofs × num_free): \( x = P x_f \).
 
SparseMatrix test_prolongation () const
 Test prolongation \( Q \) (equal to \( P \) without set_test).
 
Vector expand (const Vector &reduced) const
 \( P x_f \): slaves filled in from their masters.
 
Vector reduce_rhs (const Vector &rhs) const
 
std::pair< SparseMatrix, Vector > reduce (const SparseMatrix &matrix, const Vector &rhs) const
 

Constructor & Destructor Documentation

◆ Constraints()

hpfem::fespace::Constraints::Constraints ( Index  num_dofs)
explicit
Exceptions
InvalidArgumentfor a negative number of DoFs.

Member Function Documentation

◆ add()

void hpfem::fespace::Constraints::add ( Index  slave,
std::vector< Term >  terms 
)

Adds \( x_{slave} = \sum \text{coefficient}_i\, x_{master_i} \). Masters may be slaves of other constraints (resolved later).

Exceptions
InvalidArgumentif an index is out of range, the slave is already constrained, or a master equals the slave.

◆ append()

void hpfem::fespace::Constraints::append ( const Constraints &  other)

Adds every constraint of other (same number of DoFs), e.g. hanging-node constraints followed by Bloch-periodic ones.

Exceptions
InvalidArgumenton a size mismatch or a DoF constrained by both.

◆ expand()

Vector hpfem::fespace::Constraints::expand ( const Vector &  reduced) const

\( P x_f \): slaves filled in from their masters.

◆ has_test()

bool hpfem::fespace::Constraints::has_test ( ) const
inlinenoexcept

True after set_test.

◆ is_constrained()

bool hpfem::fespace::Constraints::is_constrained ( Index  dof) const
inline

◆ num_constrained()

Index hpfem::fespace::Constraints::num_constrained ( ) const
inlinenoexcept

◆ num_dofs()

Index hpfem::fespace::Constraints::num_dofs ( ) const
inlinenoexcept

◆ num_free()

Index hpfem::fespace::Constraints::num_free ( ) const
inlinenoexcept

◆ prolongation()

SparseMatrix hpfem::fespace::Constraints::prolongation ( ) const

Prolongation \( P \) (num_dofs × num_free): \( x = P x_f \).

◆ reduce()

std::pair< SparseMatrix, Vector > hpfem::fespace::Constraints::reduce ( const SparseMatrix &  matrix,
const Vector &  rhs 
) const

◆ reduce_rhs()

Vector hpfem::fespace::Constraints::reduce_rhs ( const Vector &  rhs) const

\( P^H A P \) and \( P^H b \) ( \( Q^H \) with a test space): the system on the free DoFs.

Exceptions
InvalidArgumentif the sizes do not match num_dofs(). \( P^H b \) alone (a new load for an already reduced matrix).

◆ reduced_index()

Index hpfem::fespace::Constraints::reduced_index ( Index  dof) const

Index of a free DoF among the free DoFs (ascending), kInvalidIndex for a slave.

◆ set_test()

void hpfem::fespace::Constraints::set_test ( const Constraints &  test)

Sets the test space \( Q \): the same slaves and resolved masters as these constraints, other coefficients. reduce, reduce_rhs then form \( Q^H A P \), \( Q^H b \). Used for Bloch phases off the unit circle, where test holds the phases \( 1/\bar\lambda \) (its conjugate coefficients are the analytic continuation of the real-k test functions). A later add or append drops the test space.

Exceptions
InvalidArgumentif the DoF count, the slaves or the resolved masters differ.

◆ terms()

std::span< const Term > hpfem::fespace::Constraints::terms ( Index  slave) const

Resolved terms of a slave (masters are free DoFs), empty for a free DoF.

Exceptions
InvalidArgumentif the constraints contain a cycle.

◆ test_coefficient()

Complex hpfem::fespace::Constraints::test_coefficient ( Index  slave,
std::size_t  k 
) const

Coefficient of the resolved term k of terms(slave) in the test space \( Q \) (the trial coefficient without a test space). Call terms first, which resolves the chains.

◆ test_prolongation()

SparseMatrix hpfem::fespace::Constraints::test_prolongation ( ) const

Test prolongation \( Q \) (equal to \( P \) without set_test).


The documentation for this class was generated from the following file: