OGS
MathLib::details::EigenDirectLinearSolver< T_SOLVER > Class Template Referencefinal

Detailed Description

template<class T_SOLVER>
class MathLib::details::EigenDirectLinearSolver< T_SOLVER >

Template class for Eigen direct linear solvers.

Definition at line 122 of file EigenLinearSolver.cpp.

Inheritance diagram for MathLib::details::EigenDirectLinearSolver< T_SOLVER >:
[legend]
Collaboration diagram for MathLib::details::EigenDirectLinearSolver< T_SOLVER >:
[legend]

Public Member Functions

bool solveImpl (Vector const &b, Vector &x, EigenOption &opt) override
 
bool computeImpl (Matrix &A, EigenOption &opt, MathLib::LinearSolverBehaviour const linear_solver_behaviour) override
 
- Public Member Functions inherited from MathLib::EigenLinearSolverBase
virtual ~EigenLinearSolverBase ()=default
 
bool solve (Vector &b, Vector &x, EigenOption &opt)
 
bool compute (Matrix &A, EigenOption &opt, MathLib::LinearSolverBehaviour linear_solver_behaviour)
 

Private Attributes

T_SOLVER solver_
 

Additional Inherited Members

- Public Types inherited from MathLib::EigenLinearSolverBase
using Vector = EigenVector::RawVectorType
 
using Matrix = EigenMatrix::RawMatrixType
 
- Protected Member Functions inherited from MathLib::EigenLinearSolverBase

Member Function Documentation

◆ computeImpl()

template<class T_SOLVER >
bool MathLib::details::EigenDirectLinearSolver< T_SOLVER >::computeImpl ( Matrix & A,
EigenOption & opt,
MathLib::LinearSolverBehaviour const linear_solver_behaviour )
inlineoverridevirtual

Implements MathLib::EigenLinearSolverBase.

Definition at line 140 of file EigenLinearSolver.cpp.

143 {
144 INFO("-> compute with Eigen direct linear solver {:s}",
145 EigenOption::getSolverName(opt.solver_type));
146 if (!A.isCompressed())
147 {
148 A.makeCompressed();
149 }
150
151 solver_.compute(A);
152 if (solver_.info() != Eigen::Success)
153 {
154 ERR("Failed during Eigen linear solver initialization");
155 return false;
156 }
157
158 return true;
159 }
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45
static std::string getSolverName(SolverType const solver_type)
return a linear solver name from the solver type

References ERR(), MathLib::EigenOption::getSolverName(), INFO(), MathLib::details::EigenDirectLinearSolver< T_SOLVER >::solver_, and MathLib::EigenOption::solver_type.

◆ solveImpl()

template<class T_SOLVER >
bool MathLib::details::EigenDirectLinearSolver< T_SOLVER >::solveImpl ( Vector const & b,
Vector & x,
EigenOption & opt )
inlineoverridevirtual

Implements MathLib::EigenLinearSolverBase.

Definition at line 125 of file EigenLinearSolver.cpp.

126 {
127 INFO("-> solve with Eigen direct linear solver {:s}",
128 EigenOption::getSolverName(opt.solver_type));
129
130 x = solver_.solve(b);
131 if (solver_.info() != Eigen::Success || x.hasNaN())
132 {
133 ERR("Failed during Eigen linear solve");
134 return false;
135 }
136
137 return true;
138 }

References ERR(), MathLib::EigenOption::getSolverName(), INFO(), MathLib::details::EigenDirectLinearSolver< T_SOLVER >::solver_, and MathLib::EigenOption::solver_type.

Member Data Documentation

◆ solver_


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