AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
BiLinearForm< RB, CB, T, Traits > Class Template Reference

#include <BiLinearForm.hpp>

Inherits MatrixFacade< double, Traits::template Matrix< RB, CB >::template Impl >, and ObserverSequenceImpl< Event, Tags >.

Public Types

using RowBasis = RB
 The type of the finite element space / basis of the row.
 
using ColBasis = CB
 The type of the finite element space / basis of the column.
 
using CoefficientType = T
 The type of the elements of the DOFVector.
 
using ElementMatrix = FlatMatrix< CoefficientType >
 The type of the matrix filled on an element with local contributions.
 
using SparsityPattern = typename Traits::template Matrix< RB, CB >::SparsityPattern
 Type of the sparsity pattern of the backend.
 

Public Member Functions

 BiLinearForm (std::shared_ptr< RB > const &rowBasis, std::shared_ptr< CB > const &colBasis)
 Constructor. Stores the row and column basis in a local shared_ptr to const.
 
template<class RB_ , class CB_ , REQUIRES(Concepts::Similar< RB_, RB >) , REQUIRES(Concepts::Similar< CB_, CB >) >
 BiLinearForm (RB_ &&rowBasis, CB_ &&colBasis)
 Wraps the passed global bases into (non-destroying) shared_ptr.
 
template<class RB_ = RB, class CB_ = CB, REQUIRES(std::is_same_v< RB_, CB_ >) >
 BiLinearForm (std::shared_ptr< RB > const &rowBasis)
 Constructor for rowBasis == colBasis.
 
template<class RB_ , REQUIRES(Concepts::Similar< RB_, RB >) >
 BiLinearForm (RB_ &&rowBasis)
 Wraps the passed row-basis into a (non-destroying) shared_ptr.
 
RowBasis const & rowBasis () const
 
ColBasis const & colBasis () const
 
void setSymmetryStructure (SymmetryStructure symm)
 Provide some additional information about the structure of the matrix pattern. More...
 
void setSymmetryStructure (std::string str)
 Set the symmetry structure using a string.
 
template<class RowLocalView , class ColLocalView , REQUIRES(Concepts::LocalView< RowLocalView >) , REQUIRES(Concepts::LocalView< ColLocalView >) >
void assemble (RowLocalView const &rowLocalView, ColLocalView const &colLocalView)
 Assemble the matrix operators on the bound element.
 
void assemble ()
 Assemble all matrix operators, TODO: incorporate boundary conditions.
 
void init (bool forcePatternRebuild=false)
 
void updateImpl (event::adapt, index_t< 0 >) override
 
void updateImpl (event::adapt, index_t< 1 >) override
 
auto & assembler ()
 
template<class ContextTag , class Expr , class RowTreePath , class ColTreePath >
void addOperator (ContextTag contextTag, Expr const &expr, RowTreePath row, ColTreePath col)
 
template<class ContextTag , class Operator , class Row , class Col >
void addOperator (ContextTag contextTag, Operator const &op, Row row, Col col)
 Associate a local operator with this BiLinearForm. More...
 
template<class Operator , class Row = RootTreePath, class Col = RootTreePath>
void addOperator (Operator const &op, Row row={}, Col col={})
 
template<class Operator , class Row = RootTreePath, class Col = RootTreePath>
void addIntersectionOperator (Operator const &op, Row row={}, Col col={})
 
- Public Member Functions inherited from MatrixFacade< double, Traits::template Matrix< RB, CB >::template Impl >
 MatrixFacade (RowBasis const &rowBasis, ColBasis const &colBasis)
 
Impl const & impl () const
 Return the underlying matrix backend.
 
Implimpl ()
 
void init (SparsityPattern const &pattern)
 Initialize the matrix for insertion and allocate the non-zero pattern.
 
void init ()
 Initialize the matrix for insertion while keeping the pattern unchanged.
 
void finish ()
 Finish the matrix insertion, e.g. cleanup or final insertion.
 
void insert (RowIndex const &row, ColIndex const &col, typename Impl::value_type const &value)
 Insert a single value into the matrix (add to existing value)
 
void scatter (RowLocalView const &r, ColLocalView const &c, LocalMatrix const &localMatrix)
 
void zeroRows (std::vector< Idx > const &ind, bool diag)
 Set all entries of the specified rows to zero and the diagonal element to diag
 
void zeroRows (std::vector< RowIdx > const &rowInd, std::vector< ColIdx > const &colInd, bool diag)
 Set all entries of the specified rows to zero and the diagonal element to diag
 
void zeroRowsColumns (std::vector< Idx > const &ind, bool diag, VecX const &x, VecB &b)
 Set all entries of the specified rows and columns==rows to zero and the diagonal element to 1 if diag is set to true. Additionally, modify the entries of the vector b according to the solution values x times the corresponding matrix entries.
 
void zeroRowsColumns (std::vector< Idx > const &ind, bool diag)
 Set all entries of the specified rows and columns==rows to zero and the main diagonal element to 1 if diag is set to true.
 
void zeroRowsColumns (std::vector< RowIdx > const &rowInd, std::vector< ColIdx > const &colInd, bool diag, VecX const &x, VecB &b)
 Set all entries of the specified rows and columns to zero and the diagonal elements defined as pairs of row and column indices to 1 if diag is set to true. Additionally, modify the entries of the vector b according to the solution values x times the corresponding matrix entries.
 
void zeroRowsColumns (std::vector< RowIdx > const &rowInd, std::vector< ColIdx > const &colInd, bool diag)
 Set all entries of the specified rows and columns to zero and the diagonal elements defined as pairs of row and column indices to 1 if diag is set to true.
 
std::size_t nnz () const
 Number of nonzeros in the matrix.
 

Protected Attributes

SymmetryStructure symmetry_
 The symmetry property if the bilinear form.
 
ElementMatrix elementMatrix_
 Dense matrix to store coefficients during assemble()
 
MatrixAssembler< RowBasis, ColBasis, ElementMatrixassembler_
 List of operators associated to row/col node.
 
std::shared_ptr< RowBasis const > rowBasis_
 
std::shared_ptr< ColBasis const > colBasis_
 
- Protected Attributes inherited from MatrixFacade< double, Traits::template Matrix< RB, CB >::template Impl >
Impl impl_
 The matrix backend.
 

Detailed Description

template<class RB, class CB, class T = double, class Traits = BackendTraits>
class AMDiS::BiLinearForm< RB, CB, T, Traits >

Basis implementation of DOFMatrix, i.e. a sparse matrix storing all the assembled Operators indexed with DOF indices. The matrix data is associated to a row and column global basis.

Template Parameters
RBBasis of the matrix rows
CBBasis of matrix columns
TCoefficient type to store in the matrix
TraitsCollection of parameter for the linear-algebra backend

Member Function Documentation

◆ addOperator()

void addOperator ( ContextTag  contextTag,
Operator const &  op,
Row  row,
Col  col 
)

Associate a local operator with this BiLinearForm.

Stores an operator in a list that gets assembled during a call to assemble(). The operator may be assigned to a specific context, i.e. either an element operator, an intersection operator, or a boundary operator. The row and col tree paths specify the sub-basis for test and trial functions the operator is applied to.

Template Parameters
ContextTagOne of tag::element_operator, tag::intersection_operator or BoundarySubset indicating where to assemble this operator.
OperatorA (pre-)operator that can be bound to a gridView, or a valid GridOperator.
rowA tree-path for the RowBasis
colA tree-path for the ColBasis

[[expects: row is valid tree-path in RowBasis]] [[expects: col is valid tree-path in ColBasis]]

◆ init()

void init ( bool  forcePatternRebuild = false)
inline

Prepare the underlying matrix for insertion and rebuild the sparsity pattern if required. The pattern is rebuild if either the parameter forceRebuild is set to true or if for some other reasons the internal flag updatePattern_ is set. This might be the case if the symmetry structure is changed or the basis is updated.

If the pattern is not updated, just the values are set to zero.

References MatrixFacade< T, MatrixImpl >::init(), and BiLinearForm< RB, CB, T, Traits >::symmetry_.

◆ setSymmetryStructure()

void setSymmetryStructure ( SymmetryStructure  symm)
inline

Provide some additional information about the structure of the matrix pattern.

If the symmetry structure is changed, it forces the matrix to rebuild its patterns.

References BiLinearForm< RB, CB, T, Traits >::symmetry_.

Referenced by BiLinearForm< RB, CB, T, Traits >::setSymmetryStructure().

◆ updateImpl()

void updateImpl ( event::adapt  ,
index_t< 0 >   
)
inlineoverride

Set the flag that forces an update of the pattern since the underlying basis that defines the indexset has been changed


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