From: Maxwell Pirtle Date: Fri, 24 Feb 2023 12:52:40 +0000 (+0100) Subject: Create a private struct to hold search data X-Git-Tag: v3.34~422^2~15 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e0291c3be86c4482308403ad2b02a14888dbd8a7?hp=b606642449a8aca5f340e6de33025c7099bf8385 Create a private struct to hold search data This commits replaces the three separate maps used to keep track of per-event data in favor of a single map which maps events to a struct with three fields --- diff --git a/src/mc/explo/udpor/Configuration.cpp b/src/mc/explo/udpor/Configuration.cpp index 77e743d51a..447b5f0823 100644 --- a/src/mc/explo/udpor/Configuration.cpp +++ b/src/mc/explo/udpor/Configuration.cpp @@ -123,9 +123,12 @@ Configuration::make_compatibility_graph_filtered_on(std::function(); - std::unordered_map> discovered_conflicts; - std::unordered_map potential_placements; - std::unordered_map direct_children_count; + struct UnfoldingEventSearchData { + int immediate_children_count = 0; + CompatibilityGraphNode* potential_placement = nullptr; + std::unordered_set conflicts = std::unordered_set(); + }; + std::unordered_map search_data; for (auto* e : get_topologically_sorted_events_of_reverse_graph()) { @@ -134,23 +137,20 @@ Configuration::make_compatibility_graph_filtered_on(std::functionsecond); - const auto e_conflicts = - no_known_conflicts ? std::unordered_set() : std::move(known_conflicts->second); - const auto e_child_count = no_known_child_count ? 0 : potential_child_count->second; + const auto& e_conflicts = e_search_data.conflicts; + const auto& e_potential_placement = e_search_data.potential_placement; + const auto e_child_count = e_search_data.immediate_children_count; CompatibilityGraphNode* e_placement = nullptr; // The justification is as follows: // - // no_known_placement: + // e_has_no_search_data: // If nobody told us about a placement, we must either be a leaf event // OR be the cause of an event that itself has more than one cause. // @@ -158,7 +158,7 @@ Configuration::make_compatibility_graph_filtered_on(std::function= 2; + const bool new_placement_required = e_has_no_search_data || e_child_count >= 2; if (new_placement_required) { auto new_graph_node = std::make_unique(e_conflicts, EventSet({e})); @@ -170,7 +170,7 @@ Configuration::make_compatibility_graph_filtered_on(std::functionsecond; + e_placement = e_potential_placement; e_placement->add_event(e); } @@ -181,24 +181,25 @@ Configuration::make_compatibility_graph_filtered_on(std::function