Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sonar variety
[simgrid.git] / examples / platforms / griffon.cpp
index d326305..4d04042 100644 (file)
@@ -27,7 +27,7 @@ create_cabinet(const sg4::NetZone* root, const std::string& name, const std::vec
   cluster->set_parent(root);
 
   /* create the backbone link */
-  sg4::Link* l_bb = cluster->create_link("backbone-" + name, "1.25GBps")->seal();
+  const sg4::Link* l_bb = cluster->create_link("backbone-" + name, "1.25GBps")->seal();
 
   /* create all hosts and connect them to outside world */
   for (const auto& id : radicals) {
@@ -35,13 +35,11 @@ create_cabinet(const sg4::NetZone* root, const std::string& name, const std::vec
     /* create host */
     const sg4::Host* host = cluster->create_host(hostname, "286.087kf");
     /* create UP/DOWN link */
-    sg4::Link* l_up   = cluster->create_link(hostname + "_up", "125MBps")->set_latency("24us")->seal();
-    sg4::Link* l_down = cluster->create_link(hostname + "_down", "125MBps")->set_latency("24us")->seal();
+    const sg4::Link* link = cluster->create_split_duplex_link(hostname, "125MBps")->set_latency("24us")->seal();
 
-    /* add link UP and backbone for communications from the host */
-    cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, std::vector<sg4::Link*>{l_up, l_bb}, false);
-    /* add backbone and link DOWN for communications to the host */
-    cluster->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, std::vector<sg4::Link*>{l_bb, l_down}, false);
+    /* add link and backbone for communications from the host */
+    cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr,
+                       std::vector<sg4::LinkInRoute>{{link, sg4::LinkInRoute::Direction::UP}, l_bb}, true);
   }
 
   /* create router */
@@ -79,7 +77,7 @@ void load_platform(const sg4::Engine& /*e*/)
   simgrid::kernel::routing::NetPoint* router;
 
   /* create top link */
-  sg4::Link* link = root->create_link("backbone", "1.25GBps")->set_latency("24us")->seal();
+  const sg4::Link* link = root->create_link("backbone", "1.25GBps")->set_latency("24us")->seal();
 
   /* create cabinet1 */
   std::vector<int> rad(32);