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 189 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 191 of file LisMatrix.h.

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

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


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