From b4fb9a399f454d51935b43901968f9dfa8ab6bd5 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 12 Feb 2016 02:30:07 +0100 Subject: [PATCH] rename the fields of AS for clarity sake --- src/surf/network_ns3.cpp | 2 +- src/surf/sg_platf.cpp | 12 ++--- src/surf/surf_routing.cpp | 64 ++++++++++++------------- src/surf/surf_routing.hpp | 25 +++++----- src/surf/surf_routing_cluster.cpp | 14 +++--- src/surf/surf_routing_cluster_torus.cpp | 8 ++-- src/surf/surf_routing_dijkstra.cpp | 16 +++---- src/surf/surf_routing_floyd.cpp | 16 +++---- src/surf/surf_routing_full.cpp | 10 ++-- src/surf/surf_routing_generic.cpp | 38 +++++++-------- src/surf/surf_routing_vivaldi.cpp | 8 ++-- 11 files changed, 107 insertions(+), 106 deletions(-) diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index c095a6452d..49ac044ca0 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -60,7 +60,7 @@ static void simgrid_ns3_add_router(simgrid::surf::NetCard* router) static void parse_ns3_add_AS(simgrid::surf::As* as) { - const char* as_id = as->p_name; + const char* as_id = as->name_; XBT_DEBUG("NS3_ADD_AS '%s'", as_id); xbt_lib_set(as_router_lib, as_id, NS3_ASR_LEVEL, ns3_add_AS(as_id) ); } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 5d47172739..bdf0803588 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -67,8 +67,8 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host) "Refusing to create a second host named '%s'.", host->id); simgrid::surf::As* current_routing = routing_get_current(); - if (current_routing->p_hierarchy == SURF_ROUTING_NULL) - current_routing->p_hierarchy = SURF_ROUTING_BASE; + if (current_routing->hierarchy_ == SURF_ROUTING_NULL) + current_routing->hierarchy_ = SURF_ROUTING_BASE; simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(host->id, SURF_NETWORK_ELEMENT_HOST, current_routing); @@ -123,8 +123,8 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router) { simgrid::surf::As* current_routing = routing_get_current(); - if (current_routing->p_hierarchy == SURF_ROUTING_NULL) - current_routing->p_hierarchy = SURF_ROUTING_BASE; + if (current_routing->hierarchy_ == SURF_ROUTING_NULL) + current_routing->hierarchy_ = SURF_ROUTING_BASE; xbt_assert(!xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL), "Reading a router, processing unit \"%s\" already exists", router->id); @@ -315,7 +315,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) info_loop.link_up = Link::byName(tmp_link); info_loop.link_down = info_loop.link_up; free(tmp_link); - xbt_dynar_set(current_routing->p_linkUpDownList, + xbt_dynar_set(current_routing->upDownLinks, rankId*(static_cast(current_routing))->p_nb_links_per_node, &info_loop); } @@ -337,7 +337,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) info_lim.link_down = info_lim.link_up; free(tmp_link); auto as_cluster = static_cast(current_routing); - xbt_dynar_set(current_routing->p_linkUpDownList, + xbt_dynar_set(current_routing->upDownLinks, rankId*(as_cluster)->p_nb_links_per_node + as_cluster->p_has_loopback , &info_lim); diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 759ba1266f..f36740dbe7 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -30,16 +30,16 @@ namespace surf { simgrid::xbt::signal asCreatedCallbacks; As::As(const char*name) - : p_name(xbt_strdup(name)) + : name_(xbt_strdup(name)) {} As::~As() { - xbt_dict_free(&p_routingSons); + xbt_dict_free(&sons_); xbt_dynar_free(&p_indexNetworkElm); - xbt_dynar_free(&p_linkUpDownList); - xbt_free(p_name); - if (p_netcard) - delete p_netcard; + xbt_dynar_free(&upDownLinks); + xbt_free(name_); + if (netcard_) + delete netcard_; } }} // namespace simgrid::surf @@ -105,12 +105,12 @@ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t netcard_arg) xbt_assert(link_up_down.link_down, "Link '%s' not found!",netcard_arg->link_down); // If dynar is is greater than netcard id and if the host_link is already defined - if((int)xbt_dynar_length(current_routing->p_linkUpDownList) > netcard->getId() && - xbt_dynar_get_as(current_routing->p_linkUpDownList, netcard->getId(), void*)) + if((int)xbt_dynar_length(current_routing->upDownLinks) > netcard->getId() && + xbt_dynar_get_as(current_routing->upDownLinks, netcard->getId(), void*)) surf_parse_error("Host_link for '%s' is already defined!",netcard_arg->id); XBT_DEBUG("Push Host_link for host '%s' to position %d", netcard->getName(), netcard->getId()); - xbt_dynar_set_as(current_routing->p_linkUpDownList, netcard->getId(), s_surf_parsing_link_up_down_t, link_up_down); + xbt_dynar_set_as(current_routing->upDownLinks, netcard->getId(), s_surf_parsing_link_up_down_t, link_up_down); } void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) @@ -166,24 +166,24 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) } /* make a new routing component */ - simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->p_name, SURF_NETWORK_ELEMENT_AS, current_routing); + simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->name_, SURF_NETWORK_ELEMENT_AS, current_routing); if (current_routing == NULL && routing_platf->p_root == NULL) { /* it is the first one */ - new_as->p_routingFather = NULL; + new_as->father_ = NULL; routing_platf->p_root = new_as; netcard->setId(-1); } else if (current_routing != NULL && routing_platf->p_root != NULL) { - xbt_assert(!xbt_dict_get_or_null(current_routing->p_routingSons, AS->id), + xbt_assert(!xbt_dict_get_or_null(current_routing->sons_, AS->id), "The AS \"%s\" already exists", AS->id); /* it is a part of the tree */ - new_as->p_routingFather = current_routing; + new_as->father_ = current_routing; /* set the father behavior */ - if (current_routing->p_hierarchy == SURF_ROUTING_NULL) - current_routing->p_hierarchy = SURF_ROUTING_RECURSIVE; + if (current_routing->hierarchy_ == SURF_ROUTING_NULL) + current_routing->hierarchy_ = SURF_ROUTING_RECURSIVE; /* add to the sons dictionary */ - xbt_dict_set(current_routing->p_routingSons, AS->id, + xbt_dict_set(current_routing->sons_, AS->id, (void *) new_as, NULL); /* add to the father element list */ netcard->setId(current_routing->parseAS(netcard)); @@ -193,11 +193,11 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) xbt_lib_set(as_router_lib, netcard->getName(), ROUTING_ASR_LEVEL, (void *) netcard); - XBT_DEBUG("Having set name '%s' id '%d'", new_as->p_name, netcard->getId()); + XBT_DEBUG("Having set name '%s' id '%d'", new_as->name_, netcard->getId()); /* set the new current component of the tree */ current_routing = new_as; - current_routing->p_netcard = netcard; + current_routing->netcard_ = netcard; simgrid::surf::netcardCreatedCallbacks(netcard); simgrid::surf::asCreatedCallbacks(new_as); @@ -218,7 +218,7 @@ void routing_AS_end() { xbt_assert(current_routing, "Cannot seal the current AS: none under construction"); current_routing->Seal(); - current_routing = current_routing->p_routingFather; + current_routing = current_routing->father_; } /* Aux Business methods */ @@ -263,12 +263,12 @@ static void elements_father(sg_netcard_t src, sg_netcard_t dst, "Ask for route \"from\"(%s) or \"to\"(%s) no found", src_name, dst_name); /* (2) find the path to the root routing component */ - for (current = src_as; current != NULL; current = current->p_routingFather) { + for (current = src_as; current != NULL; current = current->father_) { if (index_src >= ELEMENTS_FATHER_MAXDEPTH) xbt_die("ELEMENTS_FATHER_MAXDEPTH should be increased for path_src"); path_src[index_src++] = current; } - for (current = dst_as; current != NULL; current = current->p_routingFather) { + for (current = dst_as; current != NULL; current = current->father_) { if (index_dst >= ELEMENTS_FATHER_MAXDEPTH) xbt_die("ELEMENTS_FATHER_MAXDEPTH should be increased for path_dst"); path_dst[index_dst++] = current; @@ -321,7 +321,7 @@ static void _get_route_and_latency( simgrid::surf::As *common_father, *src_father, *dst_father; elements_father(src, dst, &common_father, &src_father, &dst_father); XBT_DEBUG("elements_father: common father '%s' src_father '%s' dst_father '%s'", - common_father->p_name, src_father->p_name, dst_father->p_name); + common_father->name_, src_father->name_, dst_father->name_); /* Check whether a direct bypass is defined */ sg_platf_route_cbarg_t e_route_bypass = NULL; @@ -348,8 +348,8 @@ static void _get_route_and_latency( route.link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); // Find the net_card corresponding to father - simgrid::surf::NetCard *src_father_netcard = src_father->p_netcard; - simgrid::surf::NetCard *dst_father_netcard = dst_father->p_netcard; + simgrid::surf::NetCard *src_father_netcard = src_father->netcard_; + simgrid::surf::NetCard *dst_father_netcard = dst_father->netcard_; common_father->getRouteAndLatency(src_father_netcard, dst_father_netcard, &route, latency); @@ -427,7 +427,7 @@ xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(As *rc) char *key; xbt_dict_cursor_t cursor = NULL; AS_t rc_child; - xbt_dict_foreach(rc->p_routingSons, cursor, key, rc_child) { + xbt_dict_foreach(rc->sons_, cursor, key, rc_child) { xbt_dynar_t onelink_child = recursiveGetOneLinkRoutes(rc_child); if (onelink_child) xbt_dynar_merge(&ret,&onelink_child); @@ -460,10 +460,10 @@ void routing_cluster_add_backbone(void* bb) { simgrid::surf::AsCluster *cluster = dynamic_cast(current_routing); xbt_assert(cluster, "Only hosts from Cluster can get a backbone."); - xbt_assert(nullptr == cluster->p_backbone, "Cluster %s already has a backbone link!", cluster->p_name); + xbt_assert(nullptr == cluster->p_backbone, "Cluster %s already has a backbone link!", cluster->name_); cluster->p_backbone = static_cast(bb); - XBT_DEBUG("Add a backbone to AS '%s'", current_routing->p_name); + XBT_DEBUG("Add a backbone to AS '%s'", current_routing->name_); } void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) @@ -779,7 +779,7 @@ static void finalize_rec(simgrid::surf::As *as) { char *key; AS_t elem; - xbt_dict_foreach(as->p_routingSons, cursor, key, elem) { + xbt_dict_foreach(as->sons_, cursor, key, elem) { finalize_rec(elem); } @@ -812,7 +812,7 @@ AS_t surf_AS_get_routing_root() { } const char *surf_AS_get_name(simgrid::surf::As *as) { - return as->p_name; + return as->name_; } static simgrid::surf::As *surf_AS_recursive_get_by_name( @@ -823,10 +823,10 @@ static simgrid::surf::As *surf_AS_recursive_get_by_name( AS_t elem; simgrid::surf::As *tmp = NULL; - if(!strcmp(current->p_name, name)) + if(!strcmp(current->name_, name)) return current; - xbt_dict_foreach(current->p_routingSons, cursor, key, elem) { + xbt_dict_foreach(current->sons_, cursor, key, elem) { tmp = surf_AS_recursive_get_by_name(elem, name); if(tmp != NULL ) { break; @@ -845,7 +845,7 @@ simgrid::surf::As *surf_AS_get_by_name(const char * name) xbt_dict_t surf_AS_get_routing_sons(simgrid::surf::As *as) { - return as->p_routingSons; + return as->sons_; } xbt_dynar_t surf_AS_get_hosts(simgrid::surf::As *as) diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 5bfc90df6c..7a67da8792 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -53,15 +53,15 @@ public: virtual void Seal()=0; virtual ~As(); - char *p_name = nullptr; - NetCard *p_netcard = nullptr; - As *p_routingFather = nullptr; + char *name_ = nullptr; + NetCard *netcard_ = nullptr; + As *father_ = nullptr; + xbt_dict_t sons_ = xbt_dict_new_homogeneous(NULL); - xbt_dynar_t p_indexNetworkElm = xbt_dynar_new(sizeof(char*),NULL); - xbt_dict_t p_bypassRoutes = nullptr; - e_surf_routing_hierarchy_t p_hierarchy = SURF_ROUTING_NULL; - xbt_dict_t p_routingSons = xbt_dict_new_homogeneous(NULL); - xbt_dynar_t p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL); + xbt_dynar_t p_indexNetworkElm = xbt_dynar_new(sizeof(char*),NULL); // TODO: What is it? + xbt_dict_t bypassRoutes_ = nullptr; + e_surf_routing_hierarchy_t hierarchy_ = SURF_ROUTING_NULL; + xbt_dynar_t upDownLinks = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL); @@ -86,10 +86,10 @@ public: NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency)=0; virtual xbt_dynar_t getOneLinkRoutes()=0; + virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0; - virtual sg_platf_route_cbarg_t getBypassRoute( - NetCard *src, NetCard *dst, - double *lat)=0; + + virtual sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst,double *lat)=0; /* The parser calls the following functions to inform the routing models * that a new element is added to the AS currently built. @@ -107,7 +107,8 @@ public: NetCardImpl(const char *name, e_surf_network_element_type_t componentType, As *component) : component_(component), componentType_(componentType), - name_(xbt_strdup(name)) {} + name_(xbt_strdup(name)) + {} ~NetCardImpl() { xbt_free(name_);}; int getId() {return id_;} diff --git a/src/surf/surf_routing_cluster.cpp b/src/surf/surf_routing_cluster.cpp index 913d605908..f384013699 100644 --- a/src/surf/surf_routing_cluster.cpp +++ b/src/surf/surf_routing_cluster.cpp @@ -28,7 +28,7 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router if((src->getId() == dst->getId()) && p_has_loopback ){ - info = xbt_dynar_get_as(p_linkUpDownList, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t); xbt_dynar_push_as(route->link_list, void *, info.link_up); if (lat) *lat += static_cast(info.link_up)->getLatency(); @@ -37,11 +37,11 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb if (p_has_limiter){ // limiter for sender - info = xbt_dynar_get_as(p_linkUpDownList, src->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t); xbt_dynar_push_as(route->link_list, void *, info.link_up); } - info = xbt_dynar_get_as(p_linkUpDownList, src->getId() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t); if (info.link_up) { // link up xbt_dynar_push_as(route->link_list, void *, info.link_up); if (lat) @@ -58,7 +58,7 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb } if (dst->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router - info = xbt_dynar_get_as(p_linkUpDownList, dst->getId() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, dst->getId() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t); if (info.link_down) { // link down xbt_dynar_push_as(route->link_list, void *, info.link_down); @@ -66,7 +66,7 @@ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb *lat += static_cast(info.link_down)->getLatency(); } if (p_has_limiter){ // limiter for receiver - info = xbt_dynar_get_as(p_linkUpDownList, dst->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, dst->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t); xbt_dynar_push_as(route->link_list, void *, info.link_up); } } @@ -100,7 +100,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) { previous = new_xbt_graph_node(graph, src->getName(), nodes); - info = xbt_dynar_get_as(p_linkUpDownList, src->getId(), s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, src->getId(), s_surf_parsing_link_up_down_t); if (info.link_up) { // link up @@ -158,7 +158,7 @@ void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, info.link_up = sg_link_by_name(link_id); info.link_down = info.link_up; } - xbt_dynar_set(p_linkUpDownList, position, &info); + xbt_dynar_set(upDownLinks, position, &info); xbt_free(link_id); } diff --git a/src/surf/surf_routing_cluster_torus.cpp b/src/surf/surf_routing_cluster_torus.cpp index 2770527846..340a81723e 100644 --- a/src/surf/surf_routing_cluster_torus.cpp +++ b/src/surf/surf_routing_cluster_torus.cpp @@ -79,7 +79,7 @@ namespace simgrid { * note that position rankId*(xbt_dynar_length(dimensions)+has_loopack?+has_limiter?) * holds the link "rankId->rankId" */ - xbt_dynar_set(p_linkUpDownList, position + j, &info); + xbt_dynar_set(upDownLinks, position + j, &info); dim_product *= current_dimension; xbt_free(link_id); } @@ -121,7 +121,7 @@ namespace simgrid { if ((src->getId() == dst->getId()) && p_has_loopback) { s_surf_parsing_link_up_down_t info = - xbt_dynar_get_as(p_linkUpDownList, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t); + xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t); xbt_dynar_push_as(route->link_list, void *, info.link_up); if (lat) @@ -203,11 +203,11 @@ namespace simgrid { s_surf_parsing_link_up_down_t info; if (p_has_limiter) { // limiter for sender - info = xbt_dynar_get_as(p_linkUpDownList, nodeOffset + p_has_loopback, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, nodeOffset + p_has_loopback, s_surf_parsing_link_up_down_t); xbt_dynar_push_as(route->link_list, void *, info.link_up); } - info = xbt_dynar_get_as(p_linkUpDownList, linkOffset, s_surf_parsing_link_up_down_t); + info = xbt_dynar_get_as(upDownLinks, linkOffset, s_surf_parsing_link_up_down_t); if (use_lnk_up == false) { xbt_dynar_push_as(route->link_list, void *, info.link_down); diff --git a/src/surf/surf_routing_dijkstra.cpp b/src/surf/surf_routing_dijkstra.cpp index 0fad7412f9..1808d9293f 100644 --- a/src/surf/surf_routing_dijkstra.cpp +++ b/src/surf/surf_routing_dijkstra.cpp @@ -52,7 +52,7 @@ void AsDijkstra::Seal() p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free); /* Add the loopback if needed */ - if (routing_platf->p_loopback && p_hierarchy == SURF_ROUTING_BASE) + if (routing_platf->p_loopback && hierarchy_ == SURF_ROUTING_BASE) addLoopback(); /* initialize graph indexes in nodes after graph has been built */ @@ -182,9 +182,9 @@ xbt_dynar_t AsDijkstra::getOneLinkRoutes() if (xbt_dynar_length(route->link_list) == 1) { void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0); Onelink *onelink; - if (p_hierarchy == SURF_ROUTING_BASE) + if (hierarchy_ == SURF_ROUTING_BASE) onelink = new Onelink(link, src_elm, dst_elm); - else if (p_hierarchy == SURF_ROUTING_RECURSIVE) + else if (hierarchy_ == SURF_ROUTING_RECURSIVE) onelink = new Onelink(link, route->gw_src, route->gw_dst); else onelink = new Onelink(link, NULL, NULL); @@ -341,7 +341,7 @@ void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c if (v == dst_node_id) first_gw = gw_dst; - if (p_hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id + if (hierarchy_ == SURF_ROUTING_RECURSIVE && v != dst_node_id && strcmp(gw_dst->getName(), prev_gw_src->getName())) { xbt_dynar_t e_route_as_to_as=NULL; @@ -367,7 +367,7 @@ void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c size++; } - if (p_hierarchy == SURF_ROUTING_RECURSIVE) { + if (hierarchy_ == SURF_ROUTING_RECURSIVE) { route->gw_src = gw_src; route->gw_dst = first_gw; } @@ -429,7 +429,7 @@ void AsDijkstra::end() p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free); /* Add the loopback if needed */ - if (routing_platf->p_loopback && p_hierarchy == SURF_ROUTING_BASE) + if (routing_platf->p_loopback && hierarchy_ == SURF_ROUTING_BASE) addLoopback(); /* initialize graph indexes in nodes after graph has been built */ @@ -482,7 +482,7 @@ void AsDijkstra::parseRoute(sg_platf_route_cbarg_t route) if (m_cached && !p_routeCache) p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free); - sg_platf_route_cbarg_t e_route = newExtendedRoute(p_hierarchy, route, 1); + sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, route, 1); newRoute(src_net_elm->getId(), dst_net_elm->getId(), e_route); // Symmetrical YES @@ -511,7 +511,7 @@ void AsDijkstra::parseRoute(sg_platf_route_cbarg_t route) route->gw_src = route->gw_dst; route->gw_dst = gw_tmp; } - sg_platf_route_cbarg_t link_route_back = newExtendedRoute(p_hierarchy, route, 0); + sg_platf_route_cbarg_t link_route_back = newExtendedRoute(hierarchy_, route, 0); newRoute(dst_net_elm->getId(), src_net_elm->getId(), link_route_back); } xbt_dynar_free(&route->link_list); diff --git a/src/surf/surf_routing_floyd.cpp b/src/surf/surf_routing_floyd.cpp index 38c9c432ca..8500720e50 100644 --- a/src/surf/surf_routing_floyd.cpp +++ b/src/surf/surf_routing_floyd.cpp @@ -38,7 +38,7 @@ AsFloyd::~AsFloyd(){ } xbt_free(p_linkTable); /* Delete bypass dict */ - xbt_dict_free(&p_bypassRoutes); + xbt_dict_free(&bypassRoutes_); /* Delete predecessor and cost table */ xbt_free(p_predecessorTable); xbt_free(p_costTable); @@ -64,9 +64,9 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes() if (xbt_dynar_length(route->link_list) == 1) { void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0); Onelink *onelink; - if (p_hierarchy == SURF_ROUTING_BASE) + if (hierarchy_ == SURF_ROUTING_BASE) onelink = new Onelink(link, src_elm, dst_elm); - else if (p_hierarchy == SURF_ROUTING_RECURSIVE) + else if (hierarchy_ == SURF_ROUTING_RECURSIVE) onelink = new Onelink(link, route->gw_src, route->gw_dst); else onelink = new Onelink(link, NULL, NULL); @@ -98,7 +98,7 @@ void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbar cur = pred; } while (cur != src->getId()); - if (p_hierarchy == SURF_ROUTING_RECURSIVE) { + if (hierarchy_ == SURF_ROUTING_RECURSIVE) { res->gw_src = xbt_dynar_getlast_as(route_stack, sg_platf_route_cbarg_t)->gw_src; res->gw_dst = xbt_dynar_getfirst_as(route_stack, sg_platf_route_cbarg_t)->gw_dst; } @@ -110,7 +110,7 @@ void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbar void *link; unsigned int cpt; - if (p_hierarchy == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL + if (hierarchy_ == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL && strcmp(prev_dst_gw->getName(), e_route->gw_src->getName())) { routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src, &res->link_list, lat); @@ -202,7 +202,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route) else { TO_FLOYD_LINK(src_net_elm->getId(), dst_net_elm->getId()) = - newExtendedRoute(p_hierarchy, route, 1); + newExtendedRoute(hierarchy_, route, 1); TO_FLOYD_PRED(src_net_elm->getId(), dst_net_elm->getId()) = src_net_elm->getId(); TO_FLOYD_COST(src_net_elm->getId(), dst_net_elm->getId()) = ((TO_FLOYD_LINK(src_net_elm->getId(), dst_net_elm->getId()))->link_list)->used; /* count of links, old model assume 1 */ @@ -252,7 +252,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(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 */ @@ -283,7 +283,7 @@ void AsFloyd::Seal(){ } /* Add the loopback if needed */ - if (routing_platf->p_loopback && p_hierarchy == SURF_ROUTING_BASE) { + if (routing_platf->p_loopback && hierarchy_ == SURF_ROUTING_BASE) { for (i = 0; i < table_size; i++) { sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i); if (!e_route) { diff --git a/src/surf/surf_routing_full.cpp b/src/surf/surf_routing_full.cpp index a64bc49d0d..fc1c034d8a 100644 --- a/src/surf/surf_routing_full.cpp +++ b/src/surf/surf_routing_full.cpp @@ -31,7 +31,7 @@ void AsFull::Seal() { p_routingTable = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); /* Add the loopback if needed */ - if (routing_platf->p_loopback && p_hierarchy == SURF_ROUTING_BASE) { + if (routing_platf->p_loopback && hierarchy_ == SURF_ROUTING_BASE) { for (i = 0; i < table_size; i++) { e_route = TO_ROUTE_FULL(i, i); if (!e_route) { @@ -76,13 +76,13 @@ xbt_dynar_t AsFull::getOneLinkRoutes() if (xbt_dynar_length(route->link_list) == 1) { void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0); Onelink *onelink; - if (p_hierarchy == SURF_ROUTING_BASE) { + if (hierarchy_ == SURF_ROUTING_BASE) { NetCard *tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_netcard_t); tmp_src->setId(src); NetCard *tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_netcard_t); tmp_dst->setId(dst); onelink = new Onelink(link, tmp_src, tmp_dst); - } else if (p_hierarchy == SURF_ROUTING_RECURSIVE) + } else if (hierarchy_ == SURF_ROUTING_RECURSIVE) onelink = new Onelink(link, route->gw_src, route->gw_dst); else onelink = new Onelink(link, NULL, NULL); @@ -219,7 +219,7 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route) XBT_DEBUG("ASroute goes from \"%s\" to \"%s\"", route->gw_src->getName(), route->gw_dst->getName()); } - TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId()) = newExtendedRoute(p_hierarchy, route, 1); + TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId()) = newExtendedRoute(hierarchy_, route, 1); xbt_dynar_shrink(TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId())->link_list, 0); } @@ -254,7 +254,7 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route) else XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst, route->gw_src->getName(), src, route->gw_dst->getName()); - TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId()) = newExtendedRoute(p_hierarchy, route, 0); + TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId()) = newExtendedRoute(hierarchy_, route, 0); xbt_dynar_shrink(TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId())->link_list, 0); } } diff --git a/src/surf/surf_routing_generic.cpp b/src/surf/surf_routing_generic.cpp index 262042a96c..3e8a8d82c5 100644 --- a/src/surf/surf_routing_generic.cpp +++ b/src/surf/surf_routing_generic.cpp @@ -50,12 +50,12 @@ void AsGeneric::getRouteAndLatency(NetCard */*src*/, NetCard */*dst*/, sg_platf_ AsGeneric::AsGeneric(const char*name) : AsNone(name) { - p_bypassRoutes = xbt_dict_new_homogeneous((void (*)(void *)) routing_route_free); + bypassRoutes_ = xbt_dict_new_homogeneous((void (*)(void *)) routing_route_free); } AsGeneric::~AsGeneric() { - xbt_dict_free(&p_bypassRoutes); + xbt_dict_free(&bypassRoutes_); } int AsGeneric::parsePU(NetCard *elm) @@ -81,7 +81,7 @@ void AsGeneric::parseBypassroute(sg_platf_route_cbarg_t e_route) XBT_DEBUG("Load bypassASroute from \"%s\" to \"%s\"", src, dst); else XBT_DEBUG("Load bypassRoute from \"%s\" to \"%s\"", src, dst); - xbt_dict_t dict_bypassRoutes = p_bypassRoutes; + xbt_dict_t dict_bypassRoutes = bypassRoutes_; char *route_name; route_name = bprintf("%s#%s", src, dst); @@ -232,7 +232,7 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(NetCard *src, return NULL; sg_platf_route_cbarg_t e_route_bypass = NULL; - xbt_dict_t dict_bypassRoutes = p_bypassRoutes; + xbt_dict_t dict_bypassRoutes = bypassRoutes_; if(dst->getRcComponent() == this && src->getRcComponent() == this ){ char *route_name = bprintf("%s#%s", src->getName(), dst->getName()); @@ -253,7 +253,7 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(NetCard *src, if (src == NULL || dst == NULL) xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"", src ? src->getName() : "(null)", - dst ? dst->getName() : "(null)", p_name); + dst ? dst->getName() : "(null)", name_); src_as = src->getRcComponent(); dst_as = dst->getRcComponent(); @@ -263,13 +263,13 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(NetCard *src, current = src_as; while (current != NULL) { xbt_dynar_push(path_src, ¤t); - current = current->p_routingFather; + current = current->father_; } path_dst = xbt_dynar_new(sizeof(As*), NULL); current = dst_as; while (current != NULL) { xbt_dynar_push(path_dst, ¤t); - current = current->p_routingFather; + current = current->father_; } /* (3) find the common father */ @@ -297,9 +297,9 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(NetCard *src, if (i <= max_index_src && max <= max_index_dst) { char *route_name = bprintf("%s#%s", (*(As **) - (xbt_dynar_get_ptr(path_src, i)))->p_name, + (xbt_dynar_get_ptr(path_src, i)))->name_, (*(As **) - (xbt_dynar_get_ptr(path_dst, max)))->p_name); + (xbt_dynar_get_ptr(path_dst, max)))->name_); e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name); xbt_free(route_name); } @@ -308,9 +308,9 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(NetCard *src, if (max <= max_index_src && i <= max_index_dst) { char *route_name = bprintf("%s#%s", (*(As **) - (xbt_dynar_get_ptr(path_src, max)))->p_name, + (xbt_dynar_get_ptr(path_src, max)))->name_, (*(As **) - (xbt_dynar_get_ptr(path_dst, i)))->p_name); + (xbt_dynar_get_ptr(path_dst, i)))->name_); e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name); xbt_free(route_name); } @@ -324,9 +324,9 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(NetCard *src, if (max <= max_index_src && max <= max_index_dst) { char *route_name = bprintf("%s#%s", (*(As **) - (xbt_dynar_get_ptr(path_src, max)))->p_name, + (xbt_dynar_get_ptr(path_src, max)))->name_, (*(As **) - (xbt_dynar_get_ptr(path_dst, max)))->p_name); + (xbt_dynar_get_ptr(path_dst, max)))->name_); e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name); xbt_free(route_name); } @@ -405,24 +405,24 @@ void AsGeneric::srcDstCheck(NetCard *src, NetCard *dst) xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"", src ? src->getName() : "(null)", dst ? dst->getName() : "(null)", - p_name); + name_); As *src_as = src->getRcComponent(); As *dst_as = dst->getRcComponent(); if (src_as != dst_as) xbt_die("The src(%s in %s) and dst(%s in %s) are in differents AS", - src->getName(), src_as->p_name, - dst->getName(), dst_as->p_name); + src->getName(), src_as->name_, + dst->getName(), dst_as->name_); if (this != dst_as) xbt_die ("The routing component of src'%s' and dst'%s' is not the same as the network elements belong (%s?=%s?=%s)", src->getName(), dst->getName(), - src_as->p_name, - dst_as->p_name, - p_name); + src_as->name_, + dst_as->name_, + name_); } } diff --git a/src/surf/surf_routing_vivaldi.cpp b/src/surf/surf_routing_vivaldi.cpp index c22d2f5976..6249166212 100644 --- a/src/surf/surf_routing_vivaldi.cpp +++ b/src/surf/surf_routing_vivaldi.cpp @@ -51,8 +51,8 @@ void AsVivaldi::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb if(src->getRcType() == SURF_NETWORK_ELEMENT_HOST){ tmp_src_name = HOST_PEER(src->getName()); - if ((int)xbt_dynar_length(p_linkUpDownList)>src->getId()) { - info = xbt_dynar_get_as(p_linkUpDownList, src->getId(), s_surf_parsing_link_up_down_t); + if ((int)xbt_dynar_length(upDownLinks)>src->getId()) { + info = xbt_dynar_get_as(upDownLinks, src->getId(), s_surf_parsing_link_up_down_t); if(info.link_up) { // link up xbt_dynar_push_as(route->link_list, void*, info.link_up); if (lat) @@ -74,8 +74,8 @@ void AsVivaldi::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb if(dst->getRcType() == SURF_NETWORK_ELEMENT_HOST){ tmp_dst_name = HOST_PEER(dst->getName()); - if ((int)xbt_dynar_length(p_linkUpDownList)>dst->getId()) { - info = xbt_dynar_get_as(p_linkUpDownList, dst->getId(), s_surf_parsing_link_up_down_t); + if ((int)xbt_dynar_length(upDownLinks)>dst->getId()) { + info = xbt_dynar_get_as(upDownLinks, dst->getId(), s_surf_parsing_link_up_down_t); if(info.link_down) { // link down xbt_dynar_push_as(route->link_list,void*,info.link_down); if (lat) -- 2.20.1