PLaSK library
Loading...
Searching...
No Matches
plask::SparseBandMatrix Struct Reference

#include <plask/common/fem/iterative_matrix.hpp>

Inheritance diagram for plask::SparseBandMatrix:
[legend]
Collaboration diagram for plask::SparseBandMatrix:
[legend]

Public Member Functions

template<typename SolverT >
 SparseBandMatrix (SolverT *solver, size_t rank, size_t major)
 Create 2D matrix.
 
template<typename SolverT >
 SparseBandMatrix (SolverT *solver, size_t rank, size_t major, size_t minor)
 Create 3D matrix.
 
template<typename SolverT >
 SparseBandMatrix (SolverT *solver, size_t rank, std::initializer_list< int > bands)
 Create band matrix.
 
doubleoperator() (size_t r, size_t c) override
 Return reference to array element.
 
void addmult (const DataVector< const double > &vector, DataVector< double > &result) override
 Multiply matrix by vector adding the result.
 
void setBC (DataVector< double > &B, size_t r, double val) override
 Set Dirichlet boundary condition.
 
- Public Member Functions inherited from plask::SparseMatrix
template<typename SolverT >
 SparseMatrix (SolverT *solver, size_t rank, size_t size, size_t isiz)
 
template<typename SolverT >
 SparseMatrix (SolverT *solver, size_t rank, size_t size)
 
 ~SparseMatrix ()
 
void solverhs (DataVector< double > &B, DataVector< double > &X) override
 Solve for the right-hand-side of a system of linear equations.
 
void mult (const DataVector< const double > &vector, DataVector< double > &result) override
 Multiply matrix by vector.
 
- Public Member Functions inherited from plask::FemMatrix
 FemMatrix (const Solver *solver, size_t rank, size_t size)
 
 FemMatrix (const FemMatrix &)=delete
 
virtual ~FemMatrix ()
 
virtual void clear ()
 Clear the matrix.
 
virtual void factorize ()
 Factorize the matrix in advance to speed up the solution.
 
void solve (DataVector< double > &B, DataVector< double > &X)
 Solve the set of linear equations.
 
void solve (DataVector< double > &B)
 Solve the set of linear equations.
 
template<typename BoundaryConditonsT >
void applyBC (const BoundaryConditonsT &bconds, DataVector< double > &B)
 Apply Dirichlet boundary conditions.
 
virtual std::string describe () const
 

Protected Member Functions

NspcgFunc get_preconditioner () override
 
- Protected Member Functions inherited from plask::SparseMatrix
virtual int get_maxnz () const
 

Additional Inherited Members

- Public Types inherited from plask::SparseMatrix
typedef void(* NspcgFunc) (...)
 
- Public Attributes inherited from plask::FemMatrix
const size_t rank
 Order of the matrix, i.e. number of columns or rows.
 
const size_t size
 Number of stored elements in the matrix.
 
doubledata
 Pointer to data.
 
const Solversolver
 Solver owning the matrix.
 
- Protected Attributes inherited from plask::SparseMatrix
inticords
 Vector of non-zero band numbers (shift from diagonal) or non-zero elements.
 
IterativeMatrixParamsparams
 
const int nstore
 
const int ndim
 
const int mdim
 
int ifact = 1
 
int nw = 0
 
int inw = 0
 
doublewksp = nullptr
 
intiwksp = nullptr
 
int kblsz = -1
 
int nbl2d = -1
 

Detailed Description

Definition at line 346 of file iterative_matrix.hpp.

Constructor & Destructor Documentation

◆ SparseBandMatrix() [1/3]

template<typename SolverT >
plask::SparseBandMatrix::SparseBandMatrix ( SolverT solver,
size_t  rank,
size_t  major 
)
inline

Create 2D matrix.

Parameters
solversolver
rankrank of the matrix
majorshift of nodes to the next row (mesh[x,y+1])

Definition at line 354 of file iterative_matrix.hpp.

◆ SparseBandMatrix() [2/3]

template<typename SolverT >
plask::SparseBandMatrix::SparseBandMatrix ( SolverT solver,
size_t  rank,
size_t  major,
size_t  minor 
)
inline

Create 3D matrix.

Parameters
solversolver
rankrank of the matrix
majorshift of nodes to the next major row (mesh[x,y,z+1])
minorshift of nodes to the next minor row (mesh[x,y+1,z])

Definition at line 372 of file iterative_matrix.hpp.

◆ SparseBandMatrix() [3/3]

template<typename SolverT >
plask::SparseBandMatrix::SparseBandMatrix ( SolverT solver,
size_t  rank,
std::initializer_list< int bands 
)
inline

Create band matrix.

Parameters
solversolver
rankrank of the matrix
bandslist of non-zero bands (shift from diagonal)

Definition at line 398 of file iterative_matrix.hpp.

Member Function Documentation

◆ addmult()

void plask::SparseBandMatrix::addmult ( const DataVector< const double > &  vector,
DataVector< double > &  result 
)
inlineoverridevirtual

Multiply matrix by vector adding the result.

Parameters
vectorvector to multiply
resultmultiplication result

Implements plask::FemMatrix.

Definition at line 419 of file iterative_matrix.hpp.

◆ get_preconditioner()

NspcgFunc plask::SparseBandMatrix::get_preconditioner ( )
inlineoverrideprotectedvirtual

Implements plask::SparseMatrix.

Definition at line 435 of file iterative_matrix.hpp.

◆ operator()()

double & plask::SparseBandMatrix::operator() ( size_t  r,
size_t  c 
)
inlineoverridevirtual

Return reference to array element.

Parameters
rindex of the element row
cindex of the element column
Returns
reference to array element

Implements plask::FemMatrix.

Definition at line 411 of file iterative_matrix.hpp.

◆ setBC()

void plask::SparseBandMatrix::setBC ( DataVector< double > &  B,
size_t  r,
double  val 
)
inlineoverridevirtual

Set Dirichlet boundary condition.

Parameters
Bright hand side of the equation
rindex of the row
valvalue of the boundary condition

Implements plask::FemMatrix.

Definition at line 460 of file iterative_matrix.hpp.


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