Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
46f12088c29e8ed0291b0f029e12712885dceaec
[simgrid.git] / include / simgrid / kernel / routing / FloydZone.hpp
1 /* Copyright (c) 2013-2021. 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 SURF_ROUTING_FLOYD_HPP_
7 #define SURF_ROUTING_FLOYD_HPP_
8
9 #include <simgrid/kernel/routing/RoutedZone.hpp>
10
11 namespace simgrid {
12 namespace kernel {
13 namespace routing {
14
15 /** @ingroup ROUTING_API
16  *  @brief NetZone with an explicit routing computed at initialization with Floyd-Warshal
17  *
18  *  The path between components is computed at creation time from every one-hop links,
19  *  using the Floyd-Warshal algorithm.
20  *
21  *  This result in rather small platform file, slow initialization time,  and intermediate memory requirements
22  *  (somewhere between the one of @{DijkstraZone} and the one of @{FullZone}).
23  */
24 class XBT_PRIVATE FloydZone : public RoutedZone {
25   /* vars to compute the Floyd algorithm. */
26   std::vector<std::vector<unsigned long>> predecessor_table_;
27   std::vector<std::vector<unsigned long>> cost_table_;
28   std::vector<std::vector<std::unique_ptr<Route>>> link_table_;
29
30   void init_tables(unsigned int table_size);
31   void do_seal() override;
32
33 public:
34   using RoutedZone::RoutedZone;
35   FloydZone(const FloydZone&) = delete;
36   FloydZone& operator=(const FloydZone&) = delete;
37
38   void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
39   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
40                  const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) override;
41 };
42 } // namespace routing
43 } // namespace kernel
44 } // namespace simgrid
45
46 #endif /* SURF_ROUTING_FLOYD_HPP_ */