Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Prefer empty() to check for emptyness.
[simgrid.git] / src / surf / sg_platf.cpp
index 0cf0c2c9e6289f9ee7d3c28d900bb53a84b34224..6b162892d88d0c1baae874b4f89ef58145eb0005 100644 (file)
@@ -195,13 +195,7 @@ static simgrid::s4u::Link* sg_platf_cluster_create_limiter(const simgrid::kernel
                                                            simgrid::s4u::NetZone* zone,
                                                            const std::vector<unsigned int>& /*coord*/, int id)
 {
-  xbt_assert(static_cast<unsigned long>(id) < cluster->radicals.size(),
-             "Zone(%s): error when creating limiter for host number %d in the zone. Insufficient number of radicals "
-             "available "
-             "(total = %zu). Check the 'radical' parameter in XML",
-             cluster->id.c_str(), id, cluster->radicals.size());
-
-  std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(cluster->radicals[id]) + "_limiter";
+  std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(id) + "_limiter";
   XBT_DEBUG("Cluster: creating limiter link=%s bw=%f", link_id.c_str(), cluster->limiter_link);
 
   simgrid::s4u::Link* limiter = zone->create_link(link_id, cluster->limiter_link)->seal();
@@ -228,7 +222,7 @@ static void sg_platf_new_cluster_hierarchical(const simgrid::kernel::routing::Cl
     set_limiter = std::bind(sg_platf_cluster_create_limiter, cluster, _1, _2, _3);
   }
 
-  simgrid::s4u::NetZone* parent = routing_get_current() ? routing_get_current()->get_iface() : nullptr;
+  simgrid::s4u::NetZone const* parent = routing_get_current() ? routing_get_current()->get_iface() : nullptr;
   simgrid::s4u::NetZone* zone;
   switch (cluster->topology) {
     case simgrid::kernel::routing::ClusterTopology::TORUS:
@@ -248,7 +242,6 @@ static void sg_platf_new_cluster_hierarchical(const simgrid::kernel::routing::Cl
       break;
     default:
       THROW_IMPOSSIBLE;
-      break;
   }
   zone->seal();
 }
@@ -352,6 +345,7 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA
 
   XBT_DEBUG("</zone>");
   sg_platf_new_Zone_seal();
+  simgrid::kernel::routing::on_cluster_creation(*cluster);
 }
 
 void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster)
@@ -366,8 +360,6 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
       sg_platf_new_cluster_flat(cluster);
       break;
   }
-
-  simgrid::kernel::routing::on_cluster_creation(*cluster);
 }
 
 void routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl* bb)