Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
vector::back() is good enough + assert for scan_build.
[simgrid.git] / src / kernel / routing / TorusZone.cpp
index a9d371d..b7c7001 100644 (file)
@@ -20,7 +20,7 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
-void TorusZone::create_links(int id, int rank, unsigned int position)
+void TorusZone::create_torus_links(int id, int rank, unsigned int position)
 {
   /* Create all links that exist in the torus. Each rank creates @a dimensions-1 links */
   int dim_product = 1; // Needed to calculate the next neighbor_id
@@ -107,11 +107,11 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, doub
    * Arrays that hold the coordinates of the current node and the target; comparing the values at the i-th position of
    * both arrays, we can easily assess whether we need to route into this dimension or not.
    */
-  const unsigned int dsize = dimensions_.size();
+  const unsigned long dsize = dimensions_.size();
   std::vector<unsigned int> myCoords(dsize);
   std::vector<unsigned int> targetCoords(dsize);
   unsigned int dim_size_product = 1;
-  for (unsigned i = 0; i < dsize; i++) {
+  for (unsigned long i = 0; i < dsize; i++) {
     unsigned cur_dim_size = dimensions_[i];
     myCoords[i]           = (src->id() / dim_size_product) % cur_dim_size;
     targetCoords[i]       = (dst->id() / dim_size_product) % cur_dim_size;
@@ -183,6 +183,9 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, doub
 
     current_node = next_node;
   }
+  if (has_limiter()) { // limiter for receiver/destination
+    route->link_list_.push_back(get_downlink_to(node_pos_with_loopback(dst->id())));
+  }
   // set gateways (if any)
   route->gw_src_ = get_gateway(src->id());
   route->gw_dst_ = get_gateway(dst->id());
@@ -220,7 +223,7 @@ NetZone* create_torus_zone(const std::string& name, const NetZone* parent, const
     Link* loopback;
     zone->fill_leaf_from_cb(i, dimensions, set_callbacks, &netpoint, &loopback, &limiter);
 
-    zone->create_links(netpoint->id(), i, zone->node_pos_with_loopback_limiter(netpoint->id()));
+    zone->create_torus_links(netpoint->id(), i, zone->node_pos_with_loopback_limiter(netpoint->id()));
   }
 
   return zone->get_iface();