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 35 of file PETScLinearSolver.h.
#include <PETScLinearSolver.h>
Public Member Functions | |
PETScLinearSolver (std::string const &prefix, std::string const &petsc_options) | |
~PETScLinearSolver () | |
bool | solve (PETScMatrix &A, PETScVector &b, PETScVector &x) |
PetscInt | getNumberOfIterations () const |
Get number of iterations. | |
double | getElapsedTime () const |
Get elapsed wall clock time. | |
Private Attributes | |
KSP | solver_ |
Solver type. | |
PC | pc_ |
Preconditioner type. | |
double | elapsed_ctime_ = 0.0 |
Clock time. | |
MathLib::PETScLinearSolver::PETScLinearSolver | ( | std::string const & | prefix, |
std::string const & | petsc_options ) |
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. |
petsc_options | PETSc options string which is passed to PETSc lib and inserted in the PETSc option database (see https://petsc.org/release/manualpages/Sys/PetscOptionsInsertString/). |
Definition at line 23 of file PETScLinearSolver.cpp.
|
inline |
|
inline |
Get elapsed wall clock time.
Definition at line 63 of file PETScLinearSolver.h.
References elapsed_ctime_.
|
inline |
bool MathLib::PETScLinearSolver::solve | ( | PETScMatrix & | A, |
PETScVector & | b, | ||
PETScVector & | x ) |
Definition at line 45 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 69 of file PETScLinearSolver.h.
Referenced by getElapsedTime(), and solve().
|
private |
Preconditioner type.
Definition at line 67 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), and solve().
|
private |
Solver type.
Definition at line 66 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), ~PETScLinearSolver(), getNumberOfIterations(), and solve().