From 25d6b378d199f623a3c98b6cd3f6913a69b55b43 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 31 Dec 2014 14:27:15 -0600 Subject: [PATCH] Remove deprecated functions FunctionParser::initialize(). --- doc/news/changes.h | 6 + include/deal.II/base/function_parser.h | 56 ------ include/deal.II/base/mg_level_object.h | 26 --- source/base/function_parser.cc | 211 +++++----------------- tests/base/function_parser_02.cc | 5 +- tests/trilinos/mg_transfer_prebuilt_01.cc | 6 +- 6 files changed, 58 insertions(+), 252 deletions(-) diff --git a/doc/news/changes.h b/doc/news/changes.h index f721aa59b3..2e041efdba 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -61,6 +61,12 @@ inconvenience this causes. - DataOutBase::create_xdmf_entry with 3 arguments. - Algorithms::ThetaTimestepping::operator(). - Algorithms::Newton::initialize. + - MGLevelObject::get_minlevel and MGLevelObject::get_maxlevel. + - The versions of FunctionParser::initialize that took a + use_degrees or constants argument. + The implementation as it is now no longer supports either of + these two concepts (since we switched from the FunctionParser + library to the muparser library after the deal.II 8.1 release).
  • Removed: The config.h file no longer exports HAVE_* definitions. diff --git a/include/deal.II/base/function_parser.h b/include/deal.II/base/function_parser.h index eede26438e..701471d2ac 100644 --- a/include/deal.II/base/function_parser.h +++ b/include/deal.II/base/function_parser.h @@ -226,7 +226,6 @@ public: * the FunctionParser, as declared in the constructor. If this is not the * case, an exception is thrown. * - * * constants: a map of constants used to pass any necessary constant * that we want to specify in our expressions (in the example above the * number pi). An expression is valid if and only if it contains only @@ -246,36 +245,6 @@ public: const ConstMap &constants, const bool time_dependent = false); - /** - * Same as above, but with an additional parameter: use_degrees. - * Parameter to decide if the trigonometric functions work in radians or - * degrees. The default for this parameter is false, i.e. use radians and - * not degrees. - * - * @note: this function is deprecated. Use the function without this - * argument instead (which has the default use_degrees=false). - */ - void initialize (const std::string &vars, - const std::vector &expressions, - const ConstMap &constants, - const bool time_dependent, - const bool use_degrees) DEAL_II_DEPRECATED; - - - /** - * Initialize the function. Same as above, but with an additional argument - * units - a map of units passed to FunctionParser via AddUnint. - * - * Can be used as "3cm". Have higher precedence in parsing, i.e. if cm=10 - * then 3/2cm is 3 /(2*10). - */ - void initialize (const std::string &vars, - const std::vector &expressions, - const ConstMap &constants, - const ConstMap &units, - const bool time_dependent = false, - const bool use_degrees = false) DEAL_II_DEPRECATED; - /** * Initialize the function. Same as above, but accepts a string rather than * a vector of strings. If this is a vector valued function, its components @@ -288,31 +257,6 @@ public: const ConstMap &constants, const bool time_dependent = false); - /** - * Same as above, but with an additional parameter: use_degrees. - * Parameter to decide if the trigonometric functions work in radians or - * degrees. The default for this parameter is false, i.e. use radians and - * not degrees. - * - * @note: this function is deprecated. Use the function without this - * argument instead (which has the default use_degrees=false). - */ - void initialize (const std::string &vars, - const std::string &expression, - const ConstMap &constants, - const bool time_dependent, - const bool use_degrees) DEAL_II_DEPRECATED; - - /** - * Initialize the function. Same as above, but with units. - */ - void initialize (const std::string &vars, - const std::string &expression, - const ConstMap &constants, - const ConstMap &units, - const bool time_dependent = false, - const bool use_degrees = false) DEAL_II_DEPRECATED; - /** * A function that returns default names for variables, to be used in the * first argument of the initialize() functions: it returns "x" in 1d, "x,y" diff --git a/include/deal.II/base/mg_level_object.h b/include/deal.II/base/mg_level_object.h index 3b13118cce..beea1c13f6 100644 --- a/include/deal.II/base/mg_level_object.h +++ b/include/deal.II/base/mg_level_object.h @@ -88,16 +88,6 @@ public: */ unsigned int max_level () const; - /** - * @deprecated Replaced by min_level() - */ - unsigned int get_minlevel () const DEAL_II_DEPRECATED; - - /** - * @deprecated Replaced by max_level() - */ - unsigned int get_maxlevel () const DEAL_II_DEPRECATED; - /** * Memory used by this object. */ @@ -188,22 +178,6 @@ MGLevelObject::clear () } -template -unsigned int -MGLevelObject::get_minlevel () const -{ - return minlevel; -} - - -template -unsigned int -MGLevelObject::get_maxlevel () const -{ - return minlevel + objects.size() - 1; -} - - template unsigned int MGLevelObject::min_level () const diff --git a/source/base/function_parser.cc b/source/base/function_parser.cc index 1182bd31d9..bc8e197e89 100644 --- a/source/base/function_parser.cc +++ b/source/base/function_parser.cc @@ -48,29 +48,57 @@ FunctionParser::~FunctionParser() {} #ifdef DEAL_II_WITH_MUPARSER -template -void FunctionParser::initialize (const std::string &variables, - const std::vector &expressions, - const std::map &constants, - const bool time_dependent, - const bool use_degrees) -{ - initialize (variables, - expressions, - constants, - std::map< std::string, double >(), - time_dependent, - use_degrees); -} - template -void FunctionParser::initialize (const std::string &vars, +void FunctionParser::initialize (const std::string &variables, const std::vector &expressions, const std::map &constants, const bool time_dependent) { - initialize(vars, expressions, constants, time_dependent, false); + this->fp.clear(); // this will reset all thread-local objects + + this->constants = constants; + this->var_names = Utilities::split_string_list(variables, ','); + this->expressions = expressions; + AssertThrow(((time_dependent)?dim+1:dim) == var_names.size(), + ExcMessage("Wrong number of variables")); + + // We check that the number of + // components of this function + // matches the number of components + // passed in as a vector of + // strings. + AssertThrow(this->n_components == expressions.size(), + ExcInvalidExpressionSize(this->n_components, + expressions.size()) ); + + // Now we define how many variables + // we expect to read in. We + // distinguish between two cases: + // Time dependent problems, and not + // time dependent problems. In the + // first case the number of + // variables is given by the + // dimension plus one. In the other + // case, the number of variables is + // equal to the dimension. Once we + // parsed the variables string, if + // none of this is the case, then + // an exception is thrown. + if (time_dependent) + n_vars = dim+1; + else + n_vars = dim; + + // create a parser object for the current thread we can then query + // in value() and vector_value(). this is not strictly necessary + // because a user may never call these functions on the current + // thread, but it gets us error messages about wrong formulas right + // away + init_muparser (); + + // finally set the initialization bit + initialized = true; } @@ -265,65 +293,6 @@ void FunctionParser:: init_muparser() const } -template -void FunctionParser::initialize (const std::string &variables, - const std::vector &expressions, - const std::map &constants, - const std::map &units, - const bool time_dependent, - const bool use_degrees) -{ - this->fp.clear(); // this will reset all thread-local objects - - this->constants = constants; - this->var_names = Utilities::split_string_list(variables, ','); - this->expressions = expressions; - AssertThrow(((time_dependent)?dim+1:dim) == var_names.size(), - ExcMessage("Wrong number of variables")); - AssertThrow(!use_degrees, ExcNotImplemented()); - - // We check that the number of - // components of this function - // matches the number of components - // passed in as a vector of - // strings. - AssertThrow(this->n_components == expressions.size(), - ExcInvalidExpressionSize(this->n_components, - expressions.size()) ); - - // we no longer support units: - AssertThrow(units.size()==0, ExcNotImplemented()); - - // Now we define how many variables - // we expect to read in. We - // distinguish between two cases: - // Time dependent problems, and not - // time dependent problems. In the - // first case the number of - // variables is given by the - // dimension plus one. In the other - // case, the number of variables is - // equal to the dimension. Once we - // parsed the variables string, if - // none of this is the case, then - // an exception is thrown. - if (time_dependent) - n_vars = dim+1; - else - n_vars = dim; - - // create a parser object for the current thread we can then query - // in value() and vector_value(). this is not strictly necessary - // because a user may never call these functions on the current - // thread, but it gets us error messages about wrong formulas right - // away - init_muparser (); - - // finally set the initialization bit - initialized = true; -} - - template void FunctionParser::initialize (const std::string &vars, @@ -331,45 +300,8 @@ void FunctionParser::initialize (const std::string &vars, const std::map &constants, const bool time_dependent) { - initialize(vars, expression, constants, time_dependent, false); -} - - - -template -void FunctionParser::initialize (const std::string &variables, - const std::string &expression, - const std::map &constants, - const bool time_dependent, - const bool use_degrees) -{ - // initialize with the things - // we got. - initialize (variables, - Utilities::split_string_list (expression, ';'), - constants, - time_dependent, - use_degrees); -} - - - -template -void FunctionParser::initialize (const std::string &variables, - const std::string &expression, - const std::map &constants, - const std::map &units, - const bool time_dependent, - const bool use_degrees) -{ - // initialize with the things - // we got. - initialize (variables, - Utilities::split_string_list (expression, ';'), - constants, - units, - time_dependent, - use_degrees); + initialize(vars, Utilities::split_string_list(expression, ';'), + constants, time_dependent); } @@ -435,55 +367,6 @@ void FunctionParser::vector_value (const Point &p, #else -template -void -FunctionParser::initialize(const std::string &, - const std::vector &, - const std::map &, - const bool, - const bool) -{ - Assert(false, ExcNeedsFunctionparser()); -} - - -template -void -FunctionParser::initialize(const std::string &, - const std::vector &, - const std::map &, - const std::map &, - const bool, - const bool) -{ - Assert(false, ExcNeedsFunctionparser()); -} - - -template -void -FunctionParser::initialize(const std::string &, - const std::string &, - const std::map &, - const bool, - const bool) -{ - Assert(false, ExcNeedsFunctionparser()); -} - - -template -void -FunctionParser::initialize(const std::string &, - const std::string &, - const std::map &, - const std::map &, - const bool, - const bool) -{ - Assert(false, ExcNeedsFunctionparser()); -} - template void FunctionParser::initialize(const std::string &, diff --git a/tests/base/function_parser_02.cc b/tests/base/function_parser_02.cc index 8dc84db112..97cc002948 100644 --- a/tests/base/function_parser_02.cc +++ b/tests/base/function_parser_02.cc @@ -41,7 +41,6 @@ int main () std::vector function(1); std::map constants; - std::map units; constants["PI"] = 3.141592654; constants["cm"] = 10; @@ -53,7 +52,7 @@ int main () FunctionParser<2> fp; function[0] = "x * cm + y * m + PI"; fp.initialize(FunctionParser<2>::default_variable_names(), - function, constants, units); + function, constants); deallog << "Function " << "[" << function[0] << "]" << " @point " << "[" << point << "]" << " is " << @@ -64,7 +63,7 @@ int main () //strings FunctionParser<2> fp4; fp4.initialize(FunctionParser<2>::default_variable_names(), - function[0], constants, units); + function[0], constants); deallog << "Function " << "[" << function[0] << "]" << " @point " << "[" << point << "]" << " is " << diff --git a/tests/trilinos/mg_transfer_prebuilt_01.cc b/tests/trilinos/mg_transfer_prebuilt_01.cc index 9db43d904f..c01191ef4a 100644 --- a/tests/trilinos/mg_transfer_prebuilt_01.cc +++ b/tests/trilinos/mg_transfer_prebuilt_01.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2000 - 2013 by the deal.II authors +// Copyright (C) 2000 - 2013, 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -48,8 +48,8 @@ reinit_vector (const dealii::MGDoFHandler &mg_dof, (&mg_dof.get_tria())); AssertThrow(tria!=NULL, ExcMessage("multigrid with Trilinos vectors only works with distributed Triangulation!")); - for (unsigned int level=v.get_minlevel(); - level<=v.get_maxlevel(); ++level) + for (unsigned int level=v.min_level(); + level<=v.max_level(); ++level) { v[level].reinit(mg_dof.locally_owned_mg_dofs(level), tria->get_communicator()); } -- 2.39.5