Hypre structured solver interface for scalar fields. More...
#include <Cabana_Grid_HypreStructuredSolver.hpp>
Public Types | |
using | entity_type = EntityType |
Entity type. | |
using | memory_space = MemorySpace |
Kokkos memory space.. | |
using | value_type = Scalar |
Scalar value type. | |
Public Member Functions | |
template<class ArrayLayout_t> | |
HypreStructuredSolver (const ArrayLayout_t &layout, const bool is_preconditioner=false) | |
Hypre memory space compatibility check. | |
bool | isPreconditioner () const |
Return if this solver is a preconditioner. | |
template<std::size_t NumSpaceDim> | |
void | setMatrixStencil (const std::vector< std::array< int, NumSpaceDim > > &stencil, const bool is_symmetric=false) |
Set the operator stencil. | |
template<class Array_t> | |
void | setMatrixValues (const Array_t &values) |
Set the matrix values. | |
void | printMatrix (const char *prefix) |
Print the hypre matrix to output file. | |
void | printLHS (const char *prefix) |
Print the hypre LHS to output file. | |
void | printRHS (const char *prefix) |
Print the hypre RHS to output file. | |
void | setTolerance (const double tol) |
Set convergence tolerance implementation. | |
void | setMaxIter (const int max_iter) |
Set maximum iteration implementation. | |
void | setPrintLevel (const int print_level) |
Set the output level. | |
void | setPreconditioner (const std::shared_ptr< HypreStructuredSolver< Scalar, EntityType, MemorySpace > > &preconditioner) |
Set a preconditioner. | |
void | setup () |
Setup the problem. | |
template<class Array_t> | |
void | solve (const Array_t &b, Array_t &x) |
Solve the problem Ax = b for x. | |
int | getNumIter () |
Get the number of iterations taken on the last solve. | |
double | getFinalRelativeResidualNorm () |
Get the relative residual norm achieved on the last solve. | |
virtual HYPRE_StructSolver | getHypreSolver () const =0 |
Get the preconditioner. | |
virtual HYPRE_PtrToStructSolverFcn | getHypreSetupFunction () const =0 |
Get the preconditioner setup function. | |
virtual HYPRE_PtrToStructSolverFcn | getHypreSolveFunction () const =0 |
Get the preconditioner solve function. | |
Protected Member Functions | |
virtual void | setToleranceImpl (const double tol)=0 |
Set convergence tolerance implementation. | |
virtual void | setMaxIterImpl (const int max_iter)=0 |
Set maximum iteration implementation. | |
virtual void | setPrintLevelImpl (const int print_level)=0 |
Set the output level. | |
virtual void | setupImpl ()=0 |
Setup implementation. | |
virtual void | solveImpl ()=0 |
Solver implementation. | |
virtual int | getNumIterImpl ()=0 |
Get the number of iterations taken on the last solve. | |
virtual double | getFinalRelativeResidualNormImpl ()=0 |
Get the relative residual norm achieved on the last solve. | |
virtual void | setPreconditionerImpl (const HypreStructuredSolver< Scalar, EntityType, MemorySpace > &preconditioner)=0 |
Set a preconditioner. | |
void | checkHypreError (const int error) const |
Check a hypre error. | |
Protected Attributes | |
HYPRE_StructMatrix | _A |
Matrix for the problem Ax = b. | |
HYPRE_StructVector | _b |
Forcing term for the problem Ax = b. | |
HYPRE_StructVector | _x |
Solution to the problem Ax = b. | |
Hypre structured solver interface for scalar fields.
|
inline |
Hypre memory space compatibility check.
Constructor.
layout | The array layout defining the vector space of the solver. |
is_preconditioner | Flag indicating if this solver will be used as a preconditioner. |
|
protectedpure virtual |
Get the relative residual norm achieved on the last solve.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
pure virtual |
Get the preconditioner setup function.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
pure virtual |
Get the preconditioner solve function.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
pure virtual |
Get the preconditioner.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
protectedpure virtual |
Get the number of iterations taken on the last solve.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
inline |
Print the hypre LHS to output file.
prefix | File prefix for where hypre output is written |
|
inline |
Print the hypre matrix to output file.
prefix | File prefix for where hypre output is written |
|
inline |
Print the hypre RHS to output file.
prefix | File prefix for where hypre output is written |
|
inline |
Set the operator stencil.
stencil | The (i,j,k) offsets describing the structured matrix entries at each grid point. Offsets are defined relative to an index. |
is_symmetric | If true the matrix is designated as symmetric. The stencil entries should only contain one entry from each symmetric component if this is true. |
|
inline |
Set the matrix values.
values | The matrix entry values. For each entity over which the vector space is defined an entry for each stencil element is required. The order of the stencil elements is that same as that in the stencil definition. Note that values corresponding to stencil entries outside of the domain should be set to zero. |
|
protectedpure virtual |
Set maximum iteration implementation.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
protectedpure virtual |
Set a preconditioner.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
protectedpure virtual |
Set the output level.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
protectedpure virtual |
Set convergence tolerance implementation.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
protectedpure virtual |
Setup implementation.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.
|
inline |
Solve the problem Ax = b for x.
b | The forcing term. |
x | The solution. |
|
protectedpure virtual |
Solver implementation.
Implemented in Cabana::Grid::HypreStructBiCGSTAB< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructDiagonal< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructGMRES< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructJacobi< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPCG< Scalar, EntityType, MemorySpace >, Cabana::Grid::HypreStructPFMG< Scalar, EntityType, MemorySpace >, and Cabana::Grid::HypreStructSMG< Scalar, EntityType, MemorySpace >.