X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/237fd22b56db7d1c67360c37559ce3aab16a002d..321102577020b194dfb7ba89e48687952816849e:/src/kernel/routing/StarZone.cpp diff --git a/src/kernel/routing/StarZone.cpp b/src/kernel/routing/StarZone.cpp index c30a6388d2..2de8f5e842 100644 --- a/src/kernel/routing/StarZone.cpp +++ b/src/kernel/routing/StarZone.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2009-2022. 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. */ @@ -6,18 +6,18 @@ #include "simgrid/kernel/routing/StarZone.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/kernel/routing/RoutedZone.hpp" -#include "src/surf/network_interface.hpp" +#include "src/kernel/resource/NetworkModel.hpp" #include "xbt/string.hpp" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_star, surf, "Routing part of surf"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_star, ker_routing, "Kernel Star Routing"); namespace simgrid { namespace kernel { namespace routing { StarZone::StarZone(const std::string& name) : ClusterZone(name) {} -void StarZone::add_links_to_route(const std::vector& links, Route* route, double* latency, - std::unordered_set& added_links) const +void StarZone::add_links_to_route(const std::vector& links, Route* route, double* latency, + std::unordered_set& added_links) const { for (auto* link : links) { /* do not add duplicated links in route->link_list_ */ @@ -34,7 +34,7 @@ void StarZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* const auto& src_route = routes_.at(src->id()); const auto& dst_route = routes_.at(dst->id()); - std::unordered_set added_links; + std::unordered_set added_links; /* loopback */ if (src == dst && src_route.has_loopback()) { add_links_to_route(src_route.loopback, route, latency, added_links); @@ -170,10 +170,10 @@ void StarZone::do_seal() { /* add default empty links if nothing was configured by user */ for (auto const& node : get_vertices()) { - auto route = routes_.emplace(node->id(), StarRoute()); - if (route.second) { - route.first->second.links_down_set = true; - route.first->second.links_up_set = true; + auto [route, inserted] = routes_.try_emplace(node->id()); + if (inserted) { + route->second.links_down_set = true; + route->second.links_up_set = true; } } }