Template Numerical Library version\ main:94209208
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TNL::Solvers::Linear::HypreSolver Class Referenceabstract

Abstract class for Hypre's solvers and preconditioners. More...

#include <TNL/Solvers/Linear/Hypre.h>

Inheritance diagram for TNL::Solvers::Linear::HypreSolver:
Inheritance graph
[legend]
Collaboration diagram for TNL::Solvers::Linear::HypreSolver:
Collaboration graph
[legend]

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::HypreParCSRMatrixA = 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.
 

Detailed Description

Abstract class for Hypre's solvers and preconditioners.

Member Enumeration Documentation

◆ ErrorMode

How to treat errors returned by Hypre function calls.

Enumerator
IGNORE_HYPRE_ERRORS 

Ignore Hypre errors.

WARN_HYPRE_ERRORS 

Issue warnings on Hypre errors.

ABORT_HYPRE_ERRORS 

Abort on Hypre errors (default in base class)

Member Function Documentation

◆ postSolveHook()

virtual void TNL::Solvers::Linear::HypreSolver::postSolveHook ( ) const
inlineprotectedvirtual

◆ setMatrix()

virtual void TNL::Solvers::Linear::HypreSolver::setMatrix ( const Matrices::HypreParCSRMatrix & op,
bool reuse_setup = false )
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.

Parameters
opThe input matrix.
reuse_setupWhen 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::HyprePCG, TNL::Solvers::Linear::HypreBiCGSTAB, TNL::Solvers::Linear::HypreGMRES, and TNL::Solvers::Linear::HypreFlexGMRES.

◆ setup()

void TNL::Solvers::Linear::HypreSolver::setup ( const Containers::HypreParVector & b,
Containers::HypreParVector & x ) const
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.

◆ setupFcn()

virtual HYPRE_PtrToParSolverFcn TNL::Solvers::Linear::HypreSolver::setupFcn ( ) const
pure virtual

◆ solve()

void TNL::Solvers::Linear::HypreSolver::solve ( const Containers::HypreParVector & b,
Containers::HypreParVector & x ) const
virtual

Solve the linear system Ax=b.

This function checks if the setup function was already called and calls it if necessary.

◆ solveFcn()

virtual HYPRE_PtrToParSolverFcn TNL::Solvers::Linear::HypreSolver::solveFcn ( ) const
pure virtual

The documentation for this class was generated from the following files: