OGS
MathLib::SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN > Struct Template Reference

Detailed Description

template<typename SPARSITY_PATTERN>
struct MathLib::SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN >

Sets the sparsity pattern of the underlying LisMatrix.

Definition at line 188 of file LisMatrix.h.

#include <LisMatrix.h>

Public Member Functions

void operator() (LisMatrix &matrix, SPARSITY_PATTERN const &sparsity_pattern) const
 

Member Function Documentation

◆ operator()()

template<typename SPARSITY_PATTERN >
void MathLib::SetMatrixSparsity< LisMatrix, SPARSITY_PATTERN >::operator() ( LisMatrix & matrix,
SPARSITY_PATTERN const & sparsity_pattern ) const
inline

Definition at line 190 of file LisMatrix.h.

192{
193 auto const n_rows = matrix.getNumberOfRows();
194 std::vector<LisMatrix::IndexType> row_sizes;
195 row_sizes.reserve(n_rows);
196
197 // LIS needs 1 more entry, otherwise it starts reallocating arrays.
198 transform(cbegin(sparsity_pattern), cend(sparsity_pattern),
199 back_inserter(row_sizes), [](auto const i) { return i + 1; });
200
201 int ierr = lis_matrix_malloc(matrix.AA_, 0, row_sizes.data());
202 checkLisError(ierr);
203}
bool checkLisError(int err)
Definition LisCheck.h:31

References MathLib::LisMatrix::AA_, MathLib::checkLisError(), and MathLib::LisMatrix::getNumberOfRows().


The documentation for this struct was generated from the following file: