LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
|
D.o.f. index mapping and assembly facilities. More...
Classes | |
class | COOMatrix |
A temporary data structure for matrix in COO format. More... | |
class | DofHandler |
A general (interface) class for DOF handling, see Lecture Document Paragraph 2.7.4.13. More... | |
class | DynamicFEDofHandler |
Dof handler allowing variable local dof layouts. More... | |
struct | EntityMatrixProviderAT |
Archetype for the EntityMatrixProvider concept. More... | |
struct | EntityVectorProviderAT |
Archetype for the EntityVectorProvider concept. More... | |
class | UniformFEDofHandler |
Dofhandler for uniform finite element spaces. More... | |
Concepts | |
concept | EntityMatrixProvider |
Provides the local element matrix for a mesh entity. | |
concept | EntityVectorProvider |
Provides the local element vector for a mesh entity. | |
Typedefs | |
using | gdof_idx_t = Eigen::Index |
using | ldof_idx_t = Eigen::Index |
using | size_type = lf::base::size_type |
using | dim_t = lf::base::dim_t |
using | glb_idx_t = lf::base::glb_idx_t |
template<typename SCALAR > | |
using | fixed_components_t |
Information about fixed solution components. | |
Functions | |
std::shared_ptr< spdlog::logger > & | AssembleMatrixLogger () |
The logger that is used by AssembleMatrixLocally() to log additional information. (for logging levels trace + debug) | |
template<typename TMPMATRIX , EntityMatrixProvider ENTITY_MATRIX_PROVIDER> | |
void | AssembleMatrixLocally (dim_t codim, const DofHandler &dof_handler_trial, const DofHandler &dof_handler_test, ENTITY_MATRIX_PROVIDER &entity_matrix_provider, TMPMATRIX &matrix) |
Assembly function for standard assembly of finite element matrices. | |
template<typename TMPMATRIX , EntityMatrixProvider ENTITY_MATRIX_PROVIDER> | |
TMPMATRIX | AssembleMatrixLocally (dim_t codim, const DofHandler &dof_handler_trial, const DofHandler &dof_handler_test, ENTITY_MATRIX_PROVIDER &entity_matrix_provider) |
Entity-wise local assembly of a matrix from local matrices. | |
template<typename TMPMATRIX , EntityMatrixProvider ENTITY_MATRIX_PROVIDER> | |
TMPMATRIX | AssembleMatrixLocally (dim_t codim, const DofHandler &dof_handler, ENTITY_MATRIX_PROVIDER &entity_matrix_provider) |
Entity-wise local assembly of a matrix from local matrices. | |
template<typename VECTOR , EntityVectorProvider ENTITY_VECTOR_PROVIDER> | |
void | AssembleVectorLocally (dim_t codim, const DofHandler &dof_handler, ENTITY_VECTOR_PROVIDER &entity_vector_provider, VECTOR &resultvector) |
entity-local assembly of (right-hand-side) vectors from element vectors | |
template<typename VECTOR , class ENTITY_VECTOR_PROVIDER > | |
VECTOR | AssembleVectorLocally (dim_t codim, const DofHandler &dof_handler, ENTITY_VECTOR_PROVIDER &entity_vector_provider) |
entity-local assembly of (right-hand-side) vectors from element vectors | |
template<typename SCALARTYPE > | |
std::ostream & | operator<< (std::ostream &o, const COOMatrix< SCALARTYPE > &mat) |
std::ostream & | operator<< (std::ostream &o, const DofHandler &dof_handler) |
output operator for DofHandler objects | |
void | PrintInfo (std::ostream &stream, const DofHandler &dof_handler, unsigned ctrl) |
template<typename SCALAR , typename SELECTOR , typename RHSVECTOR > | |
void | FixFlaggedSolutionComponents (SELECTOR &&selectvals, COOMatrix< SCALAR > &A, RHSVECTOR &b) |
enforce prescribed solution components | |
template<typename SCALAR , typename SELECTOR , typename RHSVECTOR > | |
void | FixFlaggedSolutionCompAlt (SELECTOR &&selectvals, COOMatrix< SCALAR > &A, RHSVECTOR &b) |
Setting unknowns of a sparse linear system of equations to fixed values. | |
template<typename SCALAR , typename RHSVECTOR > | |
void | FixSolutionComponentsLse (const fixed_components_t< SCALAR > &fixed_components, COOMatrix< SCALAR > &A, RHSVECTOR &b) |
manipulate a square linear system of equations with a coefficient matrix in COO format so that some solution components attain prescribed values. | |
D.o.f. index mapping and assembly facilities.
This module comprises classes and functions supporting the generation of (Galerkin) finite element matrices and right-hand-side vectors from local contributions of geometric entities.
Type for (co-)dimensions
Definition at line 28 of file assembly_types.h.
using lf::assemble::gdof_idx_t = Eigen::Index |
Type for indices into global matrices/vectors
Definition at line 22 of file assembly_types.h.
Type for global index of entities
Definition at line 30 of file assembly_types.h.
using lf::assemble::ldof_idx_t = Eigen::Index |
Type for indices referring to entity matrices/vectors
Definition at line 24 of file assembly_types.h.
Type for vector length/matrix sizes
Definition at line 26 of file assembly_types.h.
void lf::assemble::FixFlaggedSolutionCompAlt | ( | SELECTOR && | selectvals, |
COOMatrix< SCALAR > & | A, | ||
RHSVECTOR & | b ) |
Setting unknowns of a sparse linear system of equations to fixed values.
For the sake of simplicity let the prescribed solution components be at the bottom of the solution vector and denote them by \(\widehat{\mathbf{x}}\) Let the coefficient matrix \(\mathbf{A}\) and the right-hand-side vector be split according to
\[ \mathbf{A} = \left[\begin{array}{cc} \mathbf{A}_{11} & \mathbf{A}_{12} \\ \mathbf{A}_{21} & \mathbf{A}_{22} \end{array}\right]\quad,\quad \mathbf{b} = \left[\begin{array}{c} \mathbf{b}_1 \\ \mathbf{b}_2 \end{array}\right] \]
Then the solution of the system with fixed solution components is given by
\[ \left[\begin{array}{cc} \mathbf{A}_{11} & \mathbf{A}_{12} \\ \mathbf{0} & \mathbf{I} \end{array}\right] \left[\begin{array}{c} \mathbf{x} \\ \widehat{\mathbf{x}} \end{array}\right] = \left[\begin{array}{c} \mathbf{b}_1 \\ \widehat{\mathbf{x}} \end{array}\right] \]
Please refer to Lecture Document Paragraph 2.7.6.13 for deeper exposition.
The use of this function is demonstrated in Lecture Document Code 2.7.6.20.
Definition at line 184 of file fix_dof.h.
References AssembleMatrixLocally().
void lf::assemble::FixFlaggedSolutionComponents | ( | SELECTOR && | selectvals, |
COOMatrix< SCALAR > & | A, | ||
RHSVECTOR & | b ) |
enforce prescribed solution components
SCALAR | underlying scalar type, e.g. double |
SELECTOR | both predicate for selection of vector components and supplier of prescribed values |
RHSVECTOR | generic vector type for right hand side |
selectvals | reference to a selector object, whose purpose is twofold. It must flag degrees of ffreedom as being fixed and for those d.o.f.s it must provide the prescribed value. |
A | reference to the square coefficient matrix in COO format |
b | reference to the right-hand-side vector |
SCALAR is a numeric type, e.g., double
An object of type RHSVECTOR must provide a method Size()
telling the length of the vector and operator []
for read/write access to vector entries.
The type selector must provide
which returns the prescribed value in the second component of the pair, if the first evaluates to true
. scalar_t
must be convertible into SCALAR
For the sake of simplicity let the prescribed solution components be at the bottom of the solution vector and denote them by \(\widehat{\mathbf{x}}\) Let the coefficient matrix \(\mathbf{A}\) and the right-hand-side vector be split according to
\[ \mathbf{A} = \left[\begin{array}{cc} \mathbf{A}_{11} & \mathbf{A}_{12} \\ \mathbf{A}_{21} & \mathbf{A}_{22} \end{array}\right]\quad,\quad \mathbf{b} = \left[\begin{array}{c} \mathbf{b}_1 \\ \mathbf{b}_2 \end{array}\right] \]
Then the solution of the system with fixed solution components is given by, see also Lecture Document Equation 2.7.6.15
\[ \left[\begin{array}{cc} \mathbf{A}_{11} & 0 \\ \mathbf{0} & \mathbf{I} \end{array}\right] \left[\begin{array}{c} \mathbf{x} \\ \widehat{\mathbf{x}} \end{array}\right] = \left[\begin{array}{c} \mathbf{b}_1 - \mathbf{A}_{12}\widehat{\mathbf{x}} \\ \widehat{\mathbf{x}} \end{array}\right] \]
The underlying mathematics is elaborated in Lecture Document Paragraph 2.7.6.13.
Definition at line 87 of file fix_dof.h.
References AssembleMatrixLocally().
void lf::assemble::FixSolutionComponentsLse | ( | const fixed_components_t< SCALAR > & | fixed_components, |
COOMatrix< SCALAR > & | A, | ||
RHSVECTOR & | b ) |
manipulate a square linear system of equations with a coefficient matrix in COO format so that some solution components attain prescribed values.
SCALAR | underlying scalar type, e.g. double |
RHSVEC | generic vector type for right hand side |
fixed_components | A vector of pairs where the first entry specifies the dof number that should be fixed and the second entry specifies the value it should be fixed to. |
A | reference to the square coefficient matrix in COO format |
b | reference to the right-hand-side vector |
An object of type VECTOR or RESULTVECTOR must provide a method Size()
telling the length of the vector and operator []
for read/write access to vector entries.
This function is based on FixFlaggedSolutionCompAlt()
Definition at line 251 of file fix_dof.h.
References AssembleMatrixLocally().
std::ostream & lf::assemble::operator<< | ( | std::ostream & | o, |
const COOMatrix< SCALARTYPE > & | mat ) |
This function prints matrix size and the list of triplets
Definition at line 229 of file coomatrix.h.
std::ostream & lf::assemble::operator<< | ( | std::ostream & | o, |
const DofHandler & | dof_handler ) |
output operator for DofHandler objects
Definition at line 22 of file dofhandler.cc.
References AssembleMatrixLocally(), and PrintInfo().
void lf::assemble::PrintInfo | ( | std::ostream & | stream, |
const DofHandler & | dof_handler, | ||
unsigned | ctrl ) |
Definition at line 28 of file dofhandler.cc.
References AssembleMatrixLocally().
Referenced by operator<<().