]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
More doc changes. Move the include directive into the .cc file.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Jul 2005 13:20:07 +0000 (13:20 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Jul 2005 13:20:07 +0000 (13:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@11035 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/function_parser.h
deal.II/base/source/function_parser.cc

index 6f153a3bf11e30937be02c3f350a6bec0fe11fdb..d96b0da5355eeb1b88c617397ce50e1992fb564d 100644 (file)
 #include <vector>
 #include <map>
 
-#ifndef DEAL_II_DISABLE_PARSER
-#include <functionparser/fparser.h>
-#else
 namespace fparser
 {
-                                  /**
-                                   * Dummy definition if
-                                   * FunctionParser is not used.
-                                   */
-  class FunctionParser {};
-};
+  class FunctionParser;
+}
 
-#endif
 
 template <int> class Point;
 template <int, int> class Tensor;
@@ -107,7 +99,7 @@ template <typename> class Vector;
  *
  * The syntax to describe a function follows usual programming practice,
  * and is explained in this snippet from the fparser.txt file:
-      @verbatim
+   @verbatim
       The function string understood by the class is very similar to the C-syntax.
       Arithmetic float expressions can be created from float literals, variables
       or functions using the following operators in this order of precedence:
@@ -200,6 +192,60 @@ template <typename> class Vector;
   will make the program eventually run out of memory).
   @endverbatim
  *
+ * Vector-valued functions can either be declared using strings where the
+ * function components are separated by semicolons, or using a vector of
+ * strings each defining one vector component.
+ *
+ * An example of time dependent scalar function is the following:
+      @verbatim
+     
+      // Empty constants object
+      std::map<std::string> constants;
+      
+      // Variables that will be used inside the expressions
+      std::string variables = "x,y,t";
+      
+      // Define the expression of the scalar time dependent function.
+      std::string expression = "exp(y*x)*exp(-t)";
+      
+      // Generate an empty scalar function
+      FunctionParser<2> function;
+      
+      // And populate it with the newly created objects.
+      function.initialize(variables,
+                         expression,
+                         constants,
+                         true);        // This tells the parser that 
+                                       // it is a time-dependent function
+                                       // and there is another variable
+                                       // to be taken into account (t).
+     @endverbatim
+     
+ * The following is another example of how to instantiate a
+ * vector valued function by using a single string:
+     @verbatim
+     
+      // Empty constants object
+      std::map<std::string> constants;
+      
+      // Variables that will be used inside the expressions
+      std::string variables = "x,y";
+      
+      // Define the expression of the vector valued  function.
+      std::string expression = "cos(2*pi*x)*y^2; sin(2*pi*x)*exp(y)";
+      
+      // Generate an empty vector valued function
+      FunctionParser<2> function(2);
+      
+      // And populate it with the newly created objects.
+      function.initialize(variables,
+                         expression,
+                         constants);   
+     @endverbatim
+ *    
+ *
  * @author Luca Heltai, 2005
  */
 template <int dim>
@@ -311,74 +357,29 @@ class FunctionParser : public Function<dim>
                                       * default for this parameter is false,
                                       * i.e. use radians and not degrees.
                                       */
-    void initialize(const std::string vars,
-                   const std::vector<std::string> expressions,
-                   const ConstMap constants,
-                   bool time_dependent = false,
-                   bool use_degrees = false);
+    void initialize (const std::string vars,
+                     const std::vector<std::string> expressions,
+                     const ConstMap constants,
+                     const bool time_dependent = false,
+                     const bool use_degrees = false);
   
-  /** Initialize the function. Same as above, but accepts a string
-      rather than a vector of strings. If this is a vector valued
-      function, its componenents are expected to be separated by a
-      semicolon. An exception is thrown if this method is called and
-      the number of components successfully parsed does not match the
-      number of components of the base function.
-      
-      An example of time dependent scalar function is the following:
-      @verbatim
-     
-      // Empty constants object
-      std::map<std::string> constants;
-      
-      // Variables that will be used inside the expressions
-      std::string variables = "x,y,t";
-      
-      // Define the expression of the scalar time dependent function.
-      std::string expression = "exp(y*x)*exp(-t)";
-      
-      // Generate an empty scalar function
-      FunctionParser<2> function;
-      
-      // And populate it with the newly created objects.
-      function.initialize(variables,
-                         expression,
-                         constants,
-                         true);        // This tells the parser that 
-                                       // it is a time-dependent function
-                                       // and there is another variable
-                                       // to be taken into account (t).
-     @endverbatim
-     
-     The following is yet another example of how to instantiate a
-     vector valued function by using a single string:
-      @verbatim
-     
-      // Empty constants object
-      std::map<std::string> constants;
-      
-      // Variables that will be used inside the expressions
-      std::string variables = "x,y";
-      
-      // Define the expression of the vector valued  function.
-      std::string expression = "cos(2*pi*x)*y^2; sin(2*pi*x)*exp(y)";
-      
-      // Generate an empty vector valued function
-      FunctionParser<2> function(2);
-      
-      // And populate it with the newly created objects.
-      function.initialize(variables,
-                         expression,
-                         constants);   
-     @endverbatim
-      
-  */
-    void initialize(const std::string vars,
-                   const std::string expression,
-                   const ConstMap constants,
-                   bool time_dependent = false,
-                   bool use_degrees = false);
+                                     /**
+                                      * Initialize the function. Same as
+                                      * above, but accepts a string rather
+                                      * than a vector of strings. If this is a
+                                      * vector valued function, its
+                                      * componenents are expected to be
+                                      * separated by a semicolon. An exception
+                                      * is thrown if this method is called and
+                                      * the number of components successfully
+                                      * parsed does not match the number of
+                                      * components of the base function.
+                                      */
+    void initialize (const std::string vars,
+                     const std::string expression,
+                     const ConstMap constants,
+                     const bool time_dependent = false,
+                     const bool use_degrees = false);
   
 
                                     /**
index 5e851707e2fe1d3a9a039004751eefe27decdb28..a994810a765e0ea4b145b37abce2877d83b5ccb2 100644 (file)
 #include <base/point.h>
 #include <lac/vector.h>
 
+#ifndef DEAL_II_DISABLE_PARSER
+#include <functionparser/fparser.h>
+#endif
+
+
+
 // Utility to split a string given a delimiter.
 
 unsigned int SplitString(const std::string& input, 

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.