X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1f5649e6da1087111b7201e30e59f6e80104984c..a9d46ef793944afed370e7612e5b38e43be9ecc5:/src/surf/AsCluster.cpp?ds=sidebyside diff --git a/src/surf/AsCluster.cpp b/src/surf/AsCluster.cpp index 128115e349..a42c765832 100644 --- a/src/surf/AsCluster.cpp +++ b/src/surf/AsCluster.cpp @@ -9,8 +9,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"); /* This routing is specifically setup to represent clusters, aka homogeneous sets of machines - * Note that a router is created, easing the interconnexion with the rest of the world. - */ + * Note that a router is created, easing the interconnexion with the rest of the world. */ namespace simgrid { namespace surf { @@ -19,7 +18,7 @@ namespace surf { {} AsCluster::~AsCluster() { - xbt_dynar_free(&upDownLinks_); + xbt_dynar_free(&privateLinks_); } void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) @@ -31,7 +30,7 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb if (! src->isRouter()) { // No specific link for router if((src->id() == dst->id()) && has_loopback_ ){ - info = xbt_dynar_get_as(upDownLinks_, src->id() * nb_links_per_node_, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(privateLinks_, src->id() * nb_links_per_node_, s_surf_parsing_link_up_down_t); route->link_list->push_back(info.link_up); if (lat) *lat += info.link_up->getLatency(); @@ -40,11 +39,11 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb if (has_limiter_){ // limiter for sender - info = xbt_dynar_get_as(upDownLinks_, src->id() * nb_links_per_node_ + has_loopback_, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(privateLinks_, src->id() * nb_links_per_node_ + has_loopback_, s_surf_parsing_link_up_down_t); route->link_list->push_back((Link*)info.link_up); } - info = xbt_dynar_get_as(upDownLinks_, src->id() * nb_links_per_node_ + has_loopback_ + has_limiter_, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(privateLinks_, src->id() * nb_links_per_node_ + has_loopback_ + has_limiter_, s_surf_parsing_link_up_down_t); if (info.link_up) { // link up route->link_list->push_back(info.link_up); if (lat) @@ -60,7 +59,7 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb } if (! dst->isRouter()) { // No specific link for router - info = xbt_dynar_get_as(upDownLinks_, dst->id() * nb_links_per_node_ + has_loopback_ + has_limiter_, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(privateLinks_, dst->id() * nb_links_per_node_ + has_loopback_ + has_limiter_, s_surf_parsing_link_up_down_t); if (info.link_down) { // link down route->link_list->push_back(info.link_down); @@ -68,7 +67,7 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb *lat += info.link_down->getLatency(); } if (has_limiter_){ // limiter for receiver - info = xbt_dynar_get_as(upDownLinks_, dst->id() * nb_links_per_node_ + has_loopback_, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(privateLinks_, dst->id() * nb_links_per_node_ + has_loopback_, s_surf_parsing_link_up_down_t); route->link_list->push_back(info.link_up); } } @@ -102,7 +101,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) if (! src->isRouter()) { previous = new_xbt_graph_node(graph, src->name(), nodes); - info = xbt_dynar_get_as(upDownLinks_, src->id(), s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(privateLinks_, src->id(), s_surf_parsing_link_up_down_t); if (info.link_up) { // link up @@ -137,10 +136,10 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) } void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int , int position){ - s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER; s_surf_parsing_link_up_down_t info; char* link_id = bprintf("%s_link_%d", cluster->id, id); + s_sg_platf_link_cbarg_t link; memset(&link, 0, sizeof(link)); link.id = link_id; link.bandwidth = cluster->bw; @@ -150,16 +149,15 @@ void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, if (link.policy == SURF_LINK_FULLDUPLEX) { char *tmp_link = bprintf("%s_UP", link_id); - info.link_up = sg_link_by_name(tmp_link); + info.link_up = Link::byName(tmp_link); xbt_free(tmp_link); tmp_link = bprintf("%s_DOWN", link_id); - info.link_down = sg_link_by_name(tmp_link); + info.link_down = Link::byName(tmp_link); xbt_free(tmp_link); } else { - info.link_up = sg_link_by_name(link_id); - info.link_down = info.link_up; + info.link_up = info.link_down = Link::byName(link_id); } - xbt_dynar_set(upDownLinks_, position, &info); + xbt_dynar_set(privateLinks_, position, &info); xbt_free(link_id); }