X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/80dd9a61a11fcc5b46fc44c8565511797ecb8d40..54848f1b36dd4b0b508a77de74dfad59dd439a08:/examples/platforms/routing_cluster.cpp diff --git a/examples/platforms/routing_cluster.cpp b/examples/platforms/routing_cluster.cpp index eb97e964ae..a1be85fb3b 100644 --- a/examples/platforms/routing_cluster.cpp +++ b/examples/platforms/routing_cluster.cpp @@ -23,25 +23,27 @@ static void create_cluster(const sg4::NetZone* root, const std::string& cluster_ cluster->set_parent(root); /* create the backbone link */ - sg4::Link* l_bb = - cluster->create_link("backbone" + cluster_suffix, std::vector{2.25e9})->set_latency(5e-4)->seal(); + const sg4::Link* l_bb = cluster->create_link("backbone" + cluster_suffix, 2.25e9)->set_latency(5e-4)->seal(); /* create all hosts and connect them to outside world */ for (const auto& hostname : hosts) { /* create host */ - const sg4::Host* host = cluster->create_host(hostname, std::vector{1e9}); + const sg4::Host* host = cluster->create_host(hostname, 1e9); /* create UP link */ - sg4::Link* l_up = cluster->create_link(hostname + "_up", std::vector{1.25e8})->set_latency(0.0001)->seal(); + const sg4::Link* l_up = cluster->create_link(hostname + "_up", 1.25e8)->set_latency(0.0001)->seal(); /* create DOWN link, if needed */ - sg4::Link* l_down = l_up; + const sg4::Link* l_down = l_up; if (hostname != single_link_host) { - l_down = cluster->create_link(hostname + "_down", std::vector{1.25e8})->set_latency(0.0001)->seal(); + l_down = cluster->create_link(hostname + "_down", 1.25e8)->set_latency(0.0001)->seal(); } + sg4::LinkInRoute backbone{l_bb}; + sg4::LinkInRoute link_up{l_up}; + sg4::LinkInRoute link_down{l_down}; /* add link UP and backbone for communications from the host */ - cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, std::vector{l_up, l_bb}, false); + cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {link_up, backbone}, false); /* add backbone and link DOWN for communications to the host */ - cluster->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, std::vector{l_bb, l_down}, false); + cluster->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, {backbone, link_down}, false); } /* create router */ @@ -79,9 +81,10 @@ void load_platform(const sg4::Engine& e) create_cluster(root, "2", {"host4", "host5", "host6"}, "host6"); /* connect both cluster through their respective routers */ - sg4::Link* link = root->create_link("link1-2", std::vector{2.25e9})->set_latency(5e-4)->seal(); + const sg4::Link* l = root->create_link("link1-2", 2.25e9)->set_latency(5e-4)->seal(); + sg4::LinkInRoute link{l}; root->add_route(e.netpoint_by_name_or_null("cluster1"), e.netpoint_by_name_or_null("cluster2"), e.netpoint_by_name_or_null("router1"), e.netpoint_by_name_or_null("router2"), {link}); root->seal(); -} \ No newline at end of file +}