24#ifndef DUMUX_LINEAR_SOLVER_HH
25#define DUMUX_LINEAR_SOLVER_HH
27#include <dune/common/exceptions.hh>
56 verbosity_ = getParamFromGroup<int>(
paramGroup,
"LinearSolver.Verbosity", 0);
57 maxIter_ = getParamFromGroup<int>(
paramGroup,
"LinearSolver.MaxIterations", 250);
58 residReduction_ = getParamFromGroup<double>(
paramGroup,
"LinearSolver.ResidualReduction", 1e-13);
59 relaxation_ = getParamFromGroup<double>(
paramGroup,
"LinearSolver.Preconditioner.Relaxation", 1);
60 precondIter_ = getParamFromGroup<int>(
paramGroup,
"LinearSolver.Preconditioner.Iterations", 1);
61 precondVerbosity_ = getParamFromGroup<int>(
paramGroup,
"LinearSolver.Preconditioner.Verbosity", 0);
68 template<
class Matrix,
class Vector>
69 bool solve(
const Matrix& A, Vector& x,
const Vector& b)
71 DUNE_THROW(Dune::NotImplemented,
"Linear solver doesn't implement a solve method!");
76 {
return "unknown solver"; }
80 {
return paramGroup_; }
84 {
return verbosity_; }
100 {
return residReduction_; }
104 { residReduction_ = r; }
108 {
return relaxation_; }
116 {
return precondIter_; }
120 { precondIter_ = i; }
124 {
return precondVerbosity_; }
128 { precondVerbosity_ = verbosityLevel; }
133 double residReduction_;
136 int precondVerbosity_;
137 const std::string paramGroup_;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Base class for linear solvers.
Definition: solver.hh:37
bool solve(const Matrix &A, Vector &x, const Vector &b)
Solve the linear system Ax = b.
Definition: solver.hh:69
int precondVerbosity() const
the preconditioner verbosity
Definition: solver.hh:123
void setResidualReduction(double r)
set the linear solver residual reduction
Definition: solver.hh:103
void setMaxIter(int i)
set the maximum number of linear solver iterations
Definition: solver.hh:95
int precondIter() const
the number of preconditioner iterations
Definition: solver.hh:115
double residReduction() const
the linear solver residual reduction
Definition: solver.hh:99
int maxIter() const
the maximum number of linear solver iterations
Definition: solver.hh:91
void setPrecondIter(int i)
set the number of preconditioner iterations
Definition: solver.hh:119
void setVerbosity(int v)
set the verbosity level
Definition: solver.hh:87
void setPrecondVerbosity(int verbosityLevel)
set the preconditioner verbosity
Definition: solver.hh:127
const std::string & paramGroup() const
the parameter group for getting parameter from the parameter tree
Definition: solver.hh:79
void setRelaxation(double r)
set the linear solver relaxation factor
Definition: solver.hh:111
LinearSolver(const std::string ¶mGroup="")
Contruct the solver.
Definition: solver.hh:53
int verbosity() const
the verbosity level
Definition: solver.hh:83
std::string name() const
the name of the linear solver
Definition: solver.hh:75
double Scalar
Definition: solver.hh:41
double relaxation() const
the linear solver relaxation factor
Definition: solver.hh:107