16#ifndef dealii_symbolic_function_h
17#define dealii_symbolic_function_h
38template <
typename number>
42 template <
int dim,
typename RangeNumberType>
43 class SymbolicFunction;
49#ifdef DEAL_II_WITH_SYMENGINE
152 template <
int dim,
typename RangeNumberType =
double>
199 const std::vector<Differentiation::SD::Expression> &
function,
278 const std::vector<Differentiation::SD::Expression> &
296 virtual RangeNumberType
302 const unsigned int component = 0)
const override;
305 virtual RangeNumberType
307 const unsigned int component = 0)
const override;
312 const unsigned int component = 0)
const override;
318 template <
typename StreamType>
320 print(StreamType &out)
const;
389 mutable std::vector<Differentiation::SD::Expression>
function;
396 mutable std::vector<Tensor<1, dim, Differentiation::SD::Expression>>
404 mutable std::vector<Tensor<2, dim, Differentiation::SD::Expression>>
428 template <
int dim,
typename RangeNumberType>
429 inline std::ostream &
438 template <
int dim,
typename RangeNumberType>
439 template <
typename StreamType>
443 for (
unsigned int i = 0; i < dim; ++i)
444 out << coordinate_symbols[i] <<
", ";
445 for (
const auto &argument_pair : additional_function_arguments)
446 out << argument_pair.first <<
", ";
447 out << time_symbol <<
" -> " << user_function[0];
448 for (
unsigned int i = 1; i < user_function.size(); ++i)
449 out <<
"; " << user_function[i];
450 if (!user_substitution_map.empty())
453 std::string sep =
"";
454 for (
const auto &substitution : user_substitution_map)
456 out << sep << substitution.first <<
" = " << substitution.second;
464 template <
int dim,
typename RangeNumberType =
double>
473 "This class is not available if you did not enable SymEngine "
474 "when compiling deal.II."));
StreamType & print(StreamType &out) const
const Differentiation::SD::types::substitution_map & get_user_substitution_map() const
SymbolicFunction(const std::vector< Differentiation::SD::Expression > &function, const Tensor< 1, dim, Differentiation::SD::Expression > &coordinate_symbols=get_default_coordinate_symbols(), const Differentiation::SD::Expression &time_symbol=Differentiation::SD::make_symbol("t"), const Differentiation::SD::types::substitution_map &user_substitution_map={})
std::vector< Differentiation::SD::Expression > function_laplacian
std::vector< Tensor< 2, dim, Differentiation::SD::Expression > > function_hessian
void update_values() const
const std::vector< Differentiation::SD::Expression > user_function
virtual RangeNumberType laplacian(const Point< dim > &p, const unsigned int component=0) const override
const Differentiation::SD::Expression & get_time_symbol() const
void update_first_derivatives() const
SymbolicFunction(const std::string &expressions)
static Tensor< 1, dim, Differentiation::SD::Expression > get_default_coordinate_symbols()
Differentiation::SD::types::substitution_map user_substitution_map
virtual SymmetricTensor< 2, dim, RangeNumberType > hessian(const Point< dim > &p, const unsigned int component=0) const override
void set_additional_function_arguments(const Differentiation::SD::types::substitution_map &arguments)
std::vector< Tensor< 1, dim, Differentiation::SD::Expression > > function_gradient
Differentiation::SD::types::substitution_map additional_function_arguments
void update_user_substitution_map(const Differentiation::SD::types::substitution_map &substitutions)
virtual Tensor< 1, dim, RangeNumberType > gradient(const Point< dim > &p, const unsigned int component=0) const override
Differentiation::SD::Expression time_symbol
const Tensor< 1, dim, Differentiation::SD::Expression > & get_coordinate_symbols() const
const std::vector< Differentiation::SD::Expression > & get_symbolic_function_expressions() const
SymbolicFunction< dim, RangeNumberType > time_derivative() const
virtual RangeNumberType value(const Point< dim > &p, const unsigned int component=0) const override
std::vector< Differentiation::SD::Expression > function
Differentiation::SD::types::substitution_map create_evaluation_substitution_map(const Point< dim > &point) const
Tensor< 1, dim, Differentiation::SD::Expression > coordinate_symbols
void update_second_derivatives() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
std::map< SD::Expression, SD::Expression, internal::ExpressionKeyLess > substitution_map
Expression make_symbol(const std::string &symbol)
std::ostream & operator<<(std::ostream &out, const SymbolicFunction< dim, RangeNumberType > &f)