OGS
MathLib::EigenOption Struct Referencefinal

Detailed Description

Option for Eigen sparse solver.

Definition at line 18 of file EigenOption.h.

#include <EigenOption.h>

Public Types

enum class  SolverType : short {
  CG , BiCGSTAB , BiCGSTABL , IDRS ,
  IDRSTABL , SparseLU , PardisoLU , GMRES
}
 Solver type. More...
 
enum class  PreconType : short { NONE , DIAGONAL , ILUT }
 Preconditioner type. More...
 

Public Member Functions

 EigenOption ()
 

Static Public Member Functions

static SolverType getSolverType (const std::string &solver_name)
 
static PreconType getPreconType (const std::string &precon_name)
 
static std::string getSolverName (SolverType const solver_type)
 return a linear solver name from the solver type
 
static std::string getPreconName (PreconType const precon_type)
 return a preconditioner name from the preconditioner type
 

Public Attributes

SolverType solver_type
 Linear solver type.
 
PreconType precon_type
 Preconditioner type.
 
int max_iterations
 Maximum iteration count.
 
double error_tolerance
 Error tolerance.
 

Member Enumeration Documentation

◆ PreconType

enum class MathLib::EigenOption::PreconType : short
strong

Preconditioner type.

Enumerator
NONE 
DIAGONAL 
ILUT 

Definition at line 34 of file EigenOption.h.

◆ SolverType

enum class MathLib::EigenOption::SolverType : short
strong

Constructor & Destructor Documentation

◆ EigenOption()

MathLib::EigenOption::EigenOption ( )

Constructor

Default options are CG, no preconditioner, iteration count 500 and tolerance 1e-10. Default matrix storage type is CRS.

Definition at line 17 of file EigenOption.cpp.

18{
21 max_iterations = static_cast<int>(1e6);
22 error_tolerance = 1.e-16;
23#ifdef USE_EIGEN_UNSUPPORTED
24 scaling = false;
25 restart = 30;
26 l = 2;
27 s = 4;
28 angle = 0.7;
29 smoothing = false;
30 residualupdate = false;
31#endif
32}
static const double s
PreconType precon_type
Preconditioner type.
Definition EigenOption.h:44
SolverType solver_type
Linear solver type.
Definition EigenOption.h:42
double error_tolerance
Error tolerance.
Definition EigenOption.h:48
int max_iterations
Maximum iteration count.
Definition EigenOption.h:46

References error_tolerance, max_iterations, NONE, precon_type, MathLib::s, solver_type, and SparseLU.

Member Function Documentation

◆ getPreconName()

std::string MathLib::EigenOption::getPreconName ( PreconType const precon_type)
static

return a preconditioner name from the preconditioner type

Definition at line 116 of file EigenOption.cpp.

117{
118 switch (precon_type)
119 {
120 case PreconType::NONE:
121 return "NONE";
123 return "DIAGONAL";
124 case PreconType::ILUT:
125 return "ILUT";
126 }
127 return "Invalid";
128}

References DIAGONAL, ILUT, NONE, and precon_type.

Referenced by MathLib::details::EigenIterativeLinearSolver< T_SOLVER >::computeImpl(), and MathLib::details::EigenIterativeLinearSolver< T_SOLVER >::solveImpl().

◆ getPreconType()

EigenOption::PreconType MathLib::EigenOption::getPreconType ( const std::string & precon_name)
static

return a preconditioner type from the name

Parameters
precon_name
Returns
a preconditioner type If there is no preconditioner type matched with the given name, NONE is returned.

Definition at line 73 of file EigenOption.cpp.

75{
76 if (precon_name == "NONE")
77 {
78 return PreconType::NONE;
79 }
80 if (precon_name == "DIAGONAL")
81 {
83 }
84 if (precon_name == "ILUT")
85 {
86 return PreconType::ILUT;
87 }
88
89 OGS_FATAL("Unknown Eigen preconditioner type `{:s}'", precon_name);
90}
#define OGS_FATAL(...)
Definition Error.h:26

References DIAGONAL, ILUT, NONE, and OGS_FATAL.

Referenced by MathLib::LinearSolverOptionsParser< EigenLinearSolver >::parseNameAndOptions().

◆ getSolverName()

std::string MathLib::EigenOption::getSolverName ( SolverType const solver_type)
static

return a linear solver name from the solver type

Definition at line 92 of file EigenOption.cpp.

93{
94 switch (solver_type)
95 {
96 case SolverType::CG:
97 return "CG";
99 return "BiCGSTAB";
101 return "BiCGSTABL";
102 case SolverType::IDRS:
103 return "IDRS";
105 return "IDRSTABL";
107 return "SparseLU";
109 return "PardisoLU";
111 return "GMRES";
112 }
113 return "Invalid";
114}

References BiCGSTAB, BiCGSTABL, CG, GMRES, IDRS, IDRSTABL, PardisoLU, solver_type, and SparseLU.

Referenced by MathLib::details::EigenDirectLinearSolver< T_SOLVER >::computeImpl(), MathLib::details::EigenIterativeLinearSolver< T_SOLVER >::computeImpl(), MathLib::details::EigenDirectLinearSolver< T_SOLVER >::solveImpl(), and MathLib::details::EigenIterativeLinearSolver< T_SOLVER >::solveImpl().

◆ getSolverType()

EigenOption::SolverType MathLib::EigenOption::getSolverType ( const std::string & solver_name)
static

return a linear solver type from the solver name

Parameters
solver_name
Returns
a linear solver type If there is no solver type matched with the given name, INVALID is returned.

Definition at line 34 of file EigenOption.cpp.

36{
37 if (solver_name == "CG")
38 {
39 return SolverType::CG;
40 }
41 if (solver_name == "BiCGSTAB")
42 {
44 }
45 if (solver_name == "BiCGSTABL")
46 {
48 }
49 if (solver_name == "IDRS")
50 {
51 return SolverType::IDRS;
52 }
53 if (solver_name == "IDRSTABL")
54 {
56 }
57 if (solver_name == "SparseLU")
58 {
60 }
61 if (solver_name == "PardisoLU")
62 {
64 }
65 if (solver_name == "GMRES")
66 {
67 return SolverType::GMRES;
68 }
69
70 OGS_FATAL("Unknown Eigen solver type `{:s}'", solver_name);
71}

References BiCGSTAB, BiCGSTABL, CG, GMRES, IDRS, IDRSTABL, OGS_FATAL, PardisoLU, and SparseLU.

Referenced by MathLib::LinearSolverOptionsParser< EigenLinearSolver >::parseNameAndOptions().

Member Data Documentation

◆ error_tolerance

◆ max_iterations

◆ precon_type

◆ solver_type


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