From c5854e936c642f03709aa58d65fd8b5082fb2222 Mon Sep 17 00:00:00 2001 From: Patrick Jaap <patrick.jaap@tu-dresden.de> Date: Thu, 21 Oct 2021 13:08:31 +0200 Subject: [PATCH] Fix: LoopSolver has to execute the criteria regardless of the verbosity mode In the current implementation this caused different solution behavior depending on the chosen verbosity mode. Plain stop critera were ignored in the SOLVER::QUIET case. This patch fixed the problem. --- dune/solvers/solvers/loopsolver.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dune/solvers/solvers/loopsolver.cc b/dune/solvers/solvers/loopsolver.cc index 01593c52..7a7b4c64 100644 --- a/dune/solvers/solvers/loopsolver.cc +++ b/dune/solvers/solvers/loopsolver.cc @@ -157,20 +157,28 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve() std::cout.flags(oldFormatFlags); std::cout << this->iterationStep_->getOutput(); + } - bool stop = false; - for(auto&& c: criteria_) + // execute the stop criteria regardless of the verbosity + bool stop = false; + for(auto&& c: criteria_) + { + auto r = c(); + stop = stop or std::get<0>(r); + if (this->verbosity_ == NumProc::FULL) { - auto r = c(); - stop = stop or std::get<0>(r); - std::cout << std::get<1>(r); + std::cout << std::get<1>(r); } + } + if (this->verbosity_ == NumProc::FULL) + { std::cout << std::endl; - - if (stop) - break; } + + if (stop) + break; + } -- GitLab