Reference documentation for deal.II version 9.6.0
\(\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: LGPL-2.1-or-later
4// Copyright (C) 2019 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#include <deal.II/base/config.h>
16
17#ifdef DEAL_II_WITH_SYMENGINE
18
21
23
24namespace Differentiation
25{
26 namespace SD
27 {
28 namespace SE = ::SymEngine;
29
30 namespace Utilities
31 {
32# ifndef DOXYGEN
33
34 SE::map_basic_basic
36 const SD::types::substitution_map &substitution_map)
37 {
38 SE::map_basic_basic sub_map;
39 for (const auto &entry : substitution_map)
40 sub_map[entry.first.get_RCP()] = entry.second.get_RCP();
41 return sub_map;
42 }
43
44
45
48 const SymEngine::map_basic_basic &substitution_map)
49 {
51 for (const auto &entry : substitution_map)
52 sub_map[Expression(entry.first)] = SD::Expression(entry.second);
53 return sub_map;
54 }
55
56
57
58 SE::vec_basic
60 const SD::types::symbol_vector &symbol_vector)
61 {
62 SE::vec_basic symb_vec;
63 symb_vec.reserve(symbol_vector.size());
64 for (const auto &entry : symbol_vector)
65 symb_vec.push_back(entry.get_RCP());
66 return symb_vec;
67 }
68
69
70
73 const SE::vec_basic &symbol_vector)
74 {
76 symb_vec.reserve(symbol_vector.size());
77 for (const auto &entry : symbol_vector)
78 symb_vec.emplace_back(entry);
79 return symb_vec;
80 }
81
82
83
85 extract_symbols(const SD::types::substitution_map &substitution_values)
86 {
88 symbols.reserve(substitution_values.size());
89
90 for (const auto &substitution : substitution_values)
91 symbols.push_back(substitution.first);
92
93 return symbols;
94 }
95
96
97
98 std::vector<std::pair<SD::Expression, SD::Expression>>
100 const SymEngine::vec_pair &symbol_value_vector)
101 {
102 std::vector<std::pair<SD::Expression, SD::Expression>> symb_val_vec;
103 symb_val_vec.reserve(symbol_value_vector.size());
104 for (const auto &entry : symbol_value_vector)
105 symb_val_vec.emplace_back(SD::Expression(entry.first),
106 SD::Expression(entry.second));
107 return symb_val_vec;
108 }
109
110# endif // DOXYGEN
111
112 } // namespace Utilities
113
114 } // namespace SD
115} // namespace Differentiation
116
117
119
120#endif // DEAL_II_WITH_SYMENGINE
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
Point< 2 > second
Definition grid_out.cc:4624
Point< 2 > first
Definition grid_out.cc:4623
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::map< SD::Expression, SD::Expression, internal::ExpressionKeyLess > substitution_map
std::vector< SD::Expression > symbol_vector