]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement FunctionParser::default_variable_names
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 12 May 2008 21:07:27 +0000 (21:07 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 12 May 2008 21:07:27 +0000 (21:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@16083 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/function_parser.h
deal.II/doc/news/changes.h

index 851c16e2639906ec47d1d235beb990c6679f7189..7a754ed495557163b8e92628b29346d478ee0169 100644 (file)
@@ -384,7 +384,19 @@ class FunctionParser : public Function<dim>
                      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<dim>
     unsigned int n_vars;
 };
 
+
+template <int dim>
+std::string
+FunctionParser<dim>::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
index cb8cbe9164b487ce5f11e32d9a24ff33ff9ad3d6..9e4e55e299c0794a00737fb147a12e173647ef8b 100644 (file)
@@ -147,6 +147,12 @@ inconvenience this causes.
 <h3>base</h3>
 
 <ol>
+<li> <p> 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".
+<br>
+(WB 2008/05/12)
+</p> </li>
 
 <li> <p>New: ConvergenceTable::evaluate_convergence_rates has been incomplete
 for a long time. An implementation for reduction_rate and 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.