Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Declare functions "const" in src/kernel/.
[simgrid.git] / src / kernel / routing / DragonflyZone.cpp
index 911f950..be88274 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2020. 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. */
@@ -23,7 +23,7 @@ DragonflyZone::DragonflyZone(NetZoneImpl* father, const std::string& name, resou
 {
 }
 
-void DragonflyZone::rankId_to_coords(int rankId, unsigned int coords[4])
+void DragonflyZone::rankId_to_coords(int rankId, unsigned int coords[4]) const
 {
   // coords : group, chassis, blade, node
   coords[0] = rankId / (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
@@ -53,13 +53,13 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 
   try {
     this->num_groups_ = std::stoi(tmp[0]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
   }
 
   try {
     this->num_links_blue_ = std::stoi(tmp[1]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Invalid number of links for the blue level:") + tmp[1]);
   }
   // Black network : number of chassis/group, number of links between each router on the black network
@@ -70,13 +70,13 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 
   try {
     this->num_chassis_per_group_ = std::stoi(tmp[0]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
   }
 
   try {
     this->num_links_black_ = std::stoi(tmp[1]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Invalid number of links for the black level:") + tmp[1]);
   }
 
@@ -88,20 +88,20 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 
   try {
     this->num_blades_per_chassis_ = std::stoi(tmp[0]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
   }
 
   try {
     this->num_links_green_ = std::stoi(tmp[1]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Invalid number of links for the green level:") + tmp[1]);
   }
 
   // The last part of topo_parameters should be the number of nodes per blade
   try {
     this->num_nodes_per_blade_ = std::stoi(parameters[3]);
-  } catch (std::invalid_argument& ia) {
+  } catch (const std::invalid_argument&) {
     throw std::invalid_argument(std::string("Last parameter is not the amount of nodes per blade:") + parameters[3]);
   }
 
@@ -133,12 +133,12 @@ void DragonflyZone::generate_routers()
 }
 
 void DragonflyZone::create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
-                                resource::LinkImpl** linkdown)
+                                resource::LinkImpl** linkdown) const
 {
   *linkup   = nullptr;
   *linkdown = nullptr;
   LinkCreationArgs linkTemplate;
-  linkTemplate.bandwidth = this->bw_ * numlinks;
+  linkTemplate.bandwidths.push_back(this->bw_ * numlinks);
   linkTemplate.latency   = this->lat_;
   linkTemplate.policy    = this->sharing_policy_;
   linkTemplate.id        = std::move(id);
@@ -280,7 +280,6 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
   }
 
   if (targetRouter != myRouter) {
-
     // are we on a different group ?
     if (targetRouter->group_ != currentRouter->group_) {
       // go to the router of our group connected to this one.