My Project
Loading...
Searching...
No Matches
Opm::Linear::IstlSparseMatrixAdapter< MatrixBlockType, AllocatorType > Class Template Reference

A sparse matrix interface backend for BCRSMatrix from dune-istl. More...

#include <istlsparsematrixadapter.hh>

Public Types

using IstlMatrix = Dune::BCRSMatrix<MatrixBlockType, AllocatorType>
 Implementation of matrix.
 
using MatrixBlock = typename IstlMatrix::block_type
 block type forming the matrix entries
 
using Scalar = typename MatrixBlock::field_type
 type of scalar
 

Public Member Functions

 IstlSparseMatrixAdapter (const size_t rows, const size_t columns)
 Constructor creating an empty matrix.
 
template<class Simulator >
 IstlSparseMatrixAdapter (const Simulator &simulator)
 Constructor taking simulator and creating an empty matrix .
 
template<class Set >
void reserve (const std::vector< Set > &sparsityPattern)
 Allocate matrix structure give a sparsity pattern.
 
IstlMatrixistlMatrix ()
 Return constant reference to matrix implementation.
 
const IstlMatrixistlMatrix () const
 
size_t rows () const
 Return number of rows of the matrix.
 
size_t cols () const
 Return number of columns of the matrix.
 
void clear ()
 Set all matrix entries to zero.
 
void clearRow (const size_t row, const Scalar diag=1.0)
 Set given row to zero except for the main-diagonal entry (if it exists).
 
void block (const size_t rowIdx, const size_t colIdx, MatrixBlock &value) const
 Fill given block with entries stored in the matrix.
 
MatrixBlockType * blockAddress (const size_t rowIdx, const size_t colIdx) const
 
void setBlock (const size_t rowIdx, const size_t colIdx, const MatrixBlock &value)
 Set matrix block to given block.
 
void addToBlock (const size_t rowIdx, const size_t colIdx, const MatrixBlock &value)
 Add block to matrix block.
 
void commit ()
 Commit matrix from local caches into matrix native structure.
 
void finalize ()
 Finish modifying the matrix, i.e., convert the data structure from one tailored for linearization to one aimed at the linear solver.
 

Protected Attributes

size_t rows_
 
size_t columns_
 
std::unique_ptr< IstlMatrixistlMatrix_
 

Detailed Description

template<class MatrixBlockType, class AllocatorType = std::allocator<MatrixBlockType>>
class Opm::Linear::IstlSparseMatrixAdapter< MatrixBlockType, AllocatorType >

A sparse matrix interface backend for BCRSMatrix from dune-istl.

Member Function Documentation

◆ clearRow()

template<class MatrixBlockType , class AllocatorType = std::allocator<MatrixBlockType>>
void Opm::Linear::IstlSparseMatrixAdapter< MatrixBlockType, AllocatorType >::clearRow ( const size_t row,
const Scalar diag = 1.0 )
inline

Set given row to zero except for the main-diagonal entry (if it exists).

If the sparsity pattern of the matrix features an explicit block on the main diagonal, the diagonal on that block is set to the second agument of the function.

◆ commit()

template<class MatrixBlockType , class AllocatorType = std::allocator<MatrixBlockType>>
void Opm::Linear::IstlSparseMatrixAdapter< MatrixBlockType, AllocatorType >::commit ( )
inline

Commit matrix from local caches into matrix native structure.

For the ISTL adapter this is unnecessary because there is no caching mechanism.

◆ finalize()

template<class MatrixBlockType , class AllocatorType = std::allocator<MatrixBlockType>>
void Opm::Linear::IstlSparseMatrixAdapter< MatrixBlockType, AllocatorType >::finalize ( )
inline

Finish modifying the matrix, i.e., convert the data structure from one tailored for linearization to one aimed at the linear solver.

This may compress the matrix if the build mode is implicit. For the ISTL adapter this is not required.


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