From 5848ee74fac4055966df7c8f7f2e9529251fd8f4 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 12 May 2008 21:07:27 +0000 Subject: [PATCH] Implement FunctionParser::default_variable_names git-svn-id: https://svn.dealii.org/trunk@16083 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/function_parser.h | 35 ++++++++++++++++++++- deal.II/doc/news/changes.h | 6 ++++ 2 files changed, 40 insertions(+), 1 deletion(-) 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 -- 2.39.5