deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
symengine_utilities.cc
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2019 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#include <deal.II/base/config.h>
14
15#ifdef DEAL_II_WITH_SYMENGINE
16
19
20
21#endif // DEAL_II_WITH_SYMENGINE
22
24
25#ifdef DEAL_II_WITH_SYMENGINE
26
27namespace Differentiation
28{
29 namespace SD
30 {
31 namespace SE = ::SymEngine;
32
33 namespace Utilities
34 {
35# ifndef DOXYGEN
36
37 SE::map_basic_basic
39 const SD::types::substitution_map &substitution_map)
40 {
41 SE::map_basic_basic sub_map;
42 for (const auto &entry : substitution_map)
43 sub_map[entry.first.get_RCP()] = entry.second.get_RCP();
44 return sub_map;
45 }
46
47
48
51 const SymEngine::map_basic_basic &substitution_map)
52 {
54 for (const auto &entry : substitution_map)
55 sub_map[Expression(entry.first)] = SD::Expression(entry.second);
56 return sub_map;
57 }
58
59
60
61 SE::vec_basic
63 const SD::types::symbol_vector &symbol_vector)
64 {
65 SE::vec_basic symb_vec;
66 symb_vec.reserve(symbol_vector.size());
67 for (const auto &entry : symbol_vector)
68 symb_vec.push_back(entry.get_RCP());
69 return symb_vec;
70 }
71
72
73
76 const SE::vec_basic &symbol_vector)
77 {
79 symb_vec.reserve(symbol_vector.size());
80 for (const auto &entry : symbol_vector)
81 symb_vec.emplace_back(entry);
82 return symb_vec;
83 }
84
85
86
88 extract_symbols(const SD::types::substitution_map &substitution_values)
89 {
91 symbols.reserve(substitution_values.size());
92
93 for (const auto &substitution : substitution_values)
94 symbols.push_back(substitution.first);
95
96 return symbols;
97 }
98
99
100
101 std::vector<std::pair<SD::Expression, SD::Expression>>
103 const SymEngine::vec_pair &symbol_value_vector)
104 {
105 std::vector<std::pair<SD::Expression, SD::Expression>> symb_val_vec;
106 symb_val_vec.reserve(symbol_value_vector.size());
107 for (const auto &entry : symbol_value_vector)
108 symb_val_vec.emplace_back(SD::Expression(entry.first),
109 SD::Expression(entry.second));
110 return symb_val_vec;
111 }
112
113# endif // DOXYGEN
114
115 } // namespace Utilities
116
117 } // namespace SD
118} // namespace Differentiation
119
120
121
122#endif // DEAL_II_WITH_SYMENGINE
***mech_lbc_system increment_interpolation_handlers push_back(scale_z_handler)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
Point< 2 > second
Definition grid_out.cc:4640
Point< 2 > first
Definition grid_out.cc:4639
SD::types::symbol_vector extract_symbols(const SD::types::substitution_map &substitution_values)
std::vector< std::pair< Expression, Expression > > convert_basic_pair_vector_to_expression_pair_vector(const SymEngine::vec_pair &symbol_value_vector)
SD::types::substitution_map convert_basic_map_to_expression_map(const SymEngine::map_basic_basic &substitution_map)
SD::types::symbol_vector convert_basic_vector_to_expression_vector(const SymEngine::vec_basic &symbol_vector)
SymEngine::map_basic_basic convert_expression_map_to_basic_map(const SD::types::substitution_map &substitution_map)
SymEngine::vec_basic convert_expression_vector_to_basic_vector(const SD::types::symbol_vector &symbol_vector)
std::vector< SD::Expression > symbol_vector
std::map< SD::Expression, SD::Expression, internal::ExpressionKeyLess > substitution_map