Template Numerical Library: TNL::Solvers::Linear::HypreSolver Class Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TNL::Solvers::Linear::HypreSolver Class Referenceabstract
Wrappers for the Hypre library

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

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

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

## Public Types
enum | ErrorMode : std::uint8_t { 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.

## Detailed Description

Abstract class for Hypre's solvers and preconditioners.

## Member Enumeration Documentation

## ◆ ErrorMode

enum TNL::Solvers::Linear::HypreSolver::ErrorMode : std::uint8_t

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

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.

## ◆ 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

  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.

## ◆ setup()

virtual 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
| nodiscardpure 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.

## ◆ solve()

virtual 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
| nodiscardpure 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.

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

- src/TNL/Solvers/Linear/Hypre.h