7 #include <dune/istl/bcrsmatrix.hh> 8 #include <dune/istl/matrixindexset.hh> 10 #include <amdis/Output.hpp> 11 #include <amdis/linearalgebra/SymmetryStructure.hpp> 15 template <
class T,
class =
void>
18 using type = Dune::FieldMatrix<T,1,1>;
27 template <
class T,
class C>
32 using BaseMatrix = Dune::BCRSMatrix<typename BlockMatrixType<T>::type>;
45 template <
class Basis>
47 : comm_(&rowBasis.communicator())
62 Comm const& comm()
const {
return *comm_; }
65 template <
class Pattern>
66 void init(Pattern
const& pattern)
68 pattern.applyTo(matrix_);
88 test_exit_dbg( initialized_,
"Occupation pattern not initialized!");
90 "Indices out of range [0,{})x[0,{})", matrix_.N(), matrix_.M() );
91 matrix_[r][c] += value;
94 template <
class Ind,
class LocalMat>
95 void scatter(Ind
const& idx, LocalMat
const& mat)
97 scatter(idx, idx, mat);
100 template <
class RowInd,
class ColInd,
class LocalMat>
101 void scatter(RowInd
const& rows, ColInd
const& cols, LocalMat
const& mat)
103 test_exit_dbg( initialized_,
"Occupation pattern not initialized!");
106 matrix_[rows[i]][cols[j]] += mat[i][j];
109 std::size_t nnz()
const 111 return matrix_.nonzeroes();
118 bool initialized_ =
false;
BaseMatrix const & matrix() const
Return the data-vector vector.
Definition: MatrixBackend.hpp:51
void insert(size_type r, size_type c, value_type const &value)
Insert a single value into the matrix (add to existing value)
Definition: MatrixBackend.hpp:86
ISTLBCRSMatrix(Basis const &rowBasis, Basis const &)
Constructor. Constructs new BaseVector.
Definition: MatrixBackend.hpp:46
void test_exit_dbg(bool condition, Args &&... args)
call assert_msg, in debug mode only
Definition: Output.hpp:205
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
Dune::BCRSMatrix< typename BlockMatrixType< T >::type > BaseMatrix
The matrix type of the underlying base matrix.
Definition: MatrixBackend.hpp:32
C Comm
Communication type.
Definition: MatrixBackend.hpp:35
Definition: MatrixBackend.hpp:28
typename BaseMatrix::size_type size_type
The index/size - type.
Definition: MatrixBackend.hpp:41
void init(Pattern const &pattern)
Create occupation pattern and apply it to the matrix.
Definition: MatrixBackend.hpp:66
BaseMatrix & matrix()
Return the data-vector vector.
Definition: MatrixBackend.hpp:57
void init()
Set all entries to zero while keeping the occupation pattern intact.
Definition: MatrixBackend.hpp:73
Definition: MatrixBackend.hpp:16
typename BaseMatrix::block_type value_type
The type of the elements of the DOFMatrix.
Definition: MatrixBackend.hpp:38