Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename NetCards to NetPoints
[simgrid.git] / src / kernel / routing / ClusterZone.cpp
index 9a0335b..c6e2679 100644 (file)
@@ -4,7 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/ClusterZone.hpp"
-#include "src/kernel/routing/NetCard.hpp"
+#include "src/kernel/routing/NetPoint.hpp"
+#include "src/kernel/routing/RoutedZone.hpp"
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
@@ -19,22 +20,23 @@ ClusterZone::ClusterZone(NetZone* father, const char* name) : NetZoneImpl(father
 {
 }
 
-void ClusterZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
 {
   XBT_VERB("cluster getLocalRoute from '%s'[%d] to '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id());
   xbt_assert(!privateLinks_.empty(),
              "Cluster routing: no links attached to the source node - did you use host_link tag?");
 
-  if (!src->isRouter()) { // No specific link for router
+  if ((src->id() == dst->id()) && hasLoopback_) {
+    xbt_assert(!src->isRouter(), "Routing from a cluster private router to itself is meaningless");
 
-    if ((src->id() == dst->id()) && hasLoopback_) {
-      std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_);
-      route->link_list->push_back(info.first);
-      if (lat)
-        *lat += info.first->latency();
-      return;
-    }
+    std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_);
+    route->link_list->push_back(info.first);
+    if (lat)
+      *lat += info.first->latency();
+    return;
+  }
 
+  if (!src->isRouter()) { // No private link for the private router
     if (hasLimiter_) { // limiter for sender
       std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0));
       route->link_list->push_back(info.first);
@@ -56,8 +58,8 @@ void ClusterZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg
   }
 
   if (!dst->isRouter()) { // No specific link for router
-    std::pair<Link*, Link*> info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_);
 
+    std::pair<Link*, Link*> info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_);
     if (info.second) { // link down
       route->link_list->push_back(info.second);
       if (lat)
@@ -115,7 +117,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
   }
 }
 
-void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int, int position)
+void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int /*rank*/, int position)
 {
   char* link_id = bprintf("%s_link_%d", cluster->id, id);