OGS
|
LisMatrix is a wrapper class for matrix types of the linear iterative solvers library.
LisMatrix only supports square matrices, i.e. the number of rows have to be equal to the number of columns.
Definition at line 42 of file LisMatrix.h.
#include <LisMatrix.h>
Public Types | |
enum class | MatrixType : int { CRS = 1 , CCS = 2 , MSR = 3 , DIA = 4 , ELL = 5 , JDS = 6 , BSR = 7 , BSC = 8 , VBR = 9 , COO = 10 , DNS = 11 } |
Matrix type. More... | |
using | IndexType = LIS_INT |
Public Member Functions | |
LisMatrix (std::size_t n_rows, MatrixType mat_type=MatrixType::CRS) | |
LisMatrix (std::size_t n_rows, int nonzero, IndexType *row_ptr, IndexType *col_idx, double *data) | |
virtual | ~LisMatrix () |
std::size_t | getNumberOfRows () const |
return the number of rows | |
std::size_t | getNumberOfColumns () const |
return the number of columns | |
std::size_t | getRangeBegin () const |
return a start index of the active data range | |
std::size_t | getRangeEnd () const |
return an end index of the active data range | |
void | setZero () |
reset this matrix with keeping its original dimension | |
int | setValue (IndexType rowId, IndexType colId, double v) |
set entry | |
int | add (IndexType rowId, IndexType colId, double v) |
add value | |
void | write (const std::string &filename) const |
printout this equation for debugging | |
LIS_MATRIX & | getRawMatrix () |
return a raw Lis matrix object | |
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) |
Add sub-matrix at positions given by indices . | |
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) |
MatrixType | getMatrixType () const |
get this matrix type | |
bool | isAssembled () const |
return if this matrix is already assembled or not | |
Private Attributes | |
std::size_t const | n_rows_ |
MatrixType const | mat_type_ |
LIS_MATRIX | AA_ |
LIS_VECTOR | diag_ |
bool | is_assembled_ |
IndexType | is_ |
IndexType | ie_ |
location where the partial matrix AA_ ends in global matrix. | |
bool | use_external_arrays_ |
Friends | |
template<typename MATRIX , typename SPARSITY_PATTERN > | |
struct | SetMatrixSparsity |
bool | finalizeMatrixAssembly (LisMatrix &mat) |
finish assembly to make this matrix be ready for use | |
using MathLib::LisMatrix::IndexType = LIS_INT |
Definition at line 61 of file LisMatrix.h.
|
strong |
MathLib::LisMatrix::LisMatrix | ( | std::size_t | n_rows, |
MatrixType | mat_type = MatrixType::CRS ) |
constructor
n_rows | the number of rows (that is equal to the number of columns) |
mat_type | default 1 CRS |
Definition at line 26 of file LisMatrix.cpp.
References AA_, MathLib::checkLisError(), diag_, ie_, and is_.
MathLib::LisMatrix::LisMatrix | ( | std::size_t | n_rows, |
int | nonzero, | ||
IndexType * | row_ptr, | ||
IndexType * | col_idx, | ||
double * | data ) |
constructor using raw CRS data
Note that the given CRS data will not be deleted in this class.
n_rows | the number of rows |
nonzero | the number of non zero entries |
row_ptr | array of row pointer indexes |
col_idx | array of column indexes |
data | the non-zero entry values |
Definition at line 41 of file LisMatrix.cpp.
References AA_, MathLib::checkLisError(), diag_, ie_, is_, and is_assembled_.
|
virtual |
Definition at line 62 of file LisMatrix.cpp.
References AA_, MathLib::checkLisError(), diag_, and use_external_arrays_.
add value
Definition at line 103 of file LisMatrix.cpp.
References AA_, diag_, is_assembled_, and MathLib::v.
|
inline |
Add sub-matrix at positions given by indices
.
Definition at line 128 of file LisMatrix.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.
Definition at line 119 of file LisMatrix.h.
References add().
void MathLib::LisMatrix::add | ( | std::vector< IndexType > const & | row_pos, |
std::vector< IndexType > const & | col_pos, | ||
const T_DENSE_MATRIX & | sub_matrix, | ||
double | fkt = 1.0 ) |
Definition at line 166 of file LisMatrix.h.
References add().
|
inline |
|
inline |
return the number of columns
Definition at line 93 of file LisMatrix.h.
References getNumberOfRows().
|
inline |
return the number of rows
Definition at line 90 of file LisMatrix.h.
References n_rows_.
Referenced by getNumberOfColumns(), and MathLib::SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN >::operator()().
|
inline |
return a start index of the active data range
Definition at line 96 of file LisMatrix.h.
References is_.
|
inline |
return an end index of the active data range
Definition at line 99 of file LisMatrix.h.
References ie_.
|
inline |
return a raw Lis matrix object
Definition at line 114 of file LisMatrix.h.
References AA_.
Referenced by MathLib::EigenLisLinearSolver::solve().
|
inline |
return if this matrix is already assembled or not
Definition at line 144 of file LisMatrix.h.
References is_assembled_.
set entry
Definition at line 92 of file LisMatrix.cpp.
References AA_, diag_, is_assembled_, and MathLib::v.
void MathLib::LisMatrix::setZero | ( | ) |
reset this matrix with keeping its original dimension
Definition at line 76 of file LisMatrix.cpp.
References AA_, MathLib::checkLisError(), diag_, is_assembled_, and n_rows_.
void MathLib::LisMatrix::write | ( | const std::string & | filename | ) | const |
printout this equation for debugging
Definition at line 114 of file LisMatrix.cpp.
References AA_, is_assembled_, and OGS_FATAL.
|
friend |
finish assembly to make this matrix be ready for use
Definition at line 123 of file LisMatrix.cpp.
|
friend |
Definition at line 162 of file LisMatrix.h.
|
private |
Definition at line 149 of file LisMatrix.h.
Referenced by LisMatrix(), LisMatrix(), ~LisMatrix(), add(), getRawMatrix(), MathLib::SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN >::operator()(), setValue(), setZero(), and write().
|
private |
Definition at line 150 of file LisMatrix.h.
Referenced by LisMatrix(), LisMatrix(), ~LisMatrix(), add(), setValue(), and setZero().
|
private |
location where the partial matrix AA_ ends in global matrix.
Definition at line 155 of file LisMatrix.h.
Referenced by LisMatrix(), LisMatrix(), and getRangeEnd().
|
private |
location where the partial matrix AA_ starts in global matrix.
Definition at line 152 of file LisMatrix.h.
Referenced by LisMatrix(), LisMatrix(), and getRangeBegin().
|
private |
Definition at line 151 of file LisMatrix.h.
Referenced by LisMatrix(), add(), isAssembled(), setValue(), setZero(), and write().
|
private |
Definition at line 148 of file LisMatrix.h.
Referenced by getMatrixType().
|
private |
Definition at line 147 of file LisMatrix.h.
Referenced by getNumberOfRows(), and setZero().
|
private |
Definition at line 156 of file LisMatrix.h.
Referenced by ~LisMatrix().