Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / kernel / routing / ClusterZone.cpp
index dc72ef3..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");
@@ -15,26 +16,27 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
 namespace simgrid {
 namespace kernel {
 namespace routing {
-AsCluster::AsCluster(As* father, const char* name) : AsImpl(father, name)
+ClusterZone::ClusterZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
 {
 }
 
-void AsCluster::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 AsCluster::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t
   }
 
   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)
@@ -70,7 +72,7 @@ void AsCluster::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t
   }
 }
 
-void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
+void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
 {
   xbt_assert(router_,
              "Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
@@ -115,7 +117,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
   }
 }
 
-void AsCluster::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);