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 37 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. | |
bool | canSolveRectangular () const |
Get, if the solver can handle rectangular equation systems. | |
Private Member Functions | |
bool | canSolverHandleRectangular (std::string_view ksp_type) |
Private Attributes | |
KSP | solver_ |
Solver type. | |
PC | pc_ |
Preconditioner type. | |
bool | can_solve_rectangular_ = false |
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.
References can_solve_rectangular_, canSolverHandleRectangular(), pc_, and solver_.
|
inline |
|
inline |
Get, if the solver can handle rectangular equation systems.
Definition at line 68 of file PETScLinearSolver.h.
References can_solve_rectangular_.
|
inlineprivate |
Definition at line 71 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver().
|
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 49 of file PETScLinearSolver.cpp.
References BaseLib::RunTime::elapsed(), elapsed_ctime_, MathLib::PETScMatrix::getRawMatrix(), MathLib::PETScVector::getRawVector(), pc_, solver_, and BaseLib::RunTime::start().
|
private |
Definition at line 85 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), and canSolveRectangular().
|
private |
Clock time.
Definition at line 87 of file PETScLinearSolver.h.
Referenced by getElapsedTime(), and solve().
|
private |
Preconditioner type.
Definition at line 83 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), and solve().
|
private |
Solver type.
Definition at line 82 of file PETScLinearSolver.h.
Referenced by PETScLinearSolver(), ~PETScLinearSolver(), getNumberOfIterations(), and solve().