5#include <Eigen/UmfPackSupport>
6#include <unsupported/Eigen/IterativeSolvers>
8#include <amdis/Initfile.hpp>
12 template <
class Solver>
16 static void init(std::string
const& prefix, Eigen::IterativeSolverBase<D>& solver)
18 using RealScalar =
typename Eigen::IterativeSolverBase<D>::RealScalar;
19 auto rtol = Parameters::get<RealScalar>(prefix +
"->relative tolerance");
21 solver.setTolerance(rtol.value());
25 solver.setMaxIterations(maxIter);
30 static void init(std::string
const&, Eigen::SparseSolverBase<D>&) {}
33 template <
class M,
class P>
36 using Base = Eigen::IterativeSolverBase<Eigen::GMRES<M,P>>;
38 static void init(std::string
const& prefix, Eigen::GMRES<M,P>& solver)
42 auto restart = Parameters::get<int>(prefix +
"->restart");
44 solver.set_restart(restart.value());
48 template <
class M,
class P>
51 using Base = Eigen::IterativeSolverBase<Eigen::DGMRES<M,P>>;
53 static void init(std::string
const& prefix, Eigen::DGMRES<M,P>& solver)
57 auto restart = Parameters::get<int>(prefix +
"->restart");
59 solver.set_restart(restart.value());
62 auto neigs = Parameters::get<int>(prefix +
"->num eigenvalues");
64 solver.setEigenv(neigs.value());
67 auto maxNeig = Parameters::get<int>(prefix +
"->max num eigenvalues");
69 solver.setMaxEigenv(maxNeig.value());
73#if HAVE_SUITESPARSE_UMFPACK
77 static void init(std::string
const& prefix, Eigen::UmfPackLU<M>& solver)
79 [[maybe_unused]]
auto& control = solver.umfpackControl();
static std::optional< T > get(std::string const &key)
Get parameter-values from parameter-tree.
Definition: Initfile.hpp:25
Definition: SolverConfig.hpp:14