Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace > Class Template Referenceabstract

Hypre structured solver interface for scalar fields. More...

#include <Cabana_Grid_HypreStructuredSolver.hpp>

Inheritance diagram for Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >:

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.
 

Detailed Description

template<class Scalar, class EntityType, class MemorySpace>
class Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >

Hypre structured solver interface for scalar fields.

Constructor & Destructor Documentation

◆ HypreStructuredSolver()

template<class Scalar, class EntityType, class MemorySpace>
template<class ArrayLayout_t>
Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::HypreStructuredSolver ( const ArrayLayout_t & layout,
const bool is_preconditioner = false )
inline

Hypre memory space compatibility check.

Constructor.

Parameters
layoutThe array layout defining the vector space of the solver.
is_preconditionerFlag indicating if this solver will be used as a preconditioner.

Member Function Documentation

◆ getFinalRelativeResidualNormImpl()

◆ getHypreSetupFunction()

◆ getHypreSolveFunction()

◆ getHypreSolver()

◆ getNumIterImpl()

◆ printLHS()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::printLHS ( const char * prefix)
inline

Print the hypre LHS to output file.

Parameters
prefixFile prefix for where hypre output is written

◆ printMatrix()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::printMatrix ( const char * prefix)
inline

Print the hypre matrix to output file.

Parameters
prefixFile prefix for where hypre output is written

◆ printRHS()

template<class Scalar, class EntityType, class MemorySpace>
void Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::printRHS ( const char * prefix)
inline

Print the hypre RHS to output file.

Parameters
prefixFile prefix for where hypre output is written

◆ setMatrixStencil()

template<class Scalar, class EntityType, class MemorySpace>
template<std::size_t NumSpaceDim>
void Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::setMatrixStencil ( const std::vector< std::array< int, NumSpaceDim > > & stencil,
const bool is_symmetric = false )
inline

Set the operator stencil.

Parameters
stencilThe (i,j,k) offsets describing the structured matrix entries at each grid point. Offsets are defined relative to an index.
is_symmetricIf true the matrix is designated as symmetric. The stencil entries should only contain one entry from each symmetric component if this is true.

◆ setMatrixValues()

template<class Scalar, class EntityType, class MemorySpace>
template<class Array_t>
void Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::setMatrixValues ( const Array_t & values)
inline

Set the matrix values.

Parameters
valuesThe 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.

◆ setMaxIterImpl()

◆ setPreconditionerImpl()

◆ setPrintLevelImpl()

◆ setToleranceImpl()

◆ setupImpl()

◆ solve()

template<class Scalar, class EntityType, class MemorySpace>
template<class Array_t>
void Cabana::Grid::HypreStructuredSolver< Scalar, EntityType, MemorySpace >::solve ( const Array_t & b,
Array_t & x )
inline

Solve the problem Ax = b for x.

Parameters
bThe forcing term.
xThe solution.

◆ solveImpl()


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