Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix dist
[simgrid.git] / src / kernel / routing / RoutedZone.hpp
1 /* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #ifndef SIMGRID_ROUTING_GENERIC_HPP_
7 #define SIMGRID_ROUTING_GENERIC_HPP_
8
9 #include "src/kernel/routing/NetZoneImpl.hpp"
10
11 namespace simgrid {
12 namespace kernel {
13 namespace routing {
14
15 /** @ingroup ROUTING_API
16  *  @brief NetZone with an explicit routing (abstract class)
17  *
18  * This abstract class factorizes code between its subclasses: Full, Dijkstra and Floyd.
19  *
20  * <table>
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>
27  * </tr>
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>
32  * </tr>
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>
37  * </tr>
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>
42  * </tr>
43  * <tr><td><b>Expressiveness</b></td>
44  * <td>Only shortest path</td>
45  * <td>Only shortest path</td>
46  * <td>Everything</td>
47  * </tr>
48  * </table>
49  */
50
51 class XBT_PRIVATE RoutedZone : public NetZoneImpl {
52 public:
53   explicit RoutedZone(NetZone* father, const char* name);
54
55   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
56   virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
57                                                   bool change_order);
58
59 protected:
60   void getRouteCheckParams(NetPoint* src, NetPoint* dst);
61   void addRouteCheckParams(sg_platf_route_cbarg_t route);
62 };
63 }
64 }
65 } // namespace
66
67 SG_BEGIN_DECL()
68 XBT_PRIVATE xbt_node_t new_xbt_graph_node(xbt_graph_t graph, const char* name, xbt_dict_t nodes);
69 XBT_PRIVATE xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt_dict_t edges);
70 SG_END_DECL()
71
72 #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */