15#ifndef dealii_symbolic_function_h
16#define dealii_symbolic_function_h
37template <
typename number>
41 template <
int dim,
typename RangeNumberType>
42 class SymbolicFunction;
48#ifdef DEAL_II_WITH_SYMENGINE
151 template <
int dim,
typename RangeNumberType =
double>
198 const std::vector<Differentiation::SD::Expression> &
function,
277 const std::vector<Differentiation::SD::Expression> &
295 virtual RangeNumberType
301 const unsigned int component = 0)
const override;
304 virtual RangeNumberType
306 const unsigned int component = 0)
const override;
311 const unsigned int component = 0)
const override;
317 template <
typename StreamType>
319 print(StreamType &out)
const;
388 mutable std::vector<Differentiation::SD::Expression>
function;
395 mutable std::vector<Tensor<1, dim, Differentiation::SD::Expression>>
403 mutable std::vector<Tensor<2, dim, Differentiation::SD::Expression>>
427 template <
int dim,
typename RangeNumberType>
428 inline std::ostream &
437 template <
int dim,
typename RangeNumberType>
438 template <
typename StreamType>
442 for (
unsigned int i = 0; i < dim; ++i)
443 out << coordinate_symbols[i] <<
", ";
444 for (
const auto &argument_pair : additional_function_arguments)
445 out << argument_pair.first <<
", ";
446 out << time_symbol <<
" -> " << user_function[0];
447 for (
unsigned int i = 1; i < user_function.size(); ++i)
448 out <<
"; " << user_function[i];
449 if (!user_substitution_map.empty())
452 std::string sep =
"";
453 for (
const auto &substitution : user_substitution_map)
455 out << sep << substitution.first <<
" = " << substitution.second;
463 template <
int dim,
typename RangeNumberType =
double>
472 "This class is not available if you did not enable SymEngine "
473 "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)