1 /* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SIMGRID_ROUTING_GENERIC_HPP_
7 #define SIMGRID_ROUTING_GENERIC_HPP_
9 #include <simgrid/kernel/routing/NetZoneImpl.hpp>
15 /** @ingroup ROUTING_API
16 * @brief NetZone with an explicit routing (abstract class)
18 * This abstract class factorizes code between its subclasses: Full, Dijkstra and Floyd.
21 * <caption>Comparison of the RoutedZone subclasses</caption>
22 * <tr><td></td><td>DijkstraZone</td><td>FloydZone</td><td>FullZone</td></tr>
23 * <tr><td><b>Platform-file content</b></td>
24 * <td>Only 1-hop routes (rather small)</td>
25 * <td>Only 1-hop routes (rather small)</td>
26 * <td>Every path, explicitly (very large)</td>
28 * <tr><td><b>Initialization time</b></td>
29 * <td>Almost nothing</td>
30 * <td>Floyd-Warshall algorithm: O(n^3)</td>
31 * <td>Almost nothing</td>
33 * <tr><td><b>Memory usage</b></td>
34 * <td>1-hop routes (+ cache of routes)</td>
35 * <td>O(n^2) data (intermediate)</td>
36 * <td>O(n^2) + sum of path lengths (very large)</td>
38 * <tr><td><b>Lookup time</b></td>
39 * <td>Dijkstra Algo: O(n^3)</td>
40 * <td>not much (reconstruction phase)</td>
41 * <td>Almost nothing</td>
43 * <tr><td><b>Expressiveness</b></td>
44 * <td>Only shortest path</td>
45 * <td>Only shortest path</td>
51 class XBT_PRIVATE RoutedZone : public NetZoneImpl {
53 explicit RoutedZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
55 void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
56 std::map<std::string, xbt_edge_t>* edges) override;
59 virtual RouteCreationArgs* new_extended_route(RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src,
60 NetPoint* gw_dst, std::vector<resource::LinkImpl*>& link_list,
61 bool symmetrical, bool change_order);
62 void get_route_check_params(NetPoint* src, NetPoint* dst);
63 void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
64 std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
67 XBT_ATTRIB_DEPRECATED_v323("Please use RoutedZone::new_extended_route()") virtual RouteCreationArgs* newExtendedRoute(
68 RoutingMode hierarchy, NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
69 std::vector<resource::LinkImpl*>& link_list, bool symmetrical, bool change_order)
71 return new_extended_route(hierarchy, src, dst, gw_src, gw_dst, link_list, symmetrical, change_order);
73 XBT_ATTRIB_DEPRECATED_v323("Please use RoutedZone::get_route_check_params()") void getRouteCheckParams(NetPoint* src,
76 get_route_check_params(src, dst);
78 XBT_ATTRIB_DEPRECATED_v323("Please use RoutedZone::add_route_check_params()") void addRouteCheckParams(
79 NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, std::vector<resource::LinkImpl*>& link_list,
82 add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
85 } // namespace routing
87 } // namespace simgrid
89 XBT_PRIVATE xbt_node_t new_xbt_graph_node(xbt_graph_t graph, const char* name,
90 std::map<std::string, xbt_node_t>* nodes);
91 XBT_PRIVATE xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d,
92 std::map<std::string, xbt_edge_t>* edges);
94 #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */