Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / kernel / routing / DijkstraZone.cpp
index b9d79f8..3c3378d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2021. 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. */
@@ -57,7 +57,7 @@ void DijkstraZone::seal()
       }
 
       if (not found) {
-        RouteCreationArgs* route = new simgrid::kernel::routing::RouteCreationArgs();
+        auto* route = new simgrid::kernel::routing::RouteCreationArgs();
         route->link_list.push_back(network_model_->loopback_);
         xbt_graph_new_edge(route_graph_.get(), node, node, route);
       }
@@ -68,7 +68,7 @@ void DijkstraZone::seal()
   const_xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_.get());
 
   xbt_dynar_foreach (nodes, cursor, node) {
-    GraphNodeData* data = static_cast<GraphNodeData*>(xbt_graph_node_get_data(node));
+    auto* data          = static_cast<GraphNodeData*>(xbt_graph_node_get_data(node));
     data->graph_id_     = cursor;
   }
 }
@@ -118,7 +118,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
     for (auto const& link : e_route->link_list) {
       route->link_list.insert(route->link_list.begin(), link);
       if (lat)
-        *lat += static_cast<resource::LinkImpl*>(link)->get_latency();
+        *lat += link->get_latency();
     }
   }
 
@@ -129,8 +129,8 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
     int nr_nodes      = xbt_dynar_length(nodes);
     std::vector<double> cost_arr(nr_nodes); /* link cost from src to other hosts */
     pred_arr.resize(nr_nodes);              /* predecessors in path from src */
-    typedef std::pair<double, int> Qelt;
-    std::priority_queue<Qelt, std::vector<Qelt>, std::greater<Qelt>> pqueue;
+    using Qelt = std::pair<double, int>;
+    std::priority_queue<Qelt, std::vector<Qelt>, std::greater<>> pqueue;
 
     /* initialize */
     cost_arr[src_node_id] = 0.0;
@@ -209,7 +209,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
     for (auto const& link : e_route->link_list) {
       route->link_list.insert(route->link_list.begin(), link);
       if (lat)
-        *lat += static_cast<resource::LinkImpl*>(link)->get_latency();
+        *lat += link->get_latency();
     }
   }
 
@@ -227,10 +227,10 @@ void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, Net
 {
   add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
-  new_edge(src->id(), dst->id(), new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1));
+  new_edge(src->id(), dst->id(), new_extended_route(hierarchy_, gw_src, gw_dst, link_list, true));
 
-  if (symmetrical == true)
-    new_edge(dst->id(), src->id(), new_extended_route(hierarchy_, dst, src, gw_dst, gw_src, link_list, symmetrical, 0));
+  if (symmetrical)
+    new_edge(dst->id(), src->id(), new_extended_route(hierarchy_, gw_dst, gw_src, link_list, false));
 }
 
 void DijkstraZone::new_edge(int src_id, int dst_id, RouteCreationArgs* route)