Loading [MathJax]/extensions/TeX/newcommand.js
 Reference documentation for deal.II version 9.1.1
\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
symengine_utilities.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/base/config.h>
17 
18 #ifdef DEAL_II_WITH_SYMENGINE
19 
20 # include <deal.II/differentiation/sd/symengine_number_types.h>
21 # include <deal.II/differentiation/sd/symengine_utilities.h>
22 
23 DEAL_II_NAMESPACE_OPEN
24 
25 namespace Differentiation
26 {
27  namespace SD
28  {
29  namespace SE = ::SymEngine;
30 
31  namespace Utilities
32  {
33  SE::map_basic_basic
34  convert_expression_map_to_basic_map(
35  const SD::types::substitution_map &substitution_map)
36  {
37  SE::map_basic_basic sub_map;
38  for (const auto &entry : substitution_map)
39  sub_map[entry.first.get_RCP()] = entry.second.get_RCP();
40  return sub_map;
41  }
42 
43 
44  SE::vec_basic
45  convert_expression_vector_to_basic_vector(
46  const SD::types::symbol_vector &symbol_vector)
47  {
48  SE::vec_basic symb_vec;
49  symb_vec.reserve(symbol_vector.size());
50  for (const auto &entry : symbol_vector)
51  symb_vec.push_back(entry.get_RCP());
52  return symb_vec;
53  }
54 
55 
56  SD::types::symbol_vector
57  extract_symbols(const SD::types::substitution_map &substitution_values)
58  {
59  SD::types::symbol_vector symbols;
60  symbols.reserve(substitution_values.size());
61 
62  for (typename SD::types::substitution_map::const_iterator it =
63  substitution_values.begin();
64  it != substitution_values.end();
65  ++it)
66  symbols.push_back(it->first);
67 
68  return symbols;
69  }
70 
71  } // namespace Utilities
72 
73  } // namespace SD
74 } // namespace Differentiation
75 
76 
77 DEAL_II_NAMESPACE_CLOSE
78 
79 #endif // DEAL_II_WITH_SYMENGINE
Definition: cuda.h:31