Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics: declare graph edges with the "right" direction.
[simgrid.git] / src / kernel / routing / StarZone.cpp
index 489ecd9..aab5ccd 100644 (file)
@@ -5,15 +5,13 @@
 
 #include "simgrid/kernel/routing/StarZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
-#include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "src/kernel/resource/NetworkModel.hpp"
 #include "xbt/string.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_star, ker_routing, "Kernel Star Routing");
 
 namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace kernel::routing {
 StarZone::StarZone(const std::string& name) : ClusterZone(name) {}
 
 void StarZone::add_links_to_route(const std::vector<resource::StandardLinkImpl*>& links, Route* route, double* latency,
@@ -77,10 +75,10 @@ void StarZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_n
     previous = star_node;
     for (auto const* link : routes_[src->id()].links_down) {
       xbt_node_t current = new_xbt_graph_node(graph, link->get_cname(), nodes);
-      new_xbt_graph_edge(graph, current, previous, edges);
+      new_xbt_graph_edge(graph, previous, current, edges);
       previous = current;
     }
-    new_xbt_graph_edge(graph, src_node, previous, edges);
+    new_xbt_graph_edge(graph, previous, src_node, edges);
   }
 }
 
@@ -170,16 +168,15 @@ void StarZone::do_seal()
 {
   /* add default empty links if nothing was configured by user */
   for (auto const& node : get_vertices()) {
-    auto route = routes_.emplace(node->id(), StarRoute());
-    if (route.second) {
-      route.first->second.links_down_set = true;
-      route.first->second.links_up_set   = true;
+    auto [route, inserted] = routes_.try_emplace(node->id());
+    if (inserted) {
+      route->second.links_down_set = true;
+      route->second.links_up_set   = true;
     }
   }
 }
 
-} // namespace routing
-} // namespace kernel
+} // namespace kernel::routing
 
 namespace s4u {
 NetZone* create_star_zone(const std::string& name)