CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
Linear system Ax=b to be solved.
Store and solve a linear equation of the form Ax = b, where A is a square matrix, b and x are column vectors. Underlying implementation depends on compilation options. For now, only PETSc KSP is supported.
Definition at line 52 of file LinearSystem.hpp.
#include <LinearSystem.hpp>
Public Member Functions | |
LinearSystem () | |
Default constructor. More... | |
LinearSystem (InputParameters *params) | |
Constructor with inputs from strings (file) More... | |
~LinearSystem () override | |
Destructor. More... | |
void | setupWithParameters (InputParameters *params) |
Sets the options from text parameters. More... | |
virtual void | solve (DVecPtr solution) |
Solve current linear system. Calls the solver's method. More... | |
void | setLhsMatrix (DMatPtr lhs) |
Set the left-hand side matrix of the system. More... | |
void | setPreconditioningMatrix (DMatPtr preconditioningMatrix) |
Sets the preconditioning matrix. If nullptr (default) LHS is used as preconditionner. More... | |
void | setRhsVector (DVecPtr rhs) |
Set the right hand side. More... | |
void | setType (const CepsString &type) |
Set solver type which can be CG, GMRES or LU. (LU for sequential runs only) More... | |
CepsSolver & | getSolver () |
Underlying solver. More... | |
DMatPtr | getLhsMatrix () |
Left hand side. More... | |
DVecPtr | getRhsVector () |
Right hand side. More... | |
void | setTolerances (CepsReal rTol, CepsReal aTol, CepsReal dTol, CepsUInt iter) |
Sets all stopping criteria of iterative methods at once. More... | |
void | setMaxNbIterations (CepsUInt nbIterations) |
Stopping criterion for iterative solvers. More... | |
void | setRelativeTolerance (CepsReal rTol) |
Stopping criterion for iterative solvers: relative norm of residuals. More... | |
void | setAbsoluteTolerance (CepsReal aTol) |
Stopping criterion for iterative solvers: absolute norm of residuals. More... | |
void | setDivergenceTolerance (CepsReal dTol) |
Stopping criterion for iterative solvers: increase in norm of residuals. More... | |
CepsReal | getRelativeTolerance () const |
Stopping criterion for iterative solvers: relative norm of residuals. More... | |
CepsReal | getAbsoluteTolerance () const |
Stopping criterion for iterative solvers: absolute norm of residuals. More... | |
CepsReal | getDivergenceTolerance () const |
Stopping criterion for iterative solvers: increase in norm of residuals. More... | |
CepsUInt | getMaxNbIterations () const |
Stopping criterion for iterative solvers. More... | |
Public Member Functions inherited from CepsObject | |
CepsObject ()=default | |
default constructor More... | |
CepsObject (const CepsObject &)=default | |
Copy constructor. More... | |
virtual | ~CepsObject ()=default |
Destructor. More... | |
CepsObject & | operator= (const CepsObject &)=default |
Assignment operator. More... | |
CepsObject * | toBaseObject () |
Returns a pointer to CepsObject class. More... | |
const CepsObject * | toBaseObject () const |
Returns a pointer to CepsObject class, const version. More... | |
Profiler * | getProfiler () const |
Access to profiler. More... | |
Protected Attributes | |
CepsSolver | m_solver |
Underlying solver. More... | |
DMatPtr | m_lhsMatrix |
Left Hand Side (A) More... | |
DVecPtr | m_rhsVector |
Right Hand Side (B) More... | |
DMatPtr | m_precondMatrix |
Preconditioning matrix. More... | |
CepsReal | m_absoluteTolerance |
Stopping criterion for iterative methods (abs diff between iterations) More... | |
CepsReal | m_relativeTolerance |
Stopping criterion for iterative methods (rel diff between iterations) More... | |
CepsReal | m_divergenceTolerance |
Stopping criterion for iterative methods (too large diff between iterations) More... | |
CepsUInt | m_maxIterations |
Maximum of iterations for iterative methods. More... | |
CepsBool | m_isSetUp |
Is the solver ready to solve ? More... | |
CepsUInt | m_avIterNb |
average number of iterations More... | |
CepsUInt | m_nSolv |
number of calls of the solvers More... | |
Private Member Functions | |
void | initialize () |
Sets the defaults values. More... | |
void | setUp () |
Calls methods of Linear Algebra library in order to prepare the solver. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from CepsObject | |
static Profiler | m_profiler |
The same profiler for each big object. More... | |
LinearSystem::LinearSystem | ( | ) |
Default constructor.
Definition at line 32 of file PETScKSP.cpp.
|
explicit |
Constructor with inputs from strings (file)
Definition at line 37 of file PETScKSP.cpp.
|
override |
Destructor.
Definition at line 45 of file PETScKSP.cpp.
CepsReal LinearSystem::getAbsoluteTolerance | ( | ) | const |
Stopping criterion for iterative solvers: absolute norm of residuals.
Definition at line 73 of file LinearSystem.cpp.
CepsReal LinearSystem::getDivergenceTolerance | ( | ) | const |
Stopping criterion for iterative solvers: increase in norm of residuals.
Definition at line 79 of file LinearSystem.cpp.
DMatPtr LinearSystem::getLhsMatrix | ( | ) |
Left hand side.
Definition at line 55 of file LinearSystem.cpp.
CepsUInt LinearSystem::getMaxNbIterations | ( | ) | const |
Stopping criterion for iterative solvers.
Definition at line 258 of file PETScKSP.cpp.
CepsReal LinearSystem::getRelativeTolerance | ( | ) | const |
Stopping criterion for iterative solvers: relative norm of residuals.
Definition at line 67 of file LinearSystem.cpp.
DVecPtr LinearSystem::getRhsVector | ( | ) |
Right hand side.
Definition at line 61 of file LinearSystem.cpp.
CepsSolver & LinearSystem::getSolver | ( | ) |
Underlying solver.
Definition at line 49 of file LinearSystem.cpp.
|
private |
Sets the defaults values.
Definition at line 264 of file PETScKSP.cpp.
void LinearSystem::setAbsoluteTolerance | ( | CepsReal | aTol | ) |
Stopping criterion for iterative solvers: absolute norm of residuals.
Definition at line 238 of file PETScKSP.cpp.
void LinearSystem::setDivergenceTolerance | ( | CepsReal | dTol | ) |
Stopping criterion for iterative solvers: increase in norm of residuals.
Definition at line 248 of file PETScKSP.cpp.
void LinearSystem::setLhsMatrix | ( | DMatPtr | lhs | ) |
Set the left-hand side matrix of the system.
Definition at line 123 of file PETScKSP.cpp.
void LinearSystem::setMaxNbIterations | ( | CepsUInt | nbIterations | ) |
Stopping criterion for iterative solvers.
Definition at line 216 of file PETScKSP.cpp.
void LinearSystem::setPreconditioningMatrix | ( | DMatPtr | preconditioningMatrix | ) |
Sets the preconditioning matrix. If nullptr (default) LHS is used as preconditionner.
Definition at line 133 of file PETScKSP.cpp.
void LinearSystem::setRelativeTolerance | ( | CepsReal | rTol | ) |
Stopping criterion for iterative solvers: relative norm of residuals.
Definition at line 228 of file PETScKSP.cpp.
void LinearSystem::setRhsVector | ( | DVecPtr | rhs | ) |
Set the right hand side.
Definition at line 141 of file PETScKSP.cpp.
Sets all stopping criteria of iterative methods at once.
[in] | rTol | relative difference to reach between iterations |
[in] | aTol | absolute difference to reach between iterations |
[in] | dTol | divergence between iterations |
[in] | iter | maximum number of iterations |
Definition at line 206 of file PETScKSP.cpp.
void LinearSystem::setType | ( | const CepsString & | type | ) |
Set solver type which can be CG, GMRES or LU. (LU for sequential runs only)
Definition at line 149 of file PETScKSP.cpp.
|
private |
Calls methods of Linear Algebra library in order to prepare the solver.
Definition at line 191 of file PETScKSP.cpp.
void LinearSystem::setupWithParameters | ( | InputParameters * | params | ) |
Sets the options from text parameters.
Definition at line 38 of file LinearSystem.cpp.
|
virtual |
Solve current linear system. Calls the solver's method.
PETSc implementation: This method is just a simple wrapper. Users familiar with PETSc should be able to do whatever they want by using the PETSc KSP object returned by LinearSystem::getSolver(...)
[out] | solution | pointer to the DistributedVector that will hold the solution |
Definition at line 54 of file PETScKSP.cpp.
|
protected |
Stopping criterion for iterative methods (abs diff between iterations)
Definition at line 168 of file LinearSystem.hpp.
|
protected |
average number of iterations
Definition at line 175 of file LinearSystem.hpp.
|
protected |
Stopping criterion for iterative methods (too large diff between iterations)
Definition at line 170 of file LinearSystem.hpp.
|
protected |
Is the solver ready to solve ?
Definition at line 173 of file LinearSystem.hpp.
|
protected |
Left Hand Side (A)
Definition at line 164 of file LinearSystem.hpp.
|
protected |
Maximum of iterations for iterative methods.
Definition at line 171 of file LinearSystem.hpp.
|
protected |
number of calls of the solvers
Definition at line 176 of file LinearSystem.hpp.
|
protected |
Preconditioning matrix.
Definition at line 166 of file LinearSystem.hpp.
|
protected |
Stopping criterion for iterative methods (rel diff between iterations)
Definition at line 169 of file LinearSystem.hpp.
|
protected |
Right Hand Side (B)
Definition at line 165 of file LinearSystem.hpp.
|
protected |
Underlying solver.
Definition at line 163 of file LinearSystem.hpp.