Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / kernel / routing / DijkstraZone.cpp
index d47dc4d..2169610 100644 (file)
@@ -1,23 +1,22 @@
-/* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "simgrid/kernel/routing/DijkstraZone.hpp"
-#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "src/surf/network_interface.hpp"
-#include "surf/surf.hpp"
-#include "xbt/string.hpp"
+#include <simgrid/kernel/routing/DijkstraZone.hpp>
+#include <simgrid/kernel/routing/NetPoint.hpp>
+#include <xbt/string.hpp>
+
+#include "src/kernel/resource/NetworkModel.hpp"
 
 #include <climits>
 #include <queue>
 #include <vector>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_dijkstra, ker_platform, "Kernel Dijkstra Routing");
 
 namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace kernel::routing {
 
 class GraphNodeData {
 public:
@@ -53,7 +52,7 @@ void DijkstraZone::do_seal()
 
       if (not found) {
         auto* route = new Route();
-        route->link_list_.push_back(get_network_model()->loopback_);
+        route->link_list_.push_back(get_network_model()->loopback_.get());
         xbt_graph_new_edge(route_graph_.get(), node, node, route);
       }
     }
@@ -113,10 +112,10 @@ void DijkstraZone::get_local_route(const NetPoint* src, const NetPoint* dst, Rou
     insert_link_latency(route->link_list_, e_route->link_list_, lat);
   }
 
-  auto elm                             = route_cache_.emplace(src_id, std::vector<unsigned long>());
-  std::vector<unsigned long>& pred_arr = elm.first->second;
+  auto [elm, inserted]                 = route_cache_.try_emplace(src_id);
+  std::vector<unsigned long>& pred_arr = elm->second;
 
-  if (elm.second) { /* new element was inserted (not cached mode, or cache miss) */
+  if (inserted) { /* new element was inserted (not cached mode, or cache miss) */
     unsigned long nr_nodes = xbt_dynar_length(nodes);
     std::vector<unsigned long> cost_arr(nr_nodes); /* link cost from src to other hosts */
     pred_arr.resize(nr_nodes);              /* predecessors in path from src */
@@ -184,7 +183,7 @@ void DijkstraZone::get_local_route(const NetPoint* src, const NetPoint* dst, Rou
 
     if (get_hierarchy() == RoutingMode::recursive && v != dst_node_id &&
         gw_dst->get_name() != prev_gw_src->get_name()) {
-      std::vector<resource::LinkImpl*> e_route_as_to_as;
+      std::vector<resource::StandardLinkImpl*> e_route_as_to_as;
 
       const NetPoint* gw_dst_net_elm      = nullptr;
       const NetPoint* prev_gw_src_net_elm = nullptr;
@@ -245,8 +244,7 @@ void DijkstraZone::new_edge(unsigned long src_id, unsigned long dst_id, Route* r
   // Finally add it
   xbt_graph_new_edge(route_graph_.get(), src, dst, route);
 }
-} // namespace routing
-} // namespace kernel
+} // namespace kernel::routing
 
 namespace s4u {
 NetZone* create_dijkstra_zone(const std::string& name, bool cache)