34 template <
typename SPARSITY_PATTERN>
35 struct SetMatrixSparsity<LisMatrix, SPARSITY_PATTERN>;
112 void write(
const std::string &filename)
const;
119 template<
class T_DENSE_MATRIX>
120 void add(std::vector<IndexType>
const& row_pos,
121 const T_DENSE_MATRIX &sub_matrix,
124 this->
add(row_pos, row_pos, sub_matrix, fkt);
128 template<
class T_DENSE_MATRIX>
130 const T_DENSE_MATRIX &sub_matrix,
136 template <
class T_DENSE_MATRIX>
137 void add(std::vector<IndexType>
const& row_pos,
138 std::vector<IndexType>
const& col_pos,
139 const T_DENSE_MATRIX& sub_matrix,
double fkt = 1.0);
162 template <
typename MATRIX,
typename SPARSITY_PATTERN>
166 template <
class T_DENSE_MATRIX>
168 std::vector<IndexType>
const& col_pos,
169 const T_DENSE_MATRIX& sub_matrix,
double fkt)
171 auto const n_rows = row_pos.size();
172 auto const n_cols = col_pos.size();
173 for (
auto i = decltype(n_rows){0}; i < n_rows; i++)
175 auto const row = row_pos[i];
176 for (
auto j = decltype(n_cols){0}; j < n_cols; j++)
178 auto const col = col_pos[j];
179 add(row, col, fkt * sub_matrix(i, j));
188 template <
typename SPARSITY_PATTERN>
192 SPARSITY_PATTERN
const& sparsity_pattern)
const
195 std::vector<LisMatrix::IndexType> row_sizes;
196 row_sizes.reserve(n_rows);
199 transform(cbegin(sparsity_pattern), cend(sparsity_pattern),
200 back_inserter(row_sizes), [](
auto const i) {
return i + 1; });
202 int ierr = lis_matrix_malloc(matrix.
AA_, 0, row_sizes.data());
Definition of the LisOption class.
LisMatrix is a wrapper class for matrix types of the linear iterative solvers library.
IndexType ie_
location where the partial matrix AA_ ends in global matrix.
LisMatrix(std::size_t n_rows, MatrixType mat_type=MatrixType::CRS)
std::size_t getRangeBegin() const
return a start index of the active data range
std::size_t const n_rows_
std::size_t getNumberOfColumns() const
return the number of columns
LIS_MATRIX & getRawMatrix()
return a raw Lis matrix object
MatrixType const mat_type_
std::size_t getNumberOfRows() const
return the number of rows
int setValue(IndexType rowId, IndexType colId, double v)
set entry
std::size_t getRangeEnd() const
return an end index of the active data range
int add(IndexType rowId, IndexType colId, double v)
add value
void add(std::vector< IndexType > const &row_pos, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0)
void setZero()
reset this matrix with keeping its original dimension
MatrixType getMatrixType() const
get this matrix type
bool use_external_arrays_
friend bool finalizeMatrixAssembly(LisMatrix &mat)
finish assembly to make this matrix be ready for use
void write(const std::string &filename) const
printout this equation for debugging
void add(RowColumnIndices< IndexType > const &indices, const T_DENSE_MATRIX &sub_matrix, double fkt=1.0)
Add sub-matrix at positions given by indices.
bool isAssembled() const
return if this matrix is already assembled or not
bool checkLisError(int err)
bool finalizeMatrixAssembly(MAT_T &)
LineIndex const & columns
void operator()(LisMatrix &matrix, SPARSITY_PATTERN const &sparsity_pattern) const