// ---------------------------------------------------------------------
//
-// Copyright (C) 2019 by the deal.II authors
+// Copyright (C) 2019-2020 by the deal.II authors
//
// This file is part of the deal.II library.
//
convert_expression_map_to_basic_map(
const SD::types::substitution_map &substitution_map);
+ /**
+ * Convert to a map of Expressions from its SymEngine counterpart.
+ */
+ SD::types::substitution_map
+ convert_basic_map_to_expression_map(
+ const SymEngine::map_basic_basic &substitution_map);
+
/**
* Convert a vector of Expressions to its SymEngine counterpart.
*/
convert_expression_vector_to_basic_vector(
const SD::types::symbol_vector &symbol_vector);
+ /**
+ * Convert to a vector of Expressions from its SymEngine counterpart.
+ */
+ SD::types::symbol_vector
+ convert_basic_vector_to_expression_vector(
+ const SymEngine::vec_basic &symbol_vector);
+
+ /**
+ * Convert to a vector of pairs of Expressions from its SymEngine
+ * counterpart.
+ */
+ std::vector<std::pair<Expression, Expression>>
+ convert_basic_pair_vector_to_expression_pair_vector(
+ const SymEngine::vec_pair &symbol_value_vector);
+
/**
* Extract the symbols (key entries) from a substitution map.
*
// ---------------------------------------------------------------------
//
-// Copyright (C) 2019 by the deal.II authors
+// Copyright (C) 2019-2020 by the deal.II authors
//
// This file is part of the deal.II library.
//
namespace Utilities
{
# ifndef DOXYGEN
+
SE::map_basic_basic
convert_expression_map_to_basic_map(
const SD::types::substitution_map &substitution_map)
sub_map[entry.first.get_RCP()] = entry.second.get_RCP();
return sub_map;
}
-# endif
+
+
+
+ SD::types::substitution_map
+ convert_basic_map_to_expression_map(
+ const SymEngine::map_basic_basic &substitution_map)
+ {
+ SD::types::substitution_map sub_map;
+ for (const auto &entry : substitution_map)
+ sub_map[Expression(entry.first)] = SD::Expression(entry.second);
+ return sub_map;
+ }
+
SE::vec_basic
}
-# ifndef DOXYGEN
+
+ SD::types::symbol_vector
+ convert_basic_vector_to_expression_vector(
+ const SE::vec_basic &symbol_vector)
+ {
+ SD::types::symbol_vector symb_vec;
+ symb_vec.reserve(symbol_vector.size());
+ for (const auto &entry : symbol_vector)
+ symb_vec.push_back(SD::Expression(entry));
+ return symb_vec;
+ }
+
+
+
SD::types::symbol_vector
extract_symbols(const SD::types::substitution_map &substitution_values)
{
return symbols;
}
-# endif
+
+
+
+ std::vector<std::pair<SD::Expression, SD::Expression>>
+ convert_basic_pair_vector_to_expression_pair_vector(
+ const SymEngine::vec_pair &symbol_value_vector)
+ {
+ std::vector<std::pair<SD::Expression, SD::Expression>> symb_val_vec;
+ symb_val_vec.reserve(symbol_value_vector.size());
+ for (const auto &entry : symbol_value_vector)
+ symb_val_vec.push_back(std::make_pair(SD::Expression(entry.first),
+ SD::Expression(entry.second)));
+ return symb_val_vec;
+ }
+
+# endif // DOXYGEN
} // namespace Utilities