diff --git a/external/modparser b/external/modparser index b200bf6376a2dc30edea98fcc2375fc9be095135..ad8d926fd4a3e92cdcfb7b77c527550f859496d2 160000 --- a/external/modparser +++ b/external/modparser @@ -1 +1 @@ -Subproject commit b200bf6376a2dc30edea98fcc2375fc9be095135 +Subproject commit ad8d926fd4a3e92cdcfb7b77c527550f859496d2 diff --git a/external/vector b/external/vector index c8678e80660cd63b293ade80ece8eed2249c1b06..6a9798d87f83246f36c999540d4a7810fb33d199 160000 --- a/external/vector +++ b/external/vector @@ -1 +1 @@ -Subproject commit c8678e80660cd63b293ade80ece8eed2249c1b06 +Subproject commit 6a9798d87f83246f36c999540d4a7810fb33d199 diff --git a/src/algorithms.hpp b/src/algorithms.hpp index f626fa98ddde880cf4fd71a1589dc7ba012764a4..7be1406ac7581df6924c146e6b86aaa8201755bb 100644 --- a/src/algorithms.hpp +++ b/src/algorithms.hpp @@ -254,7 +254,7 @@ std::vector<typename C::value_type> make_parent_index( return {}; } - EXPECTS(parent_index.size() == branch_index.back()); + EXPECTS(parent_index.size()-branch_index.back() == 0); EXPECTS(has_contiguous_compartments(parent_index)); EXPECTS(is_strictly_monotonic_increasing(branch_index)); diff --git a/src/mechanism.hpp b/src/mechanism.hpp index ce9786601a2a0b2064494c599d129bcd06439dd8..d826b2994f4dac39ef15a53f720acf1bf7fae603 100644 --- a/src/mechanism.hpp +++ b/src/mechanism.hpp @@ -27,11 +27,12 @@ public: using view_type = typename vector_type::view_type; using index_type = memory::HostVector<size_type>; using index_view = typename index_type::view_type; + using const_index_view = typename index_type::const_view_type; using indexed_view_type = indexed_view<value_type, size_type>; using ion_type = ion<value_type, size_type>; - mechanism(view_type vec_v, view_type vec_i, index_view node_index): + mechanism(view_type vec_v, view_type vec_i, const_index_view node_index): vec_v_(vec_v), vec_i_(vec_i), node_index_(node_index), vec_area_(nullptr, 0) {} @@ -85,7 +86,7 @@ mechanism_ptr<typename M::value_type, typename M::size_type> make_mechanism( typename M::view_type vec_v, typename M::view_type vec_i, - typename M::index_view node_indices + typename M::const_index_view node_indices ) { return util::make_unique<M>(vec_v, vec_i, node_indices); } diff --git a/src/mechanism_catalogue.hpp b/src/mechanism_catalogue.hpp index 7fb2927cdda3f24a2834687bade3caa2bf83158f..5e79cd9f489558717de1132b502b5c211eff09f9 100644 --- a/src/mechanism_catalogue.hpp +++ b/src/mechanism_catalogue.hpp @@ -18,20 +18,21 @@ template <typename T, typename I> struct catalogue { using view_type = typename mechanism<T, I>::view_type; using index_view = typename mechanism<T, I>::index_view; + using const_index_view = typename mechanism<T, I>::const_index_view; template <typename Indices> static mechanism_ptr<T, I> make( const std::string& name, view_type vec_v, view_type vec_i, - Indices& node_indices) + Indices const& node_indices) { auto entry = mech_map.find(name); if (entry==mech_map.end()) { throw std::out_of_range("no such mechanism"); } - auto node_view = index_view{node_indices}; + const_index_view node_view(node_indices); return entry->second(vec_v, vec_i, node_view); } @@ -40,11 +41,15 @@ struct catalogue { } private: - using maker_type = mechanism_ptr<T, I> (*)(view_type, view_type, index_view); + using maker_type = mechanism_ptr<T, I> (*)(view_type, view_type, const_index_view); static const std::map<std::string, maker_type> mech_map; template <template <typename, typename> class mech> - static mechanism_ptr<T, I> maker(view_type vec_v, view_type vec_i, index_view node_indices) { + static mechanism_ptr<T, I> maker( + view_type vec_v, + view_type vec_i, + const_index_view node_indices) + { return make_mechanism<mech<T, I>>(vec_v, vec_i, node_indices); } };