Commit eae5d2d1 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

simplified solverInfo by removing tolerance parameters

parent 0a4166d5
......@@ -397,16 +397,7 @@ solve(AdaptInfo& adaptInfo, bool createMatrixData, bool storeMatrixData)
}
}
if (solverInfo.doBreak()) {
std::stringstream tol_str;
if (solverInfo.absTolerance() > 0
&& solverInfo.absResidual() > solverInfo.absTolerance())
tol_str << "absTol = " << solverInfo.absTolerance() << " ";
if (solverInfo.relTolerance() > 0
&& solverInfo.relResidual() > solverInfo.relTolerance())
tol_str << "relTol = " << solverInfo.relTolerance() << " ";
error_exit("Tolerance {} could not be reached!", tol_str.str());
}
test_exit(!solverInfo.doBreak() || !solverInfo.error(), "Could not solver the linear system!");
}
......
......@@ -14,16 +14,12 @@ namespace AMDiS
/// The constructor reads needed parameters and sets solver \p prefix.
/**
* Reads parameters for a solver with name 'NAME':
* NAME->absolute tolerance \ref aTol_
* NAME->relative tolerance \ref rTol_
* NAME->info \ref info_
* NAME->break if tolerance not reached \ref breakTolNotReached_
**/
explicit SolverInfo(std::string const& prefix)
: prefix_(prefix)
{
Parameters::get(prefix + "->absolute tolerance", aTol_);
Parameters::get(prefix + "->relative tolerance", rTol_);
Parameters::get(prefix + "->info", info_);
Parameters::get(prefix + "->break if tolerance not reached", breakTolNotReached_);
}
......@@ -32,18 +28,6 @@ namespace AMDiS
* \{
*/
/// Returns \ref aTol_
double absTolerance() const
{
return aTol_;
}
/// Returns \ref rTol_
double relTolerance() const
{
return rTol_;
}
/// Returns error code in last run of an iterative solver
int errorCode() const
{
......@@ -68,12 +52,6 @@ namespace AMDiS
return relResidual_;
}
/// Returns the initfile \ref prefix_
std::string const& prefix() const
{
return prefix_;
}
/// Returns \ref createMatrixData
bool doCreateMatrixData() const
{
......@@ -100,18 +78,6 @@ namespace AMDiS
* \{
*/
/// Sets \ref aTol_
void setAbsTolerance(double tol)
{
aTol_ = tol;
}
/// Sets \ref rTol_
void setRelTolerance(double tol)
{
rTol_ = tol;
}
/// Sets \ref aTol_
void setAbsResidual(double r)
{
......@@ -154,12 +120,6 @@ namespace AMDiS
/// The initfile prefix to read parameters
std::string prefix_;
/// The abolute tolerance
double aTol_ = 0;
/// The relative tolerance
double rTol_ = 1.e-6;
/// Throw an error if tolerance could not be reached
bool breakTolNotReached_ = false;
......
......@@ -52,7 +52,6 @@ namespace AMDiS
{
DUNE_UNUSED_PARAMETER(A);
solver_.setTolerance(solverInfo.relTolerance());
x = solver_.solveWithGuess(b, x);
auto r = Vec(b);
......
......@@ -15,6 +15,11 @@ namespace AMDiS
template <class D>
static void init(std::string const& prefix, Eigen::IterativeSolverBase<D>& solver)
{
using RealScalar = typename Eigen::IterativeSolverBase<D>::RealScalar;
auto rtol = Parameters::get<RealScalar>(prefix + "->relative tolerance");
if (rtol)
solver.setTolerance(rtol.value());
int maxIter = 500;
Parameters::get(prefix + "->max iteration", maxIter);
solver.setMaxIterations(maxIter);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment