* the FunctionParser, as declared in the constructor. If this is not the
* case, an exception is thrown.
*
- *
* <b>constants</b>: 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
const ConstMap &constants,
const bool time_dependent = false);
- /**
- * Same as above, but with an additional parameter: <b>use_degrees</b>.
- * 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<std::string> &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
- * <b> units </b> - 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<std::string> &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
const ConstMap &constants,
const bool time_dependent = false);
- /**
- * Same as above, but with an additional parameter: <b>use_degrees</b>.
- * 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 <b>units</b>.
- */
- 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"
{}
#ifdef DEAL_II_WITH_MUPARSER
-template <int dim>
-void FunctionParser<dim>::initialize (const std::string &variables,
- const std::vector<std::string> &expressions,
- const std::map<std::string, double> &constants,
- const bool time_dependent,
- const bool use_degrees)
-{
- initialize (variables,
- expressions,
- constants,
- std::map< std::string, double >(),
- time_dependent,
- use_degrees);
-}
-
template <int dim>
-void FunctionParser<dim>::initialize (const std::string &vars,
+void FunctionParser<dim>::initialize (const std::string &variables,
const std::vector<std::string> &expressions,
const std::map<std::string, double> &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;
}
}
-template <int dim>
-void FunctionParser<dim>::initialize (const std::string &variables,
- const std::vector<std::string> &expressions,
- const std::map<std::string, double> &constants,
- const std::map<std::string, double> &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 <int dim>
void FunctionParser<dim>::initialize (const std::string &vars,
const std::map<std::string, double> &constants,
const bool time_dependent)
{
- initialize(vars, expression, constants, time_dependent, false);
-}
-
-
-
-template <int dim>
-void FunctionParser<dim>::initialize (const std::string &variables,
- const std::string &expression,
- const std::map<std::string, double> &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 <int dim>
-void FunctionParser<dim>::initialize (const std::string &variables,
- const std::string &expression,
- const std::map<std::string, double> &constants,
- const std::map<std::string, double> &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);
}
#else
-template <int dim>
-void
-FunctionParser<dim>::initialize(const std::string &,
- const std::vector<std::string> &,
- const std::map<std::string, double> &,
- const bool,
- const bool)
-{
- Assert(false, ExcNeedsFunctionparser());
-}
-
-
-template <int dim>
-void
-FunctionParser<dim>::initialize(const std::string &,
- const std::vector<std::string> &,
- const std::map<std::string, double> &,
- const std::map<std::string, double> &,
- const bool,
- const bool)
-{
- Assert(false, ExcNeedsFunctionparser());
-}
-
-
-template <int dim>
-void
-FunctionParser<dim>::initialize(const std::string &,
- const std::string &,
- const std::map<std::string, double> &,
- const bool,
- const bool)
-{
- Assert(false, ExcNeedsFunctionparser());
-}
-
-
-template <int dim>
-void
-FunctionParser<dim>::initialize(const std::string &,
- const std::string &,
- const std::map<std::string, double> &,
- const std::map<std::string, double> &,
- const bool,
- const bool)
-{
- Assert(false, ExcNeedsFunctionparser());
-}
-
template <int dim>
void
FunctionParser<dim>::initialize(const std::string &,