Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce code complexity.
[simgrid.git] / src / kernel / routing / FatTreeZone.cpp
index c7ac3d8d8bfb680f0ccbbaa978bc821b1883421e..228527ae2dd7dd20c755224d911e8202d0711de4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2021. 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. */
@@ -178,7 +178,7 @@ void FatTreeZone::seal()
 
 int FatTreeZone::connect_node_to_parents(FatTreeNode* node)
 {
-  std::vector<FatTreeNode*>::iterator currentParentNode = this->nodes_.begin();
+  auto currentParentNode                                = this->nodes_.begin();
   int connectionsNumber                                 = 0;
   const int level                                       = node->level;
   XBT_DEBUG("We are connecting node %d(%u,%u) to his parents.", node->id, node->level, node->position);
@@ -264,7 +264,7 @@ void FatTreeZone::generate_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++) {
-      FatTreeNode* newNode = new FatTreeNode(this->cluster_, --k, i + 1, j);
+      auto* newNode = new FatTreeNode(this->cluster_, --k, i + 1, j);
       XBT_DEBUG("We create the switch %d(%u,%u)", newNode->id, newNode->level, newNode->position);
       newNode->children.resize(this->num_children_per_node_[i] * this->num_port_lower_level_[i]);
       if (i != this->levels_ - 1) {
@@ -442,7 +442,7 @@ FatTreeNode::FatTreeNode(const ClusterCreationArgs* cluster, int id, int level,
     : id(id), level(level), position(position)
 {
   LinkCreationArgs linkTemplate;
-  if (cluster->limiter_link) {
+  if (cluster->limiter_link != 0.0) {
     linkTemplate.bandwidths.push_back(cluster->limiter_link);
     linkTemplate.latency   = 0;
     linkTemplate.policy    = s4u::Link::SharingPolicy::SHARED;
@@ -450,7 +450,7 @@ FatTreeNode::FatTreeNode(const ClusterCreationArgs* cluster, int id, int level,
     sg_platf_new_link(&linkTemplate);
     this->limiter_link_ = s4u::Link::by_name(linkTemplate.id)->get_impl();
   }
-  if (cluster->loopback_bw || cluster->loopback_lat) {
+  if (cluster->loopback_bw != 0.0 || cluster->loopback_lat != 0.0) {
     linkTemplate.bandwidths.push_back(cluster->loopback_bw);
     linkTemplate.latency   = cluster->loopback_lat;
     linkTemplate.policy    = s4u::Link::SharingPolicy::FATPIPE;