-void surf_network_model_init_Constant()
-{
- xbt_assert(surf_network_model == nullptr);
- surf_network_model = new simgrid::kernel::resource::NetworkConstantModel();
-}
-
-namespace simgrid {
-namespace kernel {
-namespace resource {
-
-NetworkConstantModel::NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::FULL)
-{
- all_existing_models.push_back(this);
-}
-
-LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/,
- double /*latency*/, s4u::Link::SharingPolicy)
+SIMGRID_REGISTER_NETWORK_MODEL(
+ Constant,
+ "Simplistic network model where all communication take a constant time (one second). This model "
+ "provides the lowest realism, but is (marginally) faster. It is mostly useful when studying theoretical "
+ "distributed algorithms where the network is usually abstracted away.",
+ []() {
+ auto net_model = std::make_shared<simgrid::kernel::resource::NetworkConstantModel>("Network_Constant");
+ auto* engine = simgrid::kernel::EngineImpl::get_instance();
+ engine->add_model(net_model);
+ engine->get_netzone_root()->set_network_model(net_model);
+ });
+
+namespace simgrid::kernel::resource {
+
+StandardLinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/)