X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7f4f03348bd07609e258eb3b545bdafc2c881847..ac3ee4faa126c5b894fb4040b33d6b4e02047921:/src/surf/surf_routing_floyd.cpp diff --git a/src/surf/surf_routing_floyd.cpp b/src/surf/surf_routing_floyd.cpp index 8309a02721..934273b73a 100644 --- a/src/surf/surf_routing_floyd.cpp +++ b/src/surf/surf_routing_floyd.cpp @@ -4,8 +4,9 @@ /* 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. */ -#include "surf_routing_floyd.hpp" -#include "network_interface.hpp" +#include "src/surf/surf_routing_private.hpp" +#include "src/surf/surf_routing_floyd.hpp" +#include "src/surf/network_interface.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf"); @@ -20,7 +21,7 @@ AS_t model_floyd_create(void) void model_floyd_end(AS_t current_routing) { - static_cast(current_routing)->end(); + current_routing->Seal(); } namespace simgrid { @@ -37,12 +38,12 @@ AsFloyd::~AsFloyd(){ int table_size; table_size = (int)xbt_dynar_length(p_indexNetworkElm); if (p_linkTable == NULL) // Dealing with a parse error in the file? - return; + return; /* Delete link_table */ for (i = 0; i < table_size; i++) - for (j = 0; j < table_size; j++) { - generic_free_route(TO_FLOYD_LINK(i, j)); - } + for (j = 0; j < table_size; j++) { + generic_free_route(TO_FLOYD_LINK(i, j)); + } xbt_free(p_linkTable); /* Delete bypass dict */ xbt_dict_free(&p_bypassRoutes); @@ -59,13 +60,13 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes() route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); int src,dst; - sg_routing_edge_t src_elm, dst_elm; + sg_netcard_t src_elm, dst_elm; int table_size = xbt_dynar_length(p_indexNetworkElm); for(src=0; src < table_size; src++) { for(dst=0; dst< table_size; dst++) { xbt_dynar_reset(route->link_list); - src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*); - dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*); + src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, NetCard*); + dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, NetCard*); this->getRouteAndLatency(src_elm, dst_elm, route, NULL); if (xbt_dynar_length(route->link_list) == 1) { @@ -85,7 +86,7 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes() return ret; } -void AsFloyd::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t res, double *lat) +void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t res, double *lat) { /* set utils vars */ @@ -110,7 +111,7 @@ void AsFloyd::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_ro res->gw_dst = xbt_dynar_getfirst_as(route_stack, sg_platf_route_cbarg_t)->gw_dst; } - sg_routing_edge_t prev_dst_gw = NULL; + sg_netcard_t prev_dst_gw = NULL; while (!xbt_dynar_is_empty(route_stack)) { sg_platf_route_cbarg_t e_route = xbt_dynar_pop_as(route_stack, sg_platf_route_cbarg_t); xbt_dynar_t links; @@ -119,7 +120,7 @@ void AsFloyd::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_ro if (p_hierarchy == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL && strcmp(prev_dst_gw->getName(), e_route->gw_src->getName())) { - routing_get_route_and_latency(prev_dst_gw, e_route->gw_src, + routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src, &res->link_list, lat); } @@ -152,10 +153,10 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route) /* set the size of table routing */ int table_size = (int)xbt_dynar_length(p_indexNetworkElm); - RoutingEdge *src_net_elm, *dst_net_elm; + NetCard *src_net_elm, *dst_net_elm; - src_net_elm = sg_routing_edge_by_name_or_null(src); - dst_net_elm = sg_routing_edge_by_name_or_null(dst); + src_net_elm = sg_netcard_by_name_or_null(src); + dst_net_elm = sg_netcard_by_name_or_null(dst); xbt_assert(src_net_elm, "Network elements %s not found", src); xbt_assert(dst_net_elm, "Network elements %s not found", dst); @@ -246,8 +247,8 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route) { if(route->gw_dst && route->gw_src) { - sg_routing_edge_t gw_src = route->gw_src; - sg_routing_edge_t gw_dst = route->gw_dst; + sg_netcard_t gw_src = route->gw_src; + sg_netcard_t gw_dst = route->gw_dst; route->gw_src = gw_dst; route->gw_dst = gw_src; } @@ -259,7 +260,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route) route->gw_src->getName(), src, route->gw_dst->getName()); TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId()) = - newExtendedRoute(p_hierarchy, route, 0); + newExtendedRoute(p_hierarchy, route, 0); TO_FLOYD_PRED(dst_net_elm->getId(), src_net_elm->getId()) = dst_net_elm->getId(); TO_FLOYD_COST(dst_net_elm->getId(), src_net_elm->getId()) = ((TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId()))->link_list)->used; /* count of links, old model assume 1 */ @@ -268,7 +269,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route) xbt_dynar_free(&route->link_list); } -void AsFloyd::end(){ +void AsFloyd::Seal(){ unsigned int i, j, a, b, c; /* set the size of table routing */