5 #include <dune/common/shared_ptr.hh> 7 #include <amdis/common/Concepts.hpp> 8 #include <amdis/common/ConceptsBase.hpp> 9 #include <amdis/common/TypeTraits.hpp> 10 #include <amdis/functions/NodeIndices.hpp> 11 #include <amdis/typetree/MultiIndex.hpp> 23 template <
class T,
template <
class>
class MatrixImpl>
27 using Impl = MatrixImpl<T>;
32 template <
class RowBasis,
class ColBasis>
34 :
impl_(rowBasis, colBasis)
42 template <
class SparsityPattern>
61 template <
class RowIndex,
class ColIndex,
62 REQUIRES(Concepts::MultiIndex<RowIndex>),
63 REQUIRES(Concepts::MultiIndex<ColIndex>)>
64 void insert(RowIndex
const& row, ColIndex
const& col,
typename Impl::value_type
const& value)
66 impl_.insert(row, col, value);
71 template <
class RowLocalView,
class ColLocalView,
class LocalMatrix,
72 REQUIRES(Concepts::LocalView<RowLocalView>),
73 REQUIRES(Concepts::LocalView<ColLocalView>)>
74 void scatter(RowLocalView
const& r, ColLocalView
const& c, LocalMatrix
const& localMatrix)
76 assert(r.size() * c.size() == localMatrix.size());
77 assert(r.size() == localMatrix.rows());
78 assert(c.size() == localMatrix.cols());
80 const bool optimized = std::is_same_v<RowLocalView,ColLocalView>
81 && r.tree().treeIndex() == c.tree().treeIndex();
90 std::size_t
nnz()
const void scatter(RowLocalView const &r, ColLocalView const &c, LocalMatrix const &localMatrix)
Definition: MatrixFacade.hpp:74
void finish()
Finish the matrix insertion, e.g. cleanup or final insertion.
Definition: MatrixFacade.hpp:55
std::size_t nnz() const
Number of nonzeros in the matrix.
Definition: MatrixFacade.hpp:90
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
MatrixFacade(RowBasis const &rowBasis, ColBasis const &colBasis)
Definition: MatrixFacade.hpp:33
A general sparsity pattern implementation using the full pattern of the basis by adding all local ind...
Definition: SparsityPattern.hpp:14
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)
Definition: MatrixFacade.hpp:64
void init(SparsityPattern const &pattern)
Initialize the matrix for insertion and allocate the non-zero pattern.
Definition: MatrixFacade.hpp:43
Impl impl_
The matrix backend.
Definition: MatrixFacade.hpp:97
void init()
Initialize the matrix for insertion while keeping the pattern unchanged.
Definition: MatrixFacade.hpp:49
auto nodeIndices(LocalView const &localView, Node const &node)
Returns a range over (flat) DOF indices on a node, given by the localView.
Definition: NodeIndices.hpp:13
Impl const & impl() const
Return the underlying matrix backend.
Definition: MatrixFacade.hpp:38