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

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

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

Public Member Functions

template<typename SolverT >
 SparseFreeMatrix (SolverT *solver, size_t rank, size_t maxnz)
 Create sparse matrix.
 
doubleoperator() (size_t r, size_t c) override
 Return reference to array element.
 
void clear () override
 Clear the matrix.
 
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 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
 

Public Attributes

int inz
 Number of non-zero elements.
 
int *const ir
 
int *const ic
 
- 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 Member Functions

NspcgFunc get_preconditioner () override
 
int get_maxnz () const override
 

Additional Inherited Members

- Public Types inherited from plask::SparseMatrix
typedef void(* NspcgFunc) (...)
 
- 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 486 of file iterative_matrix.hpp.

Constructor & Destructor Documentation

◆ SparseFreeMatrix()

template<typename SolverT >
plask::SparseFreeMatrix::SparseFreeMatrix ( SolverT solver,
size_t  rank,
size_t  maxnz 
)
inline

Create sparse matrix.

Parameters
solversolver
rankrank of the matrix
maxnzmaximum number of non-zero elements

Definition at line 498 of file iterative_matrix.hpp.

Member Function Documentation

◆ addmult()

void plask::SparseFreeMatrix::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 527 of file iterative_matrix.hpp.

◆ clear()

void plask::SparseFreeMatrix::clear ( )
inlineoverridevirtual

Clear the matrix.

Reimplemented from plask::FemMatrix.

Definition at line 522 of file iterative_matrix.hpp.

◆ get_maxnz()

int plask::SparseFreeMatrix::get_maxnz ( ) const
inlineoverrideprotectedvirtual

Reimplemented from plask::SparseMatrix.

Definition at line 550 of file iterative_matrix.hpp.

◆ get_preconditioner()

NspcgFunc plask::SparseFreeMatrix::get_preconditioner ( )
inlineoverrideprotectedvirtual

Implements plask::SparseMatrix.

Definition at line 539 of file iterative_matrix.hpp.

◆ operator()()

double & plask::SparseFreeMatrix::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 513 of file iterative_matrix.hpp.

◆ setBC()

void plask::SparseFreeMatrix::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 553 of file iterative_matrix.hpp.

Member Data Documentation

◆ ic

int* const plask::SparseFreeMatrix::ic

Definition at line 489 of file iterative_matrix.hpp.

◆ inz

int plask::SparseFreeMatrix::inz

Number of non-zero elements.

Definition at line 487 of file iterative_matrix.hpp.

◆ ir

int* const plask::SparseFreeMatrix::ir

Definition at line 488 of file iterative_matrix.hpp.


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