From 56debe804056e56a2e3d224d5366a9e37b739ca3 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Tue, 3 Jun 2014 04:58:51 +0000 Subject: [PATCH] make parameter parsing more conforming to other classes git-svn-id: https://svn.dealii.org/trunk@33008 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/algorithms/newton.h | 14 +++++++---- .../deal.II/algorithms/newton.templates.h | 9 ++++++- .../deal.II/algorithms/operator.templates.h | 2 +- .../deal.II/algorithms/theta_timestepping.h | 24 ++++++++++++++----- .../algorithms/theta_timestepping.templates.h | 10 +++++++- 5 files changed, 45 insertions(+), 14 deletions(-) diff --git a/deal.II/include/deal.II/algorithms/newton.h b/deal.II/include/deal.II/algorithms/newton.h index c3bc9f4b9d..2d2e162feb 100644 --- a/deal.II/include/deal.II/algorithms/newton.h +++ b/deal.II/include/deal.II/algorithms/newton.h @@ -79,15 +79,19 @@ namespace Algorithms Newton (Operator &residual, Operator &inverse_derivative); /** - * Declare the parameters - * applicable to Newton's method. + * Declare the parameters applicable to Newton's method. */ - void declare_parameters (ParameterHandler ¶m); + static void declare_parameters (ParameterHandler ¶m); /** - * Read the parameters. + * Read the parameters in the ParameterHandler. */ - void initialize (ParameterHandler ¶m); + void parse_parameters (ParameterHandler ¶m); + + /** + * @deprecated Use parse_parameters(). + */ + void initialize (ParameterHandler ¶m) DEAL_II_DEPRECATED; /** * Initialize the pointer diff --git a/deal.II/include/deal.II/algorithms/newton.templates.h b/deal.II/include/deal.II/algorithms/newton.templates.h index c397fd22be..9e3d62466d 100644 --- a/deal.II/include/deal.II/algorithms/newton.templates.h +++ b/deal.II/include/deal.II/algorithms/newton.templates.h @@ -55,7 +55,7 @@ namespace Algorithms template void - Newton::initialize (ParameterHandler ¶m) + Newton::parse_parameters (ParameterHandler ¶m) { param.enter_subsection("Newton"); control.parse_parameters (param); @@ -65,6 +65,13 @@ namespace Algorithms param.leave_subsection (); } + template + void + Newton::initialize (ParameterHandler ¶m) + { + parse_parameters(param); + } + template void Newton::initialize (OutputOperator &output) diff --git a/deal.II/include/deal.II/algorithms/operator.templates.h b/deal.II/include/deal.II/algorithms/operator.templates.h index db13a00094..0c1ee9d6cd 100644 --- a/deal.II/include/deal.II/algorithms/operator.templates.h +++ b/deal.II/include/deal.II/algorithms/operator.templates.h @@ -131,7 +131,7 @@ namespace Algorithms { const VECTOR *v = vectors.try_read_ptr(i); if (v == 0) continue; - deallog << vectors.name(i); + deallog << vectors.name(i); for (unsigned int j=0; jsize(); ++j) deallog << ' ' << (*v)(j); deallog << std::endl; diff --git a/deal.II/include/deal.II/algorithms/theta_timestepping.h b/deal.II/include/deal.II/algorithms/theta_timestepping.h index 492af1cee1..ff6262cbab 100644 --- a/deal.II/include/deal.II/algorithms/theta_timestepping.h +++ b/deal.II/include/deal.II/algorithms/theta_timestepping.h @@ -240,8 +240,20 @@ namespace Algorithms */ void set_output(OutputOperator &output); - void declare_parameters (ParameterHandler ¶m); - void initialize (ParameterHandler ¶m); + /** + * Declare parameters in a parameter handler. + */ + static void declare_parameters (ParameterHandler ¶m); + + /** + * Read the parameters in the ParameterHandler. + */ + void parse_parameters (ParameterHandler ¶m); + + /** + * @deprecated Use parse_parameters(). + */ + void initialize (ParameterHandler ¶m) DEAL_II_DEPRECATED; /** * The current time in the * timestepping scheme. @@ -256,9 +268,9 @@ namespace Algorithms */ double theta() const; - /** - * Set a new weight and return the old - */ + /** + * Set a new weight and return the old + */ double theta(double new_theta); /** @@ -401,7 +413,7 @@ namespace Algorithms double ThetaTimestepping::current_time () const { return control.now(); - } + } } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h b/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h index 78d92783bf..a3402f6dd0 100644 --- a/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h +++ b/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h @@ -51,7 +51,7 @@ namespace Algorithms template void - ThetaTimestepping::initialize (ParameterHandler ¶m) + ThetaTimestepping::parse_parameters (ParameterHandler ¶m) { param.enter_subsection("ThetaTimestepping"); control.parse_parameters (param); @@ -61,6 +61,14 @@ namespace Algorithms } + template + void + ThetaTimestepping::initialize (ParameterHandler ¶m) + { + parse_parameters(param); + } + + template void ThetaTimestepping::operator() (NamedData &out, const NamedData &in) -- 2.39.5