Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / src / kernel / routing / FatTreeZone.cpp
index 8642501..0218b3b 100644 (file)
@@ -1,18 +1,19 @@
-/* Copyright (c) 2014-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2022. 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. */
 
+#include <simgrid/kernel/routing/FatTreeZone.hpp>
+#include <simgrid/kernel/routing/NetPoint.hpp>
+
+#include "src/kernel/resource/StandardLinkImpl.hpp"
+#include "src/surf/xml/platf.hpp" // surf_parse_error() and surf_parse_assert()
+
 #include <fstream>
 #include <numeric>
 #include <sstream>
 #include <string>
 
-#include "simgrid/kernel/routing/FatTreeZone.hpp"
-#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
-
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
 
@@ -248,8 +249,8 @@ void FatTreeZone::generate_switches(const s4u::ClusterCallbacks& set_callbacks)
   }
 
   /* get limiter for this router */
-  auto get_limiter = [this, &set_callbacks](unsigned int i, unsigned int j, int id) -> resource::LinkImpl* {
-    kernel::resource::LinkImpl* limiter = nullptr;
+  auto get_limiter = [this, &set_callbacks](unsigned long i, unsigned long j, long id) -> resource::StandardLinkImpl* {
+    kernel::resource::StandardLinkImpl* limiter = nullptr;
     if (set_callbacks.limiter) {
       const auto* s4u_link = set_callbacks.limiter(get_iface(), {i + 1, j}, id);
       if (s4u_link) {
@@ -259,9 +260,9 @@ void FatTreeZone::generate_switches(const s4u::ClusterCallbacks& set_callbacks)
     return limiter;
   };
   // Create the switches
-  int k = 0;
-  for (unsigned int i = 0; i < this->levels_; i++) {
-    for (unsigned int j = 0; j < this->nodes_by_level_[i + 1]; j++) {
+  unsigned long k = 2 * nodes_.size();
+  for (unsigned long i = 0; i < this->levels_; i++) {
+    for (unsigned long j = 0; j < this->nodes_by_level_[i + 1]; j++) {
       k--;
       auto newNode = std::make_shared<FatTreeNode>(k, i + 1, j, get_limiter(i, j, k), nullptr);
       XBT_DEBUG("We create the switch %d(%u,%u)", newNode->id, newNode->level, newNode->position);
@@ -332,7 +333,7 @@ int FatTreeZone::get_level_position(const unsigned int level)
   return tempPosition;
 }
 
-void FatTreeZone::add_processing_node(int id, resource::LinkImpl* limiter, resource::LinkImpl* loopback)
+void FatTreeZone::add_processing_node(int id, resource::StandardLinkImpl* limiter, resource::StandardLinkImpl* loopback)
 {
   using std::make_pair;
   static int position = 0;