From: bangerth Date: Mon, 12 May 2008 21:07:27 +0000 (+0000) Subject: Implement FunctionParser::default_variable_names X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5848ee74fac4055966df7c8f7f2e9529251fd8f4;p=dealii-svn.git Implement FunctionParser::default_variable_names git-svn-id: https://svn.dealii.org/trunk@16083 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/function_parser.h b/deal.II/base/include/base/function_parser.h index 851c16e263..7a754ed495 100644 --- a/deal.II/base/include/base/function_parser.h +++ b/deal.II/base/include/base/function_parser.h @@ -384,7 +384,19 @@ class FunctionParser : public Function const ConstMap &constants, const bool time_dependent = false, const bool use_degrees = false); - + + /** + * 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" in 2d, and "x,y,z" + * in 3d. + */ + static + std::string + default_variable_names (); /** * Return the value of the @@ -459,6 +471,27 @@ class FunctionParser : public Function unsigned int n_vars; }; + +template +std::string +FunctionParser::default_variable_names () +{ + switch (dim) + { + case 1: + return "x"; + case 2: + return "x,y"; + case 3: + return "x,y,z"; + default: + Assert (false, ExcNotImplemented()); + } + return ""; +} + + + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index cb8cbe9164..9e4e55e299 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -147,6 +147,12 @@ inconvenience this causes.

base

    +
  1. New: The FunctionParser::default_variable_names() function returns +default names for variables in the given space dimension. For example, in +2d, this would be "x,y". +
    +(WB 2008/05/12) +

  2. New: ConvergenceTable::evaluate_convergence_rates has been incomplete for a long time. An implementation for reduction_rate and