From 73812b779ac0b4cc822fc4eee1b32d495520fb41 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 28 Apr 2005 18:34:12 +0000 Subject: [PATCH] access inital_value als in SolverControl git-svn-id: https://svn.dealii.org/trunk@10586 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/solver_control.h | 22 +++++++++++----------- deal.II/lac/source/solver_control.cc | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/deal.II/lac/include/lac/solver_control.h b/deal.II/lac/include/lac/solver_control.h index 9f063bd29b..fce9ee7fd1 100644 --- a/deal.II/lac/include/lac/solver_control.h +++ b/deal.II/lac/include/lac/solver_control.h @@ -209,6 +209,12 @@ class SolverControl : public Subscriptor */ State last_check() const; + /** + * Return the initial convergence + * criterion. + */ + double initial_value() const; + /** * Return the convergence value of last * iteration step for which @p check was @@ -302,6 +308,11 @@ class SolverControl : public Subscriptor */ State lcheck; + /** + * Initial value. + */ + double initial_val; + /** * Last value of the convergence criterion. */ @@ -414,12 +425,6 @@ class ReductionControl : public SolverControl virtual State check (const unsigned int step, const double check_value); - /** - * Return the initial convergence - * criterion. - */ - double initial_value() const; - /** * Reduction factor. */ @@ -436,11 +441,6 @@ class ReductionControl : public SolverControl */ double reduce; - /** - * Initial value. - */ - double initial_val; - /** * Reduced tolerance. Stop iterations * if either this value is achieved diff --git a/deal.II/lac/source/solver_control.cc b/deal.II/lac/source/solver_control.cc index c8166f0f98..5e3822e418 100644 --- a/deal.II/lac/source/solver_control.cc +++ b/deal.II/lac/source/solver_control.cc @@ -98,6 +98,12 @@ SolverControl::State SolverControl::check (const unsigned int step, const double check_value) { + // if this is the first time we + // come here, then store the + // residual for later comparisons + if (step==0) + initial_val = check_value; + if (m_log_history && ((step % m_log_frequency) == 0)) deallog << "Check " << step << "\t" << check_value << std::endl; @@ -155,6 +161,13 @@ SolverControl::last_check() const } +double +SolverControl::initial_value() const +{ + return initial_val; +} + + double SolverControl::last_value() const { @@ -218,12 +231,6 @@ ReductionControl::~ReductionControl() {} -double -ReductionControl::initial_value() const { - return initial_val; -} - - SolverControl::State ReductionControl::check (const unsigned int step, const double check_value) -- 2.39.5