1 /* Copyright (c) 2013-2021. 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 SURF_ROUTING_FLOYD_HPP_
7 #define SURF_ROUTING_FLOYD_HPP_
9 #include <simgrid/kernel/routing/RoutedZone.hpp>
15 /** @ingroup ROUTING_API
16 * @brief NetZone with an explicit routing computed at initialization with Floyd-Warshal
18 * The path between components is computed at creation time from every one-hop links,
19 * using the Floyd-Warshal algorithm.
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}).
24 class XBT_PRIVATE FloydZone : public RoutedZone {
26 explicit FloydZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
27 FloydZone(const FloydZone&) = delete;
28 FloydZone& operator=(const FloydZone&) = delete;
29 ~FloydZone() override;
31 void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
32 void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
33 std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
37 /* vars to compute the Floyd algorithm. */
38 std::vector<int> predecessor_table_;
39 std::vector<double> cost_table_;
40 std::vector<RouteCreationArgs*> link_table_;
42 void init_tables(unsigned int table_size);
44 } // namespace routing
46 } // namespace simgrid
48 #endif /* SURF_ROUTING_FLOYD_HPP_ */