DUNE-FEM (unstable)

Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector > Class Template Reference

SparseRowMatrix. More...

#include <dune/fem/operator/matrix/spmatrix.hh>

Public Types

typedef T field_type
 matrix field type
 
typedef IndexT size_type
 matrix index type
 
typedef ThisType MatrixBaseType
 

Public Member Functions

 SparseRowMatrix (const bool threading=true)
 construct matrix of zero size
 
 SparseRowMatrix (const size_type rows, const size_type cols, const size_type nz, const bool threading=true)
 
void reserve (const size_type rows, const size_type cols, const size_type nz)
 reserve memory for given rows, columns and number of non zeros
 
template<class Stencil >
void fillPattern (const Stencil &stencil, const size_type rowBlockSize, const size_type colBlockSize)
 reserve memory for given rows, columns and number of non zeros
 
size_type rows () const
 return number of rows
 
size_type cols () const
 return number of columns
 
void set (const size_type row, const size_type col, const field_type val)
 set entry to value (also setting 0 will result in an entry)
 
void add (const size_type row, const size_type col, const field_type val)
 add value to row,col entry
 
template<class ArgDFType , class DestDFType >
void apply (const ArgDFType &f, DestDFType &ret) const
 ret = A*f
 
field_type get (const size_type row, const size_type col) const
 return value of entry (row,col)
 
void clear ()
 set all matrix entries to zero
 
void clearRow (const size_type row)
 set all entries in row to zero
 
void scale (const size_type row, const size_type col, const field_type val)
 scale all entries in row with a given value
 
size_type maxNzPerRow () const
 
size_type numNonZeros () const
 
size_type numNonZeros (size_type row) const
 
std::pair< const field_type, size_typerealValue (size_type index) const
 
void print (std::ostream &s=std::cout, unsigned int offset=0) const
 print matrix
 
template<class DiagType , class ArgDFType , class DestDFType , class WType >
void forwardIterative (const DiagType &diagInv, const ArgDFType &b, const DestDFType &xold, DestDFType &xnew, const WType &w) const
 Apply Jacobi/SOR method.
 
template<class DiagType , class ArgDFType , class DestDFType , class WType >
void backwardIterative (const DiagType &diagInv, const ArgDFType &b, const DestDFType &xold, DestDFType &xnew, const WType &w) const
 Apply Jacobi/SOR method.
 

Protected Member Functions

template<class DiagIt , class ArgDFIt , class DestDFType , class DestDFIt , class WType , bool forward>
void doParallelIterative (DiagIt diag, ArgDFIt bit, const DestDFType &xold, DestDFIt xit, const WType &w, size_type row, const size_type end, std::integral_constant< bool, forward >) const
 Apply Jacobi/SOR method.
 
void resize (size_type rows, size_type cols, size_type nz)
 resize matrix
 
size_type colIndex (size_type row, size_type col)
 returns local col index for given global (row,col)
 

Detailed Description

template<class T, class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
class Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >

SparseRowMatrix.

Member Typedef Documentation

◆ MatrixBaseType

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
typedef ThisType Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::MatrixBaseType

type of the base matrix for consistency with ISTLMatrixObject

Constructor & Destructor Documentation

◆ SparseRowMatrix()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::SparseRowMatrix ( const size_type  rows,
const size_type  cols,
const size_type  nz,
const bool  threading = true 
)
inline

construct matrix with 'rows' rows and 'cols' columns, maximum 'nz' non zero values in each row

Member Function Documentation

◆ maxNzPerRow()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::maxNzPerRow ( ) const
inline

return max number of non zeros used in SparseRowMatrixObject::reserve

◆ numNonZeros() [1/2]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::numNonZeros ( ) const
inline

return max number of non zeros used in SparseRowMatrixObject::reserve

◆ numNonZeros() [2/2]

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
size_type Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::numNonZeros ( size_type  row) const
inline

return number of non zeros in row used in ColCompMatrix::setMatrix

◆ realValue()

template<class T , class IndexT = std::size_t, class ValuesVector = std::vector< T >, class IndicesVector = std::vector< IndexT >>
std::pair< const field_type, size_type > Dune::Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector >::realValue ( size_type  index) const
inline

return pair (value,column) used in ColCompMatrix::setMatrix and FemPy CRS matrix export


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)