Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialize CPU model for VMs in init_HL13
[simgrid.git] / src / surf / network_constant.cpp
index 7c879c8..ba728d4 100644 (file)
@@ -4,6 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "network_constant.hpp"
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
+#include "simgrid/s4u/Engine.hpp"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "surf/surf.hpp"
@@ -15,18 +17,17 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
  *********/
 void surf_network_model_init_Constant()
 {
-  auto net_model = std::make_unique<simgrid::kernel::resource::NetworkConstantModel>();
-  simgrid::kernel::EngineImpl::get_instance()->add_model(simgrid::kernel::resource::Model::Type::NETWORK,
-                                                         std::move(net_model), true);
+  auto net_model = std::make_shared<simgrid::kernel::resource::NetworkConstantModel>();
+  simgrid::kernel::EngineImpl::get_instance()->add_model(simgrid::kernel::resource::Model::Type::NETWORK, net_model,
+                                                         true);
+  simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->set_network_model(net_model);
 }
 
 namespace simgrid {
 namespace kernel {
 namespace resource {
 
-NetworkConstantModel::NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::FULL)
-{
-}
+NetworkConstantModel::NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::FULL) {}
 
 LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/,
                                             s4u::Link::SharingPolicy)