X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fa222c38f9b796be07ab4351ffc810a61a8fd705..dc04f83284126c46ca9f5fe5489c31fffd3eb89a:/src/surf/surf_routing_cluster.cpp diff --git a/src/surf/surf_routing_cluster.cpp b/src/surf/surf_routing_cluster.cpp index 8ee2f556e7..4c924192d5 100644 --- a/src/surf/surf_routing_cluster.cpp +++ b/src/surf/surf_routing_cluster.cpp @@ -5,6 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "surf_routing_cluster.hpp" +#include "surf_routing_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"); @@ -14,9 +15,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf" AS_t model_cluster_create(void) { - return new AsCluster(); + return new simgrid::surf::AsCluster(); } +namespace simgrid { +namespace surf { + /* Creation routing model functions */ AsCluster::AsCluster() : AsNone() { @@ -29,7 +33,7 @@ AsCluster::AsCluster() : AsNone() } /* Business methods */ -void AsCluster::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat) +void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) { s_surf_parsing_link_up_down_t info; XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]", @@ -61,7 +65,8 @@ void AsCluster::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_ } if (p_backbone) { - xbt_dynar_push_as(route->link_list, void *, static_cast(p_backbone)); + xbt_dynar_push_as(route->link_list, void *, + static_cast(p_backbone)); if (lat) *lat += p_backbone->getLatency(); } @@ -86,7 +91,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) int isrc; int table_size = xbt_dynar_length(p_indexNetworkElm); - RoutingEdge *src; + NetCard *src; xbt_node_t current, previous, backboneNode = NULL, routerNode; s_surf_parsing_link_up_down_t info; @@ -104,7 +109,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) } for (isrc = 0; isrc < table_size; isrc++) { - src = xbt_dynar_get_as(p_indexNetworkElm, isrc, RoutingEdge*); + src = xbt_dynar_get_as(p_indexNetworkElm, isrc, NetCard*); if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) { previous = new_xbt_graph_node(graph, src->getName(), nodes); @@ -113,7 +118,8 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) if (info.link_up) { // link up - const char *link_name = static_cast(info.link_up)->getName(); + const char *link_name = static_cast( + info.link_up)->getName(); current = new_xbt_graph_node(graph, link_name, nodes); new_xbt_graph_edge(graph, previous, current, edges); @@ -126,7 +132,8 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) } if (info.link_down) { // link down - const char *link_name = static_cast(info.link_down)->getName(); + const char *link_name = static_cast( + info.link_down)->getName(); current = new_xbt_graph_node(graph, link_name, nodes); new_xbt_graph_edge(graph, previous, current, edges); @@ -150,7 +157,7 @@ void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, link.id = link_id; link.bandwidth = cluster->bw; link.latency = cluster->lat; - link.state = SURF_RESOURCE_ON; + link.initiallyOn = 1; link.policy = cluster->sharing_policy; sg_platf_new_link(&link); @@ -169,15 +176,17 @@ void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, xbt_free(link_id); } -int AsCluster::parsePU(RoutingEdge *elm) { +int AsCluster::parsePU(NetCard *elm) { XBT_DEBUG("Load process unit \"%s\"", elm->getName()); - xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm); + xbt_dynar_push_as(p_indexNetworkElm, NetCard*, elm); return xbt_dynar_length(p_indexNetworkElm)-1; } -int AsCluster::parseAS(RoutingEdge *elm) { +int AsCluster::parseAS(NetCard *elm) { XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName()); - xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm); + xbt_dynar_push_as(p_indexNetworkElm, NetCard*, elm); return xbt_dynar_length(p_indexNetworkElm)-1; } +} +}