const std::pair<SymbolicType, ValueType> &symbol_value,
const Args &... other_symbol_values);
+ /**
+ * Concatenate two symbolic maps, merging a second map @p substitution_map_in
+ * in-place into the initial and resultant map @p substitution_map_out. The map
+ * @p substitution_map_out need not initially be empty.
+ *
+ * @note Duplicate symbols (keys) in the maps are permitted, so long as their
+ * values are equal. If this is not the case then an error will be thrown.
+ */
+ void
+ merge_substitution_maps(types::substitution_map & substitution_map_out,
+ const types::substitution_map &substitution_map_in);
+
+ /**
+ * Concatenate multiple symbolic maps, merging the maps @p substitution_map_in
+ * and @p other_substitution_maps_in, a collection of other maps,
+ * in-place into the resultant map @p substitution_map_out. The map
+ * @p substitution_map_out need not initially be empty.
+ *
+ * @note Duplicate symbols (keys) in the maps are permitted, so long as their
+ * values are equal. If this is not the case then an error will be thrown.
+ */
+ template <typename... Args>
+ void
+ merge_substitution_maps(types::substitution_map & substitution_map_out,
+ const types::substitution_map &substitution_map_in,
+ const Args &... other_substitution_maps_in);
+
+ /**
+ * Concatenate multiple symbolic maps, merging the maps @p substitution_map_in
+ * and @p other_substitution_maps_in and returning the result.
+ *
+ * @note Duplicate symbols (keys) in the maps are permitted, so long as their
+ * values are equal. If this is not the case then an error will be thrown.
+ */
+ template <typename... Args>
+ types::substitution_map
+ merge_substitution_maps(const types::substitution_map &substitution_map_in,
+ const Args &... other_substitution_maps_in);
+
//@}
} // namespace SD
other_symbol_values...);
}
+
+ template <typename... Args>
+ types::substitution_map
+ merge_substitution_maps(
+ const types::substitution_map &substitution_map_in_1,
+ const Args &... other_substitution_maps_in)
+ {
+ types::substitution_map substitution_map_out = substitution_map_in_1;
+ merge_substitution_maps(substitution_map_out,
+ other_substitution_maps_in...);
+ return substitution_map_out;
+ }
+
+
+ template <typename... Args>
+ void
+ merge_substitution_maps(
+ types::substitution_map & substitution_map_out,
+ const types::substitution_map &substitution_map_in_1,
+ const Args &... other_substitution_maps_in)
+ {
+ merge_substitution_maps(substitution_map_out, substitution_map_in_1);
+ merge_substitution_maps(substitution_map_out,
+ other_substitution_maps_in...);
+ }
+
} // namespace SD
} // namespace Differentiation
} // namespace internal
+
+ /* ---------------- Symbolic substitution map enlargement --------------*/
+
+
+ void
+ merge_substitution_maps(types::substitution_map & symb_map_out,
+ const types::substitution_map &symb_map_in)
+ {
+ // Do this by hand so that we can perform some sanity checks
+ for (const auto &entry : symb_map_in)
+ {
+ const typename types::substitution_map::const_iterator it_other =
+ symb_map_out.find(entry.first);
+ if (it_other == symb_map_out.end())
+ symb_map_out.insert(std::make_pair(entry.first, entry.second));
+ else
+ {
+ Assert(SE::eq(*(entry.second.get_RCP()),
+ *(it_other->second.get_RCP())),
+ ExcMessage("Key already in map, but values don't match"));
+ }
+ }
+ }
+
} // namespace SD
} // namespace Differentiation