Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'model_types_rework_part1' into 'master'
[simgrid.git] / src / kernel / routing / VivaldiZone.cpp
index be055b4..70822eb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -55,16 +55,13 @@ static inline double euclidean_dist_comp(int index, std::vector<double>* src, st
 
 static std::vector<double>* netpoint_get_coords(NetPoint* np)
 {
-  vivaldi::Coords* coords = np->extension<vivaldi::Coords>();
+  auto* coords = np->extension<vivaldi::Coords>();
   xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
              (np->is_netzone() ? "Netzone" : (np->is_host() ? "Host" : "Router")), np->get_cname(), np);
   return &coords->coords;
 }
 
-VivaldiZone::VivaldiZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
-    : ClusterZone(father, name, netmodel)
-{
-}
+VivaldiZone::VivaldiZone(const std::string& name) : ClusterZone(name) {}
 
 void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, const std::string& coord)
 {
@@ -73,12 +70,14 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out,
 
   new vivaldi::Coords(netpoint, coord);
 
-  std::string link_up      = "link_" + netpoint->get_name() + "_UP";
-  std::string link_down    = "link_" + netpoint->get_name() + "_DOWN";
+  std::string link_up   = "link_" + netpoint->get_name() + "_UP";
+  std::string link_down = "link_" + netpoint->get_name() + "_DOWN";
   resource::LinkImpl* linkUp =
-      network_model_->create_link(link_up, std::vector<double>(1, bw_out), 0, s4u::Link::SharingPolicy::SHARED);
+      get_network_model()->create_link(link_up, std::vector<double>(1, bw_out), s4u::Link::SharingPolicy::SHARED);
+  linkUp->seal();
   resource::LinkImpl* linkDown =
-      network_model_->create_link(link_down, std::vector<double>(1, bw_in), 0, s4u::Link::SharingPolicy::SHARED);
+      get_network_model()->create_link(link_down, std::vector<double>(1, bw_in), s4u::Link::SharingPolicy::SHARED);
+  linkDown->seal();
   private_links_.insert({netpoint->id(), {linkUp, linkDown}});
 }