From: guido Date: Mon, 3 May 1999 15:52:51 +0000 (+0000) Subject: Flag log_result added X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f990915f5b7c3033ce4d4ca6fe350a8027b2532;p=dealii-svn.git Flag log_result added git-svn-id: https://svn.dealii.org/trunk@1251 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/solver_control.h b/deal.II/lac/include/lac/solver_control.h index 414c278e7e..75471e2dbb 100644 --- a/deal.II/lac/include/lac/solver_control.h +++ b/deal.II/lac/include/lac/solver_control.h @@ -46,7 +46,8 @@ class SolverControl : public Subscriptor * maximal number of iterations. * */ - enum State { + enum State + { iterate = 0, success, failure }; @@ -63,10 +64,14 @@ class SolverControl : public Subscriptor * be checked and the number of * the iteration step) shall be * printed to #deallog# stream. - * Default is: do not print. + * Default is: do not print. Similarly, + * #log_result# + * specifies the whether the final result is logged + * to #deallog#. Default is yes. */ SolverControl (const unsigned int n, const double tol, - const bool log_history = false); + const bool log_history = false, + const bool log_result = true); /** * Virtual destructor is needed @@ -142,6 +147,13 @@ class SolverControl : public Subscriptor * Log convergence history to #deallog#? */ const bool log_history; + /** + * Log iteration result to #deallog#? + * If true, after finishing the iteration, a + * statement about failure or success together with + * #lstep# and #lvalue# are logged. + */ + const bool log_result; }; diff --git a/deal.II/lac/source/solver_control.cc b/deal.II/lac/source/solver_control.cc index 51ed3ab0b8..302823a644 100644 --- a/deal.II/lac/source/solver_control.cc +++ b/deal.II/lac/source/solver_control.cc @@ -9,12 +9,14 @@ SolverControl::SolverControl (const unsigned int maxiter, const double tolerance, - const bool log_history) : + const bool log_history, + const bool log_result) : maxsteps(maxiter), tol(tolerance), lvalue(1.e300), lstep(0), - log_history(log_history) + log_history(log_history), + log_result(log_result) {}; @@ -33,14 +35,16 @@ SolverControl::check (const unsigned int step, lvalue = check_value; if (step>=maxsteps) { - deallog << "Failure step " << step - << " value " << check_value << endl; + if (log_result) + deallog << "Failure step " << step + << " value " << check_value << endl; return failure; } if (check_value <= tol) { - deallog << "Convergence step " << step - << " value " << check_value << endl; + if (log_result) + deallog << "Convergence step " << step + << " value " << check_value << endl; return success; } return iterate;