Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Misc sonar and codefactor.io issues.
[simgrid.git] / src / surf / network_cm02.cpp
index 2da2664..73e4ba8 100644 (file)
@@ -79,9 +79,7 @@ void surf_network_model_init_CM02()
   engine->get_netzone_root()->set_network_model(net_model);
 }
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
 
 NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
 {
@@ -95,9 +93,9 @@ NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
     select = true;
   }
 
-  set_maxmin_system(lmm::System::build(cfg_network_solver, select));
+  set_maxmin_system(lmm::System::build(cfg_network_solver.get(), select));
 
-  loopback_ = create_link("__loopback__", {config::get_value<double>("network/loopback-bw")});
+  loopback_.reset(create_link("__loopback__", {config::get_value<double>("network/loopback-bw")}));
   loopback_->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE, {});
   loopback_->set_latency(config::get_value<double>("network/loopback-lat"));
   loopback_->get_iface()->seal();
@@ -227,19 +225,21 @@ void NetworkCm02Model::comm_action_expand_constraints(const s4u::Host* src, cons
 
   /* WI-FI links needs special treatment, do it here */
   if (src_wifi_link != nullptr) {
-    /* In case of 0Mbps data rate, don't consider it in the LMM */
     if (src_wifi_link->get_host_rate(src) > 0)
       get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(),
                                   1.0 / src_wifi_link->get_host_rate(src));
-    else
+    else {
       get_maxmin_system()->update_variable_penalty(action->get_variable(), 0);
+    }
   }
+
   if (dst_wifi_link != nullptr) {
     if (dst_wifi_link->get_host_rate(dst) > 0)
       get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(),
                                   1.0 / dst_wifi_link->get_host_rate(dst));
-    else
+    else {
       get_maxmin_system()->update_variable_penalty(action->get_variable(), 0);
+    }
   }
 
   for (auto const* link : route) {
@@ -580,6 +580,4 @@ void NetworkCm02Action::update_remains_lazy(double now)
   set_last_value(get_rate());
 }
 
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource