X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fcd4590468b5d531f9e95cc9972d0c8eb775661b..e80fc92c523fadeda71f4f7c2f0ca6a5a7dea7a7:/src/mc/explo/udpor/maximal_subsets_iterator.cpp diff --git a/src/mc/explo/udpor/maximal_subsets_iterator.cpp b/src/mc/explo/udpor/maximal_subsets_iterator.cpp index d6ed9888e9..6c2dee3ce6 100644 --- a/src/mc/explo/udpor/maximal_subsets_iterator.cpp +++ b/src/mc/explo/udpor/maximal_subsets_iterator.cpp @@ -6,11 +6,12 @@ namespace simgrid::mc::udpor { -maximal_subsets_iterator::maximal_subsets_iterator(const EventSet& events, std::optional filter, +maximal_subsets_iterator::maximal_subsets_iterator(const EventSet& events, + const std::optional& filter, std::optional maximum_subset_size) : maximum_subset_size(maximum_subset_size), current_maximal_set({EventSet()}) { - const auto candidate_ordering = events.get_topological_ordering_of_reverse_graph(); + auto candidate_ordering = events.get_topological_ordering_of_reverse_graph(); if (filter.has_value()) { // Only store the events in the ordering that "matter" to us std::copy_if(std::move_iterator(candidate_ordering.begin()), std::move_iterator(candidate_ordering.end()), @@ -34,7 +35,7 @@ void maximal_subsets_iterator::increment() } const auto next_event_ref = [&]() { - if (!has_started_searching) { + if (not has_started_searching) { has_started_searching = true; return bookkeeper.find_next_candidate_event(topological_ordering.begin(), topological_ordering.end()); } else { @@ -110,7 +111,7 @@ maximal_subsets_iterator::continue_traversal_of_maximal_events_tree() return topological_ordering.end(); } -bool maximal_subsets_iterator::bookkeeper::is_candidate_event(const UnfoldingEvent* e) const +bool maximal_subsets_iterator::Bookkeeper::is_candidate_event(const UnfoldingEvent* e) const { if (const auto e_count = event_counts.find(e); e_count != event_counts.end()) { return e_count->second == 0; @@ -153,24 +154,24 @@ bool maximal_subsets_iterator::can_grow_maximal_set() const } maximal_subsets_iterator::topological_order_position -maximal_subsets_iterator::bookkeeper::find_next_candidate_event(topological_order_position first, +maximal_subsets_iterator::Bookkeeper::find_next_candidate_event(topological_order_position first, topological_order_position last) const { return std::find_if(first, last, [&](const UnfoldingEvent* e) { return is_candidate_event(e); }); } -void maximal_subsets_iterator::bookkeeper::mark_included_in_maximal_set(const UnfoldingEvent* e) +void maximal_subsets_iterator::Bookkeeper::mark_included_in_maximal_set(const UnfoldingEvent* e) { - const auto e_history = e->get_history(); - for (const auto e_hist : e_history) { + const auto e_local_config = e->get_local_config(); + for (const auto* e_hist : e_local_config) { event_counts[e_hist]++; } } -void maximal_subsets_iterator::bookkeeper::mark_removed_from_maximal_set(const UnfoldingEvent* e) +void maximal_subsets_iterator::Bookkeeper::mark_removed_from_maximal_set(const UnfoldingEvent* e) { - const auto e_history = e->get_history(); - for (const auto e_hist : e_history) { + const auto e_local_config = e->get_local_config(); + for (const auto* e_hist : e_local_config) { xbt_assert(event_counts.find(e_hist) != event_counts.end(), "Invariant Violation: Attempted to remove an event which was not previously added"); xbt_assert(event_counts[e_hist] > 0, "Invariant Violation: An event `e` had a count of `0` at this point " @@ -182,4 +183,4 @@ void maximal_subsets_iterator::bookkeeper::mark_removed_from_maximal_set(const U } } -} // namespace simgrid::mc::udpor \ No newline at end of file +} // namespace simgrid::mc::udpor