![]() |
OGS
|
A class of linear solver based on PETSc routines.
All command-line options that are not recognized by OGS are passed on to PETSc, i.e., they potentially affect the linear solver. The linear solver options in the project file take precedence over the command-line options, because the former are processed at a later stage.
Definition at line 38 of file PETScLinearSolver.h.
#include <PETScLinearSolver.h>
Public Member Functions | |
PETScLinearSolver (const std::string prefix, BaseLib::ConfigTree const *const option) | |
~PETScLinearSolver () | |
bool | solve (PETScMatrix &A, PETScVector &b, PETScVector &x) |
PetscInt | getNumberOfIterations () const |
Get number of iterations. More... | |
double | getElapsedTime () const |
Get elapsed wall clock time. More... | |
Private Attributes | |
KSP | solver_ |
Solver type. More... | |
PC | pc_ |
Preconditioner type. More... | |
double | elapsed_ctime_ = 0.0 |
Clock time. More... | |
MathLib::PETScLinearSolver::PETScLinearSolver | ( | const std::string | prefix, |
BaseLib::ConfigTree const *const | option | ||
) |
Constructor
prefix | Name used to distinguish the options in the command line for this solver. It can be the name of the PDE that owns an instance of this class. |
option | Petsc options, which will be inserted into the global petsc options database. |
Definition at line 24 of file PETScLinearSolver.cpp.
References BaseLib::ConfigTree::getConfigSubtreeOptional(), MathLib::ignoreOtherLinearSolvers(), pc_, and solver_.
|
inline |
|
inline |
Get elapsed wall clock time.
Definition at line 65 of file PETScLinearSolver.h.
References elapsed_ctime_.
|
inline |
bool MathLib::PETScLinearSolver::solve | ( | PETScMatrix & | A, |
PETScVector & | b, | ||
PETScVector & | x | ||
) |
Definition at line 76 of file PETScLinearSolver.cpp.
References BaseLib::RunTime::elapsed(), elapsed_ctime_, MathLib::PETScMatrix::getRawMatrix(), MathLib::PETScVector::getRawVector(), pc_, solver_, and BaseLib::RunTime::start().
|
private |
Clock time.
Definition at line 71 of file PETScLinearSolver.h.
Referenced by getElapsedTime(), and solve().
|
private |
Preconditioner type.
Definition at line 69 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), and solve().
|
private |
Solver type.
Definition at line 68 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), ~PETScLinearSolver(), getNumberOfIterations(), and solve().