]> AND Public Git Repository - simgrid.git/blobdiff - src/surf/ptask_L07.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify constant model a bit
[simgrid.git] / src / surf / ptask_L07.hpp
index a38cb2d02cde1fdffb478101184b7f743245eefb..cc4e370fb53b413c70c8dd1655350bd13cbed9ec 100644 (file)
@@ -3,10 +3,10 @@
 /* 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. */
 
+#include "src/surf/HostImpl.hpp"
 #include <cstdlib>
 #include <vector>
 #include <xbt/base.h>
-#include "src/surf/HostImpl.hpp"
 
 #ifndef HOST_L07_HPP_
 #define HOST_L07_HPP_
@@ -35,10 +35,9 @@ class XBT_PRIVATE L07Action;
  *********/
 class HostL07Model : public HostModel {
 public:
-  HostL07Model();
+  explicit HostL07Model(const std::string& name);
   HostL07Model(const HostL07Model&) = delete;
   HostL07Model& operator=(const HostL07Model&) = delete;
-  ~HostL07Model() override;
 
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
@@ -48,18 +47,23 @@ public:
 
 class CpuL07Model : public kernel::resource::CpuModel {
 public:
-  CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
+  CpuL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys);
   CpuL07Model(const CpuL07Model&) = delete;
   CpuL07Model& operator=(const CpuL07Model&) = delete;
   ~CpuL07Model() override;
+  void update_actions_state(double /*now*/, double /*delta*/) override{
+      /* this action is done by HostL07Model which shares the LMM system with the CPU model
+       * Overriding to an empty function here allows us to handle the Cpu07Model as a regular
+       * method in surf_presolve */
+  };
 
   kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
-  HostL07Model *hostModel_;
+  HostL07ModelhostModel_;
 };
 
 class NetworkL07Model : public kernel::resource::NetworkModel {
 public:
-  NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
+  NetworkL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys);
   NetworkL07Model(const NetworkL07Model&) = delete;
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
   ~NetworkL07Model() override;
@@ -67,8 +71,13 @@ public:
                                           s4u::Link::SharingPolicy policy) override;
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+  void update_actions_state(double /*now*/, double /*delta*/) override{
+      /* this action is done by HostL07Model which shares the LMM system with the CPU model
+       * Overriding to an empty function here allows us to handle the Cpu07Model as a regular
+       * method in surf_presolve */
+  };
 
-  HostL07Model *hostModel_;
+  HostL07ModelhostModel_;
 };
 
 /************
@@ -77,7 +86,7 @@ public:
 
 class CpuL07 : public kernel::resource::Cpu {
 public:
-  CpuL07(s4u::Host* host, const std::vector<double>& speed_per_pstate) : Cpu(host, speed_per_pstate){};
+  using kernel::resource::Cpu::Cpu;
   CpuL07(const CpuL07&) = delete;
   CpuL07& operator=(const CpuL07&) = delete;