Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename AsRoute to BypassRoute, and move it to its own file
[simgrid.git] / src / kernel / routing / AsDijkstra.cpp
index cf697f0..af50733 100644 (file)
@@ -4,6 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/AsDijkstra.hpp"
+#include "src/kernel/routing/NetCard.hpp"
+
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
@@ -138,14 +140,13 @@ void AsDijkstra::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route
   xbt_graph_new_edge(routeGraph_, src, dst, e_route);
 }
 
-void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
+void AsDijkstra::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
 {
   getRouteCheckParams(src, dst);
   int src_id = src->id();
   int dst_id = dst->id();
 
   int *pred_arr = nullptr;
-  sg_platf_route_cbarg_t e_route;
   int size = 0;
   xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
 
@@ -166,7 +167,7 @@ void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c
     if (edge == nullptr)
       THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name().c_str(), dst->name().c_str());
 
-    e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
+    sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t)xbt_graph_edge_get_data(edge);
 
     for (auto link: *e_route->link_list) {
       route->link_list->insert(route->link_list->begin(), link);
@@ -252,7 +253,7 @@ void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c
 
     prev_gw_src = gw_src;
 
-    e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
+    sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t)xbt_graph_edge_get_data(edge);
     gw_src = e_route->gw_src;
     gw_dst = e_route->gw_dst;
 
@@ -263,7 +264,7 @@ void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c
         strcmp(gw_dst->name().c_str(), prev_gw_src->name().c_str())) {
       std::vector<Link*> *e_route_as_to_as = new std::vector<Link*>();
 
-      routing_platf->getRouteAndLatency(gw_dst_net_elm, prev_gw_src_net_elm, e_route_as_to_as, nullptr);
+      getGlobalRoute(gw_dst_net_elm, prev_gw_src_net_elm, e_route_as_to_as, nullptr);
       auto pos = route->link_list->begin();
       for (auto link : *e_route_as_to_as) {
         route->link_list->insert(pos, link);