OGS
|
Global matrix based on Eigen sparse matrix
The matrix will be dynamically allocated during construction.
Definition at line 28 of file EigenMatrix.h.
#include <EigenMatrix.h>
Public Types | |
using | RawMatrixType = Eigen::SparseMatrix<double, Eigen::RowMajor> |
using | IndexType = RawMatrixType::Index |
Public Member Functions | |
EigenMatrix (IndexType const n, IndexType const n_nonzero_columns=0) | |
IndexType | getNumberOfRows () const |
return the number of rows | |
IndexType | getNumberOfColumns () const |
return the number of columns | |
IndexType | getRangeEnd () const |
return an end index of the active data range | |
void | setZero () |
reset data entries to zero. | |
int | setValue (IndexType row, IndexType col, double val) |
int | add (IndexType row, IndexType col, double val) |
template<class T_DENSE_MATRIX > | |
void | add (std::vector< IndexType > const &row_pos, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0) |
template<class T_DENSE_MATRIX > | |
void | add (RowColumnIndices< IndexType > const &indices, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0) |
template<class T_DENSE_MATRIX > | |
void | add (std::vector< IndexType > const &row_pos, std::vector< IndexType > const &col_pos, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0) |
double | get (IndexType row, IndexType col) const |
get value. This function returns zero if the element doesn't exist. | |
void | write (const std::string &filename) const |
printout this matrix for debugging | |
void | write (std::ostream &os) const |
printout this matrix for debugging | |
RawMatrixType & | getRawMatrix () |
const RawMatrixType & | getRawMatrix () const |
Static Public Member Functions | |
static constexpr IndexType | getRangeBegin () |
return a start index of the active data range | |
static constexpr bool | isAssembled () |
return always true, i.e. the matrix is always ready for use | |
Protected Attributes | |
RawMatrixType | mat_ |
using MathLib::EigenMatrix::IndexType = RawMatrixType::Index |
Definition at line 32 of file EigenMatrix.h.
using MathLib::EigenMatrix::RawMatrixType = Eigen::SparseMatrix<double, Eigen::RowMajor> |
Definition at line 31 of file EigenMatrix.h.
|
inlineexplicit |
n | the number of rows (that is equal to the number of columns). |
n_nonzero_columns | the number of non-zero columns used for preallocation. |
Definition at line 41 of file EigenMatrix.h.
References mat_.
add a value to the given entry. If the entry doesn't exist, the value is inserted.
Definition at line 87 of file EigenMatrix.h.
References mat_.
Referenced by add(), add(), add(), ProcessLib::BoundaryConditionAndSourceTerm::Python::BcAndStLocalAssemblerImpl< BcOrStData, ShapeFunction, LowerOrderShapeFunction, GlobalDim >::assemble(), ProcessLib::RobinBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::VectorMatrixAssembler::assemble(), ProcessLib::ComponentTransport::ComponentTransportLocalAssemblerInterface::assembleReactionEquation(), ProcessLib::VectorMatrixAssembler::assembleWithJacobian(), and ProcessLib::AnchorTerm< GlobalDim >::integrate().
|
inline |
Add sub-matrix at positions given by indices
. If the entry doesn't exist, this class inserts the value.
Definition at line 106 of file EigenMatrix.h.
References add(), MathLib::RowColumnIndices< IDX_TYPE >::columns, and MathLib::RowColumnIndices< IDX_TYPE >::rows.
|
inline |
Add sub-matrix at positions row_pos
and same column positions as the given row positions. If the entry doesn't exist, the value is inserted.
Definition at line 96 of file EigenMatrix.h.
References add().
void MathLib::EigenMatrix::add | ( | std::vector< IndexType > const & | row_pos, |
std::vector< IndexType > const & | col_pos, | ||
const T_DENSE_MATRIX & | sub_matrix, | ||
double | fkt = 1.0 ) |
Add sub-matrix at positions row_pos
and col_pos
. If the entries doesn't exist in the matrix, the values are inserted.
row_pos | a vector of row position indices. The vector size should equal to the number of rows in the given sub-matrix. |
col_pos | a vector of column position indices. The vector size should equal to the number of columns in the given sub-matrix. |
sub_matrix | a sub-matrix to be added |
fkt | a scaling factor applied to all entries in the sub-matrix |
Definition at line 153 of file EigenMatrix.h.
References add().
get value. This function returns zero if the element doesn't exist.
Definition at line 131 of file EigenMatrix.h.
References mat_.
|
inline |
return the number of columns
Definition at line 56 of file EigenMatrix.h.
References mat_.
Referenced by setValue().
|
inline |
return the number of rows
Definition at line 53 of file EigenMatrix.h.
References mat_.
Referenced by getRangeEnd(), MathLib::SetMatrixSparsity< EigenMatrix, SPARSITY_PATTERN >::operator()(), setValue(), and MathLib::EigenLisLinearSolver::solve().
|
inlinestaticconstexpr |
return a start index of the active data range
Definition at line 59 of file EigenMatrix.h.
|
inline |
return an end index of the active data range
Definition at line 62 of file EigenMatrix.h.
References getNumberOfRows().
|
inline |
Definition at line 145 of file EigenMatrix.h.
References mat_.
Referenced by MathLib::applyKnownSolution(), MathLib::EigenLinearSolver::compute(), MathLib::SetMatrixSparsity< EigenMatrix, SPARSITY_PATTERN >::operator()(), MathLib::EigenLinearSolver::solve(), and MathLib::EigenLisLinearSolver::solve().
|
inline |
|
inlinestaticconstexpr |
return always true, i.e. the matrix is always ready for use
Definition at line 137 of file EigenMatrix.h.
set a value to the given entry. If the entry doesn't exist, this class dynamically allocates it.
Definition at line 77 of file EigenMatrix.h.
References getNumberOfColumns(), getNumberOfRows(), and mat_.
|
inline |
reset data entries to zero.
Definition at line 65 of file EigenMatrix.h.
References mat_.
void MathLib::EigenMatrix::write | ( | const std::string & | filename | ) | const |
printout this matrix for debugging
Definition at line 19 of file EigenMatrix.cpp.
References write().
Referenced by write().
void MathLib::EigenMatrix::write | ( | std::ostream & | os | ) | const |
printout this matrix for debugging
Definition at line 29 of file EigenMatrix.cpp.
References mat_.
|
protected |
Definition at line 149 of file EigenMatrix.h.
Referenced by EigenMatrix(), add(), get(), getNumberOfColumns(), getNumberOfRows(), getRawMatrix(), getRawMatrix(), setValue(), setZero(), and write().