X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b87fc0829538ec066fd077e6c30ee6270b8abd78..1957cbeaedc9d28cea7839684d82ac8454cc8bef:/src/kernel/routing/ClusterZone.cpp diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 296f3f8e05..2bd66e5359 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -29,7 +29,7 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba if ((src->id() == dst->id()) && hasLoopback_) { xbt_assert(not src->isRouter(), "Routing from a cluster private router to itself is meaningless"); - std::pair info = privateLinks_.at(src->id() * linkCountPerNode_); + std::pair info = privateLinks_.at(nodePosition(src->id())); route->link_list->push_back(info.first); if (lat) *lat += info.first->latency(); @@ -38,13 +38,11 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba if (not src->isRouter()) { // No private link for the private router if (hasLimiter_) { // limiter for sender - std::pair info = - privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0)); + std::pair info = privateLinks_.at(nodePositionWithLoopback(src->id())); route->link_list->push_back(info.first); } - std::pair info = - privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0)); + std::pair info = privateLinks_.at(nodePositionWithLimiter(src->id())); if (info.first) { // link up route->link_list->push_back(info.first); if (lat) @@ -60,15 +58,14 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba if (not dst->isRouter()) { // No specific link for router - std::pair info = - privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_); + std::pair info = privateLinks_.at(nodePositionWithLimiter(dst->id())); if (info.second) { // link down route->link_list->push_back(info.second); if (lat) *lat += info.second->latency(); } if (hasLimiter_) { // limiter for receiver - info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_); + info = privateLinks_.at(nodePositionWithLoopback(dst->id())); route->link_list->push_back(info.first); } } @@ -88,7 +85,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges new_xbt_graph_edge(graph, routerNode, backboneNode, edges); } - for (auto src : getVertices()) { + for (auto const& src : getVertices()) { if (not src->isRouter()) { xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);