From: Frederic Suter Date: Fri, 12 Jan 2018 09:05:37 +0000 (+0100) Subject: one more class in platform creation X-Git-Tag: v3.19~349 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/44ea423d2d27e986f35e6b8d60772b7acec89916 one more class in platform creation --- diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index ad30187323..2bd40cd92a 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -20,7 +20,7 @@ ClusterZone::ClusterZone(NetZone* father, std::string name) : NetZoneImpl(father { } -void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) +void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); xbt_assert(not privateLinks_.empty(), diff --git a/src/kernel/routing/ClusterZone.hpp b/src/kernel/routing/ClusterZone.hpp index 376747e598..bb1eb033b5 100644 --- a/src/kernel/routing/ClusterZone.hpp +++ b/src/kernel/routing/ClusterZone.hpp @@ -69,7 +69,7 @@ class XBT_PRIVATE ClusterZone : public NetZoneImpl { public: explicit ClusterZone(NetZone* father, std::string name); - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void getGraph(xbt_graph_t graph, std::map* nodes, std::map* edges) override; diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 5fe8bd7f04..214a02f6cb 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -17,14 +17,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf static void graph_node_data_free(void* n) { - graph_node_data_t data = static_cast(n); - delete data; + delete static_cast(n); } static void graph_edge_data_free(void* e) { - sg_platf_route_cbarg_t e_route = static_cast(e); - delete e_route; + delete static_cast(e); } /* Utility functions */ @@ -56,7 +54,7 @@ void DijkstraZone::seal() } if (not found) { - sg_platf_route_cbarg_t e_route = new s_sg_platf_route_cbarg_t; + RouteCreationArgs* e_route = new RouteCreationArgs(); e_route->link_list.push_back(surf_network_model->loopback_); xbt_graph_new_edge(routeGraph_, node, node, e_route); } @@ -92,7 +90,7 @@ xbt_node_t DijkstraZone::nodeMapSearch(int id) /* Parsing */ -void DijkstraZone::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route) +void DijkstraZone::newRoute(int src_id, int dst_id, RouteCreationArgs* e_route) { XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id); xbt_node_t src = nullptr; @@ -124,7 +122,7 @@ void DijkstraZone::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_rou xbt_graph_new_edge(routeGraph_, src, dst, e_route); } -void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) +void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { getRouteCheckParams(src, dst); int src_id = src->id(); @@ -149,7 +147,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (edge == nullptr) THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); - sg_platf_route_cbarg_t e_route = static_cast(xbt_graph_edge_get_data(edge)); + RouteCreationArgs* e_route = static_cast(xbt_graph_edge_get_data(edge)); for (auto const& link : e_route->link_list) { route->link_list.insert(route->link_list.begin(), link); @@ -194,7 +192,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb xbt_node_t u_node = xbt_graph_edge_get_target(edge); graph_node_data_t data = static_cast(xbt_graph_node_get_data(u_node)); int u_id = data->graph_id; - sg_platf_route_cbarg_t tmp_e_route = static_cast(xbt_graph_edge_get_data(edge)); + RouteCreationArgs* tmp_e_route = static_cast(xbt_graph_edge_get_data(edge)); int cost_v_u = tmp_e_route->link_list.size(); /* count of links, old model assume 1 */ if (cost_v_u + cost_arr[v_id] < cost_arr[u_id]) { @@ -219,7 +217,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (edge == nullptr) THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname()); - sg_platf_route_cbarg_t e_route = static_cast(xbt_graph_edge_get_data(edge)); + RouteCreationArgs* e_route = static_cast(xbt_graph_edge_get_data(edge)); NetPoint* prev_gw_src = gw_src; gw_src = e_route->gw_src; @@ -287,7 +285,7 @@ void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::Net * nodes */ /* Add the route to the base */ - sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1); + RouteCreationArgs* e_route = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1); newRoute(src->id(), dst->id(), e_route); // Symmetrical YES @@ -314,7 +312,7 @@ void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::Net gw_src = gw_dst; gw_dst = gw_tmp; } - sg_platf_route_cbarg_t link_route_back = + RouteCreationArgs* link_route_back = newExtendedRoute(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 0); newRoute(dst->id(), src->id(), link_route_back); } diff --git a/src/kernel/routing/DijkstraZone.hpp b/src/kernel/routing/DijkstraZone.hpp index 0f7f10d24c..001eb42f30 100644 --- a/src/kernel/routing/DijkstraZone.hpp +++ b/src/kernel/routing/DijkstraZone.hpp @@ -38,7 +38,7 @@ public: ~DijkstraZone() override; xbt_node_t routeGraphNewNode(int id, int graph_id); xbt_node_t nodeMapSearch(int id); - void newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route); + void newRoute(int src_id, int dst_id, RouteCreationArgs* e_route); /* For each vertex (node) already in the graph, * make sure it also has a loopback link; this loopback * can potentially already be in the graph, and in that @@ -50,7 +50,7 @@ public: * After this function returns, any node in the graph * will have a loopback attached to it. */ - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override; void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, std::vector& link_list, bool symmetrical) override; diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index d6eecc558e..cc72704a3f 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -260,7 +260,7 @@ void DragonflyZone::generateLinks() } } -void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* latency) +void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency) { // Minimal routing version. // TODO : non-minimal random one, and adaptive ? diff --git a/src/kernel/routing/DragonflyZone.hpp b/src/kernel/routing/DragonflyZone.hpp index fd63be55e4..111908b813 100644 --- a/src/kernel/routing/DragonflyZone.hpp +++ b/src/kernel/routing/DragonflyZone.hpp @@ -63,7 +63,7 @@ public: explicit DragonflyZone(NetZone* father, std::string name); ~DragonflyZone() override; // void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override; - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void parse_specific_arguments(ClusterCreationArgs* cluster) override; void seal() override; void generateRouters(); diff --git a/src/kernel/routing/EmptyZone.hpp b/src/kernel/routing/EmptyZone.hpp index 6d479b8b65..2ec0d85263 100644 --- a/src/kernel/routing/EmptyZone.hpp +++ b/src/kernel/routing/EmptyZone.hpp @@ -24,7 +24,7 @@ public: explicit EmptyZone(NetZone* father, std::string name); ~EmptyZone() override; - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override { /* There can't be route in an Empty zone */ } diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index 16e27989f3..9b34a4d150 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -56,7 +56,7 @@ bool FatTreeZone::isInSubTree(FatTreeNode* root, FatTreeNode* node) return true; } -void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) +void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) { if (dst->isRouter() || src->isRouter()) diff --git a/src/kernel/routing/FatTreeZone.hpp b/src/kernel/routing/FatTreeZone.hpp index 7e329b68f0..73e313a1de 100644 --- a/src/kernel/routing/FatTreeZone.hpp +++ b/src/kernel/routing/FatTreeZone.hpp @@ -100,7 +100,7 @@ class XBT_PRIVATE FatTreeZone : public ClusterZone { public: explicit FatTreeZone(NetZone* father, std::string name); ~FatTreeZone() override; - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; /** \brief Generate the fat tree * diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 9eca6d6fdc..3095394650 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -43,14 +43,14 @@ FloydZone::~FloydZone() delete[] costTable_; } -void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) +void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { unsigned int table_size = getTableSize(); getRouteCheckParams(src, dst); /* create a result route */ - std::vector route_stack; + std::vector route_stack; unsigned int cur = dst->id(); do { int pred = TO_FLOYD_PRED(src->id(), cur); @@ -67,7 +67,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg sg_netpoint_t prev_dst_gw = nullptr; while (not route_stack.empty()) { - sg_platf_route_cbarg_t e_route = route_stack.back(); + RouteCreationArgs* e_route = route_stack.back(); route_stack.pop_back(); if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr && prev_dst_gw->getCname() != e_route->gw_src->getCname()) { @@ -97,7 +97,7 @@ void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoi /* Create Cost, Predecessor and Link tables */ costTable_ = new double[table_size * table_size]; /* link cost from host to host */ predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */ - linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */ + linkTable_ = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */ /* Initialize costs and predecessors */ for (unsigned int i = 0; i < table_size; i++) @@ -163,7 +163,7 @@ void FloydZone::seal() /* Create Cost, Predecessor and Link tables */ costTable_ = new double[table_size * table_size]; /* link cost from host to host */ predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */ - linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */ + linkTable_ = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */ /* Initialize costs and predecessors */ for (unsigned int i = 0; i < table_size; i++) @@ -177,11 +177,9 @@ void FloydZone::seal() /* Add the loopback if needed */ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) { for (unsigned int i = 0; i < table_size; i++) { - sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i); + RouteCreationArgs* e_route = TO_FLOYD_LINK(i, i); if (not e_route) { - e_route = new s_sg_platf_route_cbarg_t; - e_route->gw_src = nullptr; - e_route->gw_dst = nullptr; + e_route = new RouteCreationArgs(); e_route->link_list.push_back(surf_network_model->loopback_); TO_FLOYD_LINK(i, i) = e_route; TO_FLOYD_PRED(i, i) = i; diff --git a/src/kernel/routing/FloydZone.hpp b/src/kernel/routing/FloydZone.hpp index 69ead53607..c7479c23a5 100644 --- a/src/kernel/routing/FloydZone.hpp +++ b/src/kernel/routing/FloydZone.hpp @@ -26,7 +26,7 @@ public: explicit FloydZone(NetZone* father, std::string name); ~FloydZone() override; - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, std::vector& link_list, bool symmetrical) override; @@ -36,7 +36,7 @@ private: /* vars to compute the Floyd algorithm. */ int* predecessorTable_; double* costTable_; - sg_platf_route_cbarg_t* linkTable_; + RouteCreationArgs** linkTable_; }; } } diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index bedc0cfcf6..ddcaf3de2c 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -24,16 +24,14 @@ void FullZone::seal() /* Create table if needed */ if (not routingTable_) - routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size](); + routingTable_ = new RouteCreationArgs*[table_size * table_size](); /* Add the loopback if needed */ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) { for (unsigned int i = 0; i < table_size; i++) { - sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i); + RouteCreationArgs* e_route = TO_ROUTE_FULL(i, i); if (not e_route) { - e_route = new s_sg_platf_route_cbarg_t; - e_route->gw_src = nullptr; - e_route->gw_dst = nullptr; + e_route = new RouteCreationArgs(); e_route->link_list.push_back(surf_network_model->loopback_); TO_ROUTE_FULL(i, i) = e_route; } @@ -53,12 +51,12 @@ FullZone::~FullZone() } } -void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t res, double* lat) +void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat) { XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); unsigned int table_size = getTableSize(); - sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(src->id(), dst->id()); + RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id()); if (e_route != nullptr) { res->gw_src = e_route->gw_src; @@ -80,7 +78,7 @@ void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoin unsigned int table_size = getTableSize(); if (not routingTable_) - routingTable_ = new sg_platf_route_cbarg_t[table_size * table_size](); + routingTable_ = new RouteCreationArgs*[table_size * table_size](); /* Check that the route does not already exist */ if (gw_dst) // inter-zone route (to adapt the error message, if any) diff --git a/src/kernel/routing/FullZone.hpp b/src/kernel/routing/FullZone.hpp index d40709dd15..d92e4445fa 100644 --- a/src/kernel/routing/FullZone.hpp +++ b/src/kernel/routing/FullZone.hpp @@ -24,12 +24,12 @@ public: void seal() override; ~FullZone() override; - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, std::vector& link_list, bool symmetrical) override; - sg_platf_route_cbarg_t* routingTable_ = nullptr; + RouteCreationArgs** routingTable_ = nullptr; }; } } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 309469509f..775bff479d 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -314,7 +314,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst, void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst, /* OUT */ std::vector& links, double* latency) { - s_sg_platf_route_cbarg_t route; + RouteCreationArgs route; XBT_DEBUG("Resolve route from '%s' to '%s'", src->getCname(), dst->getCname()); diff --git a/src/kernel/routing/NetZoneImpl.hpp b/src/kernel/routing/NetZoneImpl.hpp index 4a3e5ec262..83ec1f893e 100644 --- a/src/kernel/routing/NetZoneImpl.hpp +++ b/src/kernel/routing/NetZoneImpl.hpp @@ -74,7 +74,7 @@ protected: * @param into Container into which the traversed links and gateway informations should be pushed * @param latency Accumulator in which the latencies should be added (caller must set it to 0) */ - virtual void getLocalRoute(NetPoint * src, NetPoint * dst, sg_platf_route_cbarg_t into, double* latency) = 0; + virtual void getLocalRoute(NetPoint * src, NetPoint * dst, RouteCreationArgs * into, double* latency) = 0; /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */ /* returns whether we found a bypass path */ bool getBypassRoute(routing::NetPoint * src, routing::NetPoint * dst, diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index 6d41cbc786..5c573befd3 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -73,7 +73,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, std::map* if (my_src == my_dst) continue; - sg_platf_route_cbarg_t route = new s_sg_platf_route_cbarg_t; + RouteCreationArgs* route = new RouteCreationArgs(); getLocalRoute(my_src, my_dst, route, nullptr); @@ -120,12 +120,11 @@ void RoutedZone::getGraph(xbt_graph_t graph, std::map* /* ************************************************************************** */ /* ************************* GENERIC AUX FUNCTIONS ************************** */ /* change a route containing link names into a route containing link entities */ -sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, - NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical, - bool change_order) +RouteCreationArgs* RoutedZone::newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src, + NetPoint* gw_dst, std::vector& link_list, + bool symmetrical, bool change_order) { - sg_platf_route_cbarg_t result = new s_sg_platf_route_cbarg_t; + RouteCreationArgs* result = new RouteCreationArgs(); xbt_assert(hierarchy == RoutingMode::base || hierarchy == RoutingMode::recursive, "The hierarchy of this netzone is neither BASIC nor RECURSIVE, I'm lost here."); diff --git a/src/kernel/routing/RoutedZone.hpp b/src/kernel/routing/RoutedZone.hpp index c1117fc413..1a874b060b 100644 --- a/src/kernel/routing/RoutedZone.hpp +++ b/src/kernel/routing/RoutedZone.hpp @@ -54,9 +54,9 @@ public: void getGraph(xbt_graph_t graph, std::map* nodes, std::map* edges) override; - virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src, - NetPoint* gw_dst, std::vector& link_list, - bool symmetrical, bool change_order); + virtual RouteCreationArgs* newExtendedRoute(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src, + NetPoint* gw_dst, std::vector& link_list, + bool symmetrical, bool change_order); protected: void getRouteCheckParams(NetPoint* src, NetPoint* dst); diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index c9d1636772..03ba0a6a7f 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -91,7 +91,7 @@ void TorusZone::parse_specific_arguments(ClusterCreationArgs* cluster) } } -void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) +void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); diff --git a/src/kernel/routing/TorusZone.hpp b/src/kernel/routing/TorusZone.hpp index 0cdad3d158..ac04e68410 100644 --- a/src/kernel/routing/TorusZone.hpp +++ b/src/kernel/routing/TorusZone.hpp @@ -22,7 +22,7 @@ class XBT_PRIVATE TorusZone : public ClusterZone { public: explicit TorusZone(NetZone* father, std::string name); void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position) override; - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void parse_specific_arguments(ClusterCreationArgs* cluster) override; private: diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index 3d78b3a4ed..5a0cfd4878 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -75,7 +75,7 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s privateLinks_.insert({netpoint->id(), {linkUp, linkDown}}); } -void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat) +void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) { XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id()); diff --git a/src/kernel/routing/VivaldiZone.hpp b/src/kernel/routing/VivaldiZone.hpp index 64ea9bd5f2..794fe7a2e7 100644 --- a/src/kernel/routing/VivaldiZone.hpp +++ b/src/kernel/routing/VivaldiZone.hpp @@ -48,7 +48,7 @@ public: explicit VivaldiZone(NetZone* father, std::string name); void setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, std::string coord); - void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override; + void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; }; namespace vivaldi { diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index c01a8d8a38..f451fad71d 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -397,13 +397,13 @@ void sg_platf_new_mount(MountCreationArgs* mount) mount_list.insert({mount->name, simgrid::surf::StorageImpl::byName(mount->storageId.c_str())}); } -void sg_platf_new_route(sg_platf_route_cbarg_t route) +void sg_platf_new_route(RouteCreationArgs* route) { routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list, route->symmetrical); } -void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute) +void sg_platf_new_bypassRoute(RouteCreationArgs* bypassRoute) { routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst, bypassRoute->link_list, bypassRoute->symmetrical); diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 3a6f7b0f2b..48ed8498d3 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -83,7 +83,8 @@ public: tmgr_trace_t state_trace; }; -struct s_sg_platf_route_cbarg_t { +class RouteCreationArgs { +public: bool symmetrical = false; sg_netpoint_t src = nullptr; sg_netpoint_t dst = nullptr; @@ -91,7 +92,6 @@ struct s_sg_platf_route_cbarg_t { sg_netpoint_t gw_dst = nullptr; std::vector link_list; }; -typedef s_sg_platf_route_cbarg_t* sg_platf_route_cbarg_t; class ClusterCreationArgs { public: @@ -207,8 +207,8 @@ XBT_PUBLIC(void) sg_platf_new_cabinet(CabinetCreationArgs* cabinet); // Add a XBT_PUBLIC(simgrid::kernel::routing::NetPoint*) // Add a router to the current Zone sg_platf_new_router(std::string, const char* coords); -XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a route -XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_route_cbarg_t bypassroute); // Add a bypassRoute +XBT_PUBLIC(void) sg_platf_new_route(RouteCreationArgs* route); // Add a route +XBT_PUBLIC(void) sg_platf_new_bypassRoute(RouteCreationArgs* bypassroute); // Add a bypassRoute XBT_PUBLIC(void) sg_platf_new_trace(TraceCreationArgs* trace); diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 272755c325..fdb04ed447 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -692,7 +692,7 @@ void STag_surfxml_bypassZoneRoute(){ } void ETag_surfxml_route(){ - s_sg_platf_route_cbarg_t route; + RouteCreationArgs route; route.src = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag route.dst = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag @@ -716,7 +716,7 @@ void ETag_surfxml_ASroute() } void ETag_surfxml_zoneRoute() { - s_sg_platf_route_cbarg_t ASroute; + RouteCreationArgs ASroute; ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_src); // tested to not be nullptr in start tag ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_dst); // tested to not be nullptr in start tag @@ -742,7 +742,7 @@ void ETag_surfxml_zoneRoute() } void ETag_surfxml_bypassRoute(){ - s_sg_platf_route_cbarg_t route; + RouteCreationArgs route; route.src = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag route.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag @@ -765,7 +765,7 @@ void ETag_surfxml_bypassASroute() } void ETag_surfxml_bypassZoneRoute() { - s_sg_platf_route_cbarg_t ASroute; + RouteCreationArgs ASroute; ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src); ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst);