Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make Model::update_algo a constant field, set at initialization only
[simgrid.git] / src / surf / network_cm02.cpp
index 72bce21..aa9df6d 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "network_cm02.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 #include "src/kernel/lmm/maxmin.hpp"
 
@@ -134,27 +134,21 @@ void surf_network_model_init_Vegas()
 namespace simgrid {
 namespace surf {
 
-NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool)) : NetworkModel()
+NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool))
+    : NetworkModel(xbt_cfg_get_string("network/optim") == "Full" ? kernel::resource::Model::UpdateAlgo::Full
+                                                                 : kernel::resource::Model::UpdateAlgo::Lazy)
 {
   std::string optim = xbt_cfg_get_string("network/optim");
   bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
 
-  if (optim == "Full") {
-    setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Full);
-  } else if (optim == "Lazy") {
+  if (optim == "Lazy") {
     xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"),
                "You cannot disable network selective update when using the lazy update mechanism");
     select = true;
-    setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Lazy);
-  } else {
-    xbt_die("Unsupported optimization (%s) for this model. Accepted: Full, Lazy.", optim.c_str());
   }
 
   set_maxmin_system(make_new_lmm_system(select));
   loopback_     = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
-
-  if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy)
-    get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,