const double initial_time = 0.0,
const double h = 1e-8);
+ /**
+ * Constructor for Parsed functions. Take directly a semi-colon separated
+ * list of expressions (one for each component of the function), an optional
+ * comma-separated list of constants, variable names and step for the
+ * computation of first order derviatives by finite difference.
+ */
+ FunctionParser(const std::string &expression,
+ const std::string &constants = "",
+ const std::string &variable_names = default_variable_names() +
+ ",t",
+ const double h = 1e-8);
+
/**
* Destructor. Explicitly delete the FunctionParser objects (there is one
* for each component of the function).
#include <deal.II/base/function_parser.h>
+#include <deal.II/base/patterns.h>
#include <deal.II/base/thread_management.h>
#include <deal.II/base/utilities.h>
{}
+template <int dim>
+FunctionParser<dim>::FunctionParser(const std::string &expression,
+ const std::string &constants,
+ const std::string &variable_names,
+ const double h)
+ : AutoDerivativeFunction<dim>(
+ h,
+ Utilities::split_string_list(expression, ';').size())
+ , initialized(false)
+ , n_vars(0)
+{
+ auto constants_map = Patterns::Tools::Convert<ConstMap>::to_value(
+ constants,
+ Patterns::Map(Patterns::Anything(),
+ Patterns::Double(),
+ 0,
+ Patterns::Map::max_int_value,
+ ",",
+ "=")
+ .clone());
+ initialize(variable_names,
+ expression,
+ constants_map,
+ Utilities::split_string_list(variable_names, ",").size() ==
+ dim + 1);
+}
+
// We deliberately delay the definition of the default destructor
// so that we don't need to include the definition of mu::Parser