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 , LeastSquareCG , BiCGSTAB , BiCGSTABL ,
  IDRS , IDRSTABL , SparseLU , PardisoLU ,
  GMRES
}
 Solver type. More...
 
enum class  PreconType : short { NONE , DIAGONAL , LeastSquareDIAGONAL , 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 
LeastSquareDIAGONAL 
ILUT 

Definition at line 35 of file EigenOption.h.

◆ SolverType

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:46
SolverType solver_type
Linear solver type.
Definition EigenOption.h:44
double error_tolerance
Error tolerance.
Definition EigenOption.h:50
int max_iterations
Maximum iteration count.
Definition EigenOption.h:48

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 126 of file EigenOption.cpp.

127{
128 switch (precon_type)
129 {
130 case PreconType::NONE:
131 return "NONE";
133 return "DIAGONAL";
135 return "LeastSquareDIAGONAL";
136 case PreconType::ILUT:
137 return "ILUT";
138 }
139 return "Invalid";
140}

References DIAGONAL, ILUT, LeastSquareDIAGONAL, 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 77 of file EigenOption.cpp.

79{
80 if (precon_name == "NONE")
81 {
82 return PreconType::NONE;
83 }
84 if (precon_name == "DIAGONAL")
85 {
87 }
88 if (precon_name == "LeastSquareDIAGONAL")
89 {
91 }
92 if (precon_name == "ILUT")
93 {
94 return PreconType::ILUT;
95 }
96
97 OGS_FATAL("Unknown Eigen preconditioner type `{:s}'", precon_name);
98}
#define OGS_FATAL(...)
Definition Error.h:26

References DIAGONAL, ILUT, LeastSquareDIAGONAL, 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 100 of file EigenOption.cpp.

101{
102 switch (solver_type)
103 {
104 case SolverType::CG:
105 return "CG";
107 return "LeastSquareCG";
109 return "BiCGSTAB";
111 return "BiCGSTABL";
112 case SolverType::IDRS:
113 return "IDRS";
115 return "IDRSTABL";
117 return "SparseLU";
119 return "PardisoLU";
121 return "GMRES";
122 }
123 return "Invalid";
124}

References BiCGSTAB, BiCGSTABL, CG, GMRES, IDRS, IDRSTABL, LeastSquareCG, 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 == "LeastSquareCG")
42 {
44 }
45 if (solver_name == "BiCGSTAB")
46 {
48 }
49 if (solver_name == "BiCGSTABL")
50 {
52 }
53 if (solver_name == "IDRS")
54 {
55 return SolverType::IDRS;
56 }
57 if (solver_name == "IDRSTABL")
58 {
60 }
61 if (solver_name == "SparseLU")
62 {
64 }
65 if (solver_name == "PardisoLU")
66 {
68 }
69 if (solver_name == "GMRES")
70 {
71 return SolverType::GMRES;
72 }
73
74 OGS_FATAL("Unknown Eigen solver type `{:s}'", solver_name);
75}

References BiCGSTAB, BiCGSTABL, CG, GMRES, IDRS, IDRSTABL, LeastSquareCG, 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: