17 #include <deal.II/base/config.h> 19 #ifdef DEAL_II_WITH_SYMENGINE 22 # include <deal.II/base/tensor.h> 23 # include <deal.II/base/utilities.h> 25 # include <deal.II/differentiation/sd/symengine_product_types.h> 26 # include <deal.II/differentiation/sd/symengine_scalar_operations.h> 27 # include <deal.II/differentiation/sd/symengine_tensor_operations.h> 28 # include <deal.II/differentiation/sd/symengine_types.h> 29 # include <deal.II/differentiation/sd/symengine_utilities.h> 31 DEAL_II_NAMESPACE_OPEN
48 for (
unsigned int i = 0; i < rank; ++i)
54 template <
int rank,
int dim>
58 template <
int rank,
int dim>
62 create(
const std::string &sym)
69 out[indices] = Expression(sym + std::string(
"_") +
70 internal::make_index_string(indices));
78 struct Symbol_Tensor<0, dim>
81 create(
const std::string &sym)
88 template <
int rank,
int dim>
89 struct Symbol_SymmetricTensor;
92 template <
int rank,
int dim>
93 struct Symbol_SymmetricTensor
96 create(
const std::string &sym)
103 out[indices] = Expression(sym + std::string(
"_") +
104 internal::make_index_string(indices));
112 struct Symbol_SymmetricTensor<4, dim>
115 create(
const std::string &sym)
118 for (
unsigned int i = 0;
119 i < SymmetricTensor<2, dim>::n_independent_components;
121 for (
unsigned int j = 0;
122 j < SymmetricTensor<2, dim>::n_independent_components;
126 make_rank_4_tensor_indices<dim>(i, j);
128 Expression(sym + std::string(
"_") +
129 internal::make_index_string(indices));
136 template <
int rank,
int dim>
137 struct Symbol_Function_Tensor;
140 template <
int rank,
int dim>
141 struct Symbol_Function_Tensor
144 create(
const std::string & sym,
145 const types::substitution_map &arguments)
148 const types::symbol_vector args =
149 Utilities::extract_symbols(arguments);
155 Expression(sym + std::string(
"_") +
156 internal::make_index_string(indices),
165 struct Symbol_Function_Tensor<0, dim>
168 create(
const std::string & sym,
169 const types::substitution_map &arguments)
176 template <
int rank,
int dim>
177 struct Symbol_Function_SymmetricTensor;
180 template <
int rank,
int dim>
181 struct Symbol_Function_SymmetricTensor
184 create(
const std::string & sym,
185 const types::substitution_map &arguments)
188 const types::symbol_vector args =
189 Utilities::extract_symbols(arguments);
195 Expression(sym + std::string(
"_") +
196 internal::make_index_string(indices),
205 struct Symbol_Function_SymmetricTensor<4, dim>
208 create(
const std::string & sym,
209 const types::substitution_map &arguments)
212 const types::symbol_vector args =
213 Utilities::extract_symbols(arguments);
214 for (
unsigned int i = 0;
215 i < SymmetricTensor<2, dim>::n_independent_components;
217 for (
unsigned int j = 0;
218 j < SymmetricTensor<2, dim>::n_independent_components;
222 make_rank_4_tensor_indices<dim>(i, j);
224 Expression(sym + std::string(
"_") +
225 internal::make_index_string(indices),
239 return internal::Symbol_Tensor<1, dim>::create(sym);
246 const types::substitution_map &arguments)
248 return internal::Symbol_Function_Tensor<1, dim>::create(sym, arguments);
252 template <
int rank,
int dim>
256 return internal::Symbol_Tensor<rank, dim>::create(sym);
260 template <
int rank,
int dim>
264 return internal::Symbol_SymmetricTensor<rank, dim>::create(sym);
268 template <
int rank,
int dim>
271 const types::substitution_map &arguments)
273 return internal::Symbol_Function_Tensor<rank, dim>::create(sym,
278 template <
int rank,
int dim>
281 const std::string & sym,
282 const types::substitution_map &arguments)
284 return internal::Symbol_Function_SymmetricTensor<rank, dim>::create(
293 # include "symengine_tensor_operations.inst" 295 DEAL_II_NAMESPACE_CLOSE
297 #endif // DEAL_II_WITH_SYMENGINE SymmetricTensor< rank, dim, Expression > make_symmetric_tensor_of_symbolic_functions(const std::string &symbol, const types::substitution_map &arguments)
static constexpr unsigned int n_independent_components
Tensor< 1, dim, Expression > make_vector_of_symbolic_functions(const std::string &symbol, const types::substitution_map &arguments)
Tensor< rank, dim, Expression > make_tensor_of_symbolic_functions(const std::string &symbol, const types::substitution_map &arguments)
Expression make_symbolic_function(const std::string &symbol, const types::symbol_vector &arguments)
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
static TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
static TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
Expression make_symbol(const std::string &symbol)
Tensor< 1, dim, Expression > make_vector_of_symbols(const std::string &symbol)
SymmetricTensor< rank, dim, Expression > make_symmetric_tensor_of_symbols(const std::string &symbol)
static constexpr unsigned int n_independent_components
Tensor< rank, dim, Expression > make_tensor_of_symbols(const std::string &symbol)