Template Numerical Library version\ main:4e58ea6
|
Abstract class for Hypre's solvers and preconditioners. More...
#include <TNL/Solvers/Linear/Hypre.h>
Public Types | |
enum | ErrorMode { IGNORE_HYPRE_ERRORS , WARN_HYPRE_ERRORS , ABORT_HYPRE_ERRORS } |
How to treat errors returned by Hypre function calls. More... | |
Public Member Functions | |
HypreSolver (const Matrices::HypreParCSRMatrix &A) | |
virtual | operator HYPRE_Solver () const |
Type-cast to HYPRE_Solver. | |
void | setErrorMode (ErrorMode err_mode) const |
Set the behavior for treating Hypre errors, see the ErrorMode enum. The default mode in the base class is ABORT_HYPRE_ERRORS. | |
virtual void | setMatrix (const Matrices::HypreParCSRMatrix &op, bool reuse_setup=false) |
Set the matrix of the linear system to be solved. | |
virtual void | setup (const Containers::HypreParVector &b, Containers::HypreParVector &x) const |
Setup the solver for solving the linear system Ax=b. | |
virtual HYPRE_PtrToParSolverFcn | setupFcn () const =0 |
Hypre's internal setup function. | |
virtual void | solve (const Containers::HypreParVector &b, Containers::HypreParVector &x) const |
Solve the linear system Ax=b. | |
virtual HYPRE_PtrToParSolverFcn | solveFcn () const =0 |
Hypre's internal solve function. | |
Protected Member Functions | |
virtual void | postSolveHook () const |
Hook function that is called at the end of solve. | |
Protected Attributes | |
const Matrices::HypreParCSRMatrix * | A = nullptr |
The linear system matrix. | |
ErrorMode | error_mode = ABORT_HYPRE_ERRORS |
How to treat Hypre errors. | |
bool | setup_called = false |
Indicates if Hypre's setup function was already called. | |
HYPRE_Solver | solver = nullptr |
Handle for the Hypre solver. | |
Abstract class for Hypre's solvers and preconditioners.
|
inlineprotectedvirtual |
Hook function that is called at the end of solve.
Reimplemented in TNL::Solvers::Linear::HypreBiCGSTAB, TNL::Solvers::Linear::HypreBoomerAMG, TNL::Solvers::Linear::HypreFlexGMRES, TNL::Solvers::Linear::HypreGMRES, and TNL::Solvers::Linear::HyprePCG.
|
inlinevirtual |
Set the matrix of the linear system to be solved.
This function also resets the internal flag indicating whether the Hypre setup function was called for the current matrix.
op | The input matrix. |
reuse_setup | When true, the result of the previous setup phase will be preserved, i.e., the solver (and preconditioner) will not be updated for the new matrix when calling the solve method. |
Reimplemented in TNL::Solvers::Linear::HypreBiCGSTAB, TNL::Solvers::Linear::HypreFlexGMRES, TNL::Solvers::Linear::HypreGMRES, and TNL::Solvers::Linear::HyprePCG.
|
virtual |
Setup the solver for solving the linear system Ax=b.
Calling this function repeatedly has no effect until the internal flag is reset via the setMatrix function.
|
pure virtual |
Hypre's internal setup function.
Implemented in TNL::Solvers::Linear::HypreBiCGSTAB, TNL::Solvers::Linear::HypreBoomerAMG, TNL::Solvers::Linear::HypreDiagScale, TNL::Solvers::Linear::HypreEuclid, TNL::Solvers::Linear::HypreFlexGMRES, TNL::Solvers::Linear::HypreGMRES, TNL::Solvers::Linear::HypreIdentity, TNL::Solvers::Linear::HypreILU, TNL::Solvers::Linear::HypreParaSails, TNL::Solvers::Linear::HyprePCG, and TNL::Solvers::Linear::HypreTriSolve.
|
virtual |
Solve the linear system Ax=b.
This function checks if the setup function was already called and calls it if necessary.
|
pure virtual |
Hypre's internal solve function.
Implemented in TNL::Solvers::Linear::HypreBiCGSTAB, TNL::Solvers::Linear::HypreBoomerAMG, TNL::Solvers::Linear::HypreDiagScale, TNL::Solvers::Linear::HypreEuclid, TNL::Solvers::Linear::HypreFlexGMRES, TNL::Solvers::Linear::HypreGMRES, TNL::Solvers::Linear::HypreIdentity, TNL::Solvers::Linear::HypreILU, TNL::Solvers::Linear::HypreParaSails, TNL::Solvers::Linear::HyprePCG, and TNL::Solvers::Linear::HypreTriSolve.