Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update python/clusters-multicpu to the new API.
[simgrid.git] / include / simgrid / kernel / routing / FloydZone.hpp
index 7046ec9b89f0a15b90d26f4e64a8e2d138dc8289..6cfaa76075fdc2a5147b2704f516cfa294a28f3b 100644 (file)
@@ -1,16 +1,14 @@
-/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef SURF_ROUTING_FLOYD_HPP_
-#define SURF_ROUTING_FLOYD_HPP_
+#ifndef SIMGRID_ROUTING_FLOYD_HPP_
+#define SIMGRID_ROUTING_FLOYD_HPP_
 
 #include <simgrid/kernel/routing/RoutedZone.hpp>
 
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing computed at initialization with Floyd-Warshal
@@ -22,24 +20,23 @@ namespace routing {
  *  (somewhere between the one of @{DijkstraZone} and the one of @{FullZone}).
  */
 class XBT_PRIVATE FloydZone : public RoutedZone {
-public:
-  explicit FloydZone(NetZone* father, std::string name);
-  ~FloydZone() override;
+  /* vars to compute the Floyd algorithm. */
+  std::vector<std::vector<long>> predecessor_table_;
+  std::vector<std::vector<unsigned long>> cost_table_;
+  std::vector<std::vector<std::unique_ptr<Route>>> link_table_;
 
-  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<simgrid::surf::LinkImpl*>& link_list,
-                bool symmetrical) override;
-  void seal() override;
+  void init_tables(unsigned int table_size);
+  void do_seal() override;
 
-private:
-  /* vars to compute the Floyd algorithm. */
-  int* predecessor_table_;
-  double* cost_table_;
-  RouteCreationArgs** link_table_;
+public:
+  using RoutedZone::RoutedZone;
+  FloydZone(const FloydZone&) = delete;
+  FloydZone& operator=(const FloydZone&) = delete;
+
+  void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
+  void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+                 const std::vector<s4u::LinkInRoute>& link_list, bool symmetrical) override;
 };
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing
 
-#endif /* SURF_ROUTING_FLOYD_HPP_ */
+#endif /* SIMGRID_ROUTING_FLOYD_HPP_ */