8 #include <Eigen/SparseCore> 10 #include <dune/common/timer.hh> 12 #include <amdis/Output.hpp> 18 template <
class T,
int Orientation = Eigen::RowMajor>
33 template <
class Basis>
55 "Indices out of range [0,{})x[0,{})", matrix_.rows(), matrix_.cols());
56 tripletList_.emplace_back(r, c, value);
59 template <
class Ind,
class LocalMat>
60 void scatter(Ind
const& idx, LocalMat
const& mat)
62 scatter(idx, idx, mat);
65 template <
class RowInd,
class ColInd,
class LocalMat>
66 void scatter(RowInd
const& rows, ColInd
const& cols, LocalMat
const& mat)
71 tripletList_.emplace_back(rows[i], cols[j], mat[i][j]);
76 template <
class Pattern>
77 void init(Pattern
const& pattern)
79 matrix_.resize(pattern.rows(), pattern.cols());
92 matrix_.setFromTriplets(tripletList_.begin(), tripletList_.end());
93 matrix_.makeCompressed();
99 std::size_t
nnz()
const 101 return matrix_.nonZeros();
109 std::vector<Eigen::Triplet<value_type, Eigen::Index>> tripletList_;
void init()
Set all matrix entries to zero while keeping the size unchanged.
Definition: MatrixBackend.hpp:84
void init(Pattern const &pattern)
Resize the matrix according to the pattern provided and set all entries to zero.
Definition: MatrixBackend.hpp:77
std::size_t nnz() const
Return the number of nonzeros in the matrix.
Definition: MatrixBackend.hpp:99
typename BaseMatrix::Index size_type
The index/size - type.
Definition: MatrixBackend.hpp:29
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
The basic container that stores a base matrix and a corresponding row/column feSpace.
Definition: MatrixBackend.hpp:19
BaseMatrix & matrix()
Return a reference to the data-matrix matrix.
Definition: MatrixBackend.hpp:37
BaseMatrix const & matrix() const
Return a reference to the data-matrix matrix.
Definition: MatrixBackend.hpp:43
EigenSparseMatrix(Basis const &, Basis const &)
Constructor. Constructs new BaseMatrix.
Definition: MatrixBackend.hpp:34
void finish()
Set the matrix entries from the triplet list and compress the matrix afterwards.
Definition: MatrixBackend.hpp:90
typename BaseMatrix::Scalar value_type
The type of the elements of the DOFMatrix.
Definition: MatrixBackend.hpp:26
void insert(size_type r, size_type c, value_type const &value)
Returns an update-proxy of the inserter, to inserte/update a value at position (r, c) in the matrix. Need an insertionMode inserter, that can be created by init and must be closed by finish after insertion.
Definition: MatrixBackend.hpp:52
Eigen::SparseMatrix< T, Orientation > BaseMatrix
The matrix type of the underlying base matrix.
Definition: MatrixBackend.hpp:23