From d7d1721615dcfa0cef684682fd216cda8d63c86f Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 14 Aug 2001 09:02:46 +0000 Subject: [PATCH] Fix leading underscores as nobody else seems to have an interest in doing it... git-svn-id: https://svn.dealii.org/trunk@4877 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/solver_control.h | 53 +++++++++++++----------- deal.II/lac/source/solver_control.cc | 30 +++++++------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/deal.II/lac/include/lac/solver_control.h b/deal.II/lac/include/lac/solver_control.h index c7b5d0de4b..d2704dcf44 100644 --- a/deal.II/lac/include/lac/solver_control.h +++ b/deal.II/lac/include/lac/solver_control.h @@ -130,10 +130,10 @@ class SolverControl : public Subscriptor * logged to @p{deallog}. Default * is yes. */ - SolverControl (const unsigned int n = 100, - const double tol = 1.e-10, - const bool log_history = false, - const bool log_result = true); + SolverControl (const unsigned int n = 100, + const double tol = 1.e-10, + const bool log_history = false, + const bool log_result = true); /** * Virtual destructor is needed @@ -197,7 +197,7 @@ class SolverControl : public Subscriptor * other computations. */ virtual State check (const unsigned int step, - const double check_value); + const double check_value); /** * Return the result of the last check operation. @@ -290,24 +290,24 @@ class SolverControl : public Subscriptor /** * Result of last check operation. */ - State lcheck; + State lcheck; /** * Last value of the convergence criterion. */ - double lvalue; + double lvalue; /** * Last step. */ - unsigned int lstep; + unsigned int lstep; /** * Is set to @p{true} by * @p{set_failure_criterion} and * enables failure checking. */ - bool check_failure; + bool check_failure; /* * Stores the @@ -332,13 +332,11 @@ class SolverControl : public Subscriptor * Log convergence history to * @p{deallog}. */ -//TODO:[GK] leading underscores are prohibited by the C++ standard in user code. what is the reason here anyway? - bool _log_history; + bool m_log_history; /** * Log only every nth step. */ -//TODO:[GK] leading underscores are prohibited by the C++ standard in user code. what is the reason here anyway? - unsigned int _log_frequency; + unsigned int m_log_frequency; /** * Log iteration result to @@ -348,8 +346,7 @@ class SolverControl : public Subscriptor * success together with @p{lstep} * and @p{lvalue} are logged. */ -//TODO:[GK] leading underscores are prohibited by the C++ standard in user code. what is the reason here anyway? - bool _log_result; + bool m_log_result; }; @@ -375,10 +372,10 @@ class ReductionControl : public SolverControl * constructor. */ ReductionControl (const unsigned int maxiter = 100, - const double tolerance = 1.e-10, - const double reduce = 1.e-2, - const bool log_history = false, - const bool log_result = true); + const double tolerance = 1.e-10, + const double reduce = 1.e-2, + const bool log_history = false, + const bool log_result = true); /** * Virtual destructor is needed @@ -406,7 +403,7 @@ class ReductionControl : public SolverControl * upon the first iteration. */ virtual State check (const unsigned int step, - const double check_value); + const double check_value); /** * Return the initial convergence @@ -424,7 +421,7 @@ class ReductionControl : public SolverControl */ double set_reduction (const double); -protected: + protected: /** * Desired reduction factor. */ @@ -454,6 +451,7 @@ SolverControl::max_steps () const } + inline unsigned int SolverControl::set_max_steps (const unsigned int newval) { @@ -463,6 +461,7 @@ SolverControl::set_max_steps (const unsigned int newval) } + inline void SolverControl::set_failure_criterion (const double rel_failure_residual) { @@ -471,6 +470,7 @@ SolverControl::set_failure_criterion (const double rel_failure_residual) } + inline void SolverControl::clear_failure_criterion () { @@ -480,6 +480,7 @@ SolverControl::clear_failure_criterion () } + inline double SolverControl::tolerance () const { @@ -487,6 +488,7 @@ SolverControl::tolerance () const } + inline double SolverControl::set_tolerance (const double t) { @@ -499,14 +501,15 @@ SolverControl::set_tolerance (const double t) inline void SolverControl::log_history (const bool newval) { - _log_history = newval; + m_log_history = newval; } + inline bool SolverControl::log_history () const { - return _log_history; + return m_log_history; } @@ -514,10 +517,11 @@ SolverControl::log_history () const inline void SolverControl::log_result (const bool newval) { - _log_result = newval; + m_log_result = newval; } + inline double ReductionControl::reduction () const { @@ -525,6 +529,7 @@ ReductionControl::reduction () const } + inline double ReductionControl::set_reduction (const double t) { diff --git a/deal.II/lac/source/solver_control.cc b/deal.II/lac/source/solver_control.cc index 9894feaa8b..828febbd79 100644 --- a/deal.II/lac/source/solver_control.cc +++ b/deal.II/lac/source/solver_control.cc @@ -60,8 +60,8 @@ SolverControl::NoConvergence::what () const throw () SolverControl::SolverControl (const unsigned int maxiter, const double tolerance, - const bool _log_history, - const bool _log_result) + const bool m_log_history, + const bool m_log_result) : maxsteps(maxiter), tol(tolerance), @@ -70,9 +70,9 @@ SolverControl::SolverControl (const unsigned int maxiter, check_failure(false), relative_failure_residual(0), failure_residual(0), - _log_history(_log_history), - _log_frequency(1), - _log_result(_log_result) + m_log_history(m_log_history), + m_log_frequency(1), + m_log_result(m_log_result) {}; @@ -86,7 +86,7 @@ SolverControl::State SolverControl::check (const unsigned int step, const double check_value) { - if (_log_history && ((step % _log_frequency) == 0)) + if (m_log_history && ((step % m_log_frequency) == 0)) deallog << "Check " << step << "\t" << check_value << std::endl; lstep = step; @@ -97,7 +97,7 @@ SolverControl::check (const unsigned int step, if (check_failure) failure_residual=relative_failure_residual*check_value; - if (_log_result) + if (m_log_result) deallog << "Starting value " << check_value << std::endl; } @@ -115,7 +115,7 @@ SolverControl::check (const unsigned int step, (check_failure && (check_value > failure_residual)) ) { - if (_log_result) + if (m_log_result) deallog << "Failure step " << step << " value " << check_value << std::endl; lcheck = failure; @@ -124,7 +124,7 @@ SolverControl::check (const unsigned int step, if (check_value <= tol) { - if (_log_result) + if (m_log_result) deallog << "Convergence step " << step << " value " << check_value << std::endl; lcheck = success; @@ -162,8 +162,8 @@ SolverControl::log_frequency (unsigned int f) { if (f==0) f = 1; - unsigned int old = _log_frequency; - _log_frequency = f; + unsigned int old = m_log_frequency; + m_log_frequency = f; return old; } @@ -194,10 +194,10 @@ void SolverControl::parse_parameters (ParameterHandler& param) ReductionControl::ReductionControl(const unsigned int n, const double tol, const double red, - const bool _log_history, - const bool _log_result) + const bool m_log_history, + const bool m_log_result) : - SolverControl (n, tol, _log_history, _log_result), + SolverControl (n, tol, m_log_history, m_log_result), reduce(red) {}; @@ -231,7 +231,7 @@ ReductionControl::check (const unsigned int step, // residual already was zero if (check_value <= reduced_tol) { - if (_log_result) + if (m_log_result) deallog << "Convergence step " << step << " value " << check_value << std::endl; lcheck = success; -- 2.39.5