Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix Network Constant
authorPaul Bédaride <paul.bedaride@gmail.com>
Fri, 18 Oct 2013 16:27:31 +0000 (18:27 +0200)
committerPaul Bédaride <paul.bedaride@gmail.com>
Fri, 18 Oct 2013 16:27:31 +0000 (18:27 +0200)
src/surf/network.cpp
src/surf/network.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/surf_interface.cpp
src/surf/surf_routing_cluster.cpp
src/surf/workstation_ptask_L07.hpp

index e9930f2..60e6b03 100644 (file)
@@ -374,7 +374,7 @@ xbt_dynar_t NetworkCm02Model::getRoute(RoutingEdgePtr src, RoutingEdgePtr dst)
   return route;
 }
 
-NetworkCm02ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
                                                 double size, double rate)
 {
   unsigned int i;
index 6b4ab46..f1b2338 100644 (file)
@@ -51,7 +51,7 @@ public:
                                    xbt_dict_t properties);
   void updateActionsStateLazy(double now, double delta);
   virtual void gapAppend(double size, const NetworkCm02LinkLmmPtr link, NetworkCm02ActionLmmPtr action) {};
-  NetworkCm02ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+  virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
                                           double size, double rate);
   xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst); //FIXME: kill field? That is done by the routing nowadays
   //FIXME: virtual void addTraces() =0;
index 4509a74..6b177d6 100644 (file)
@@ -20,12 +20,12 @@ void surf_network_model_init_Constant()
   if (!random_latency)
     random_latency = random_new(RAND, 100, 0.0, 1.0, .125, .034);
 
-  //FIXME:sg_platf_host_add_cb(netcste_count_hosts);
+  sg_platf_host_add_cb(netcste_count_hosts);
 
   ModelPtr model = static_cast<ModelPtr>(surf_network_model);
   xbt_dynar_push(model_list, &model);
 
-  //FIXME:routing_model_create(NULL);
+  routing_model_create(NULL);
 }
 
 double NetworkConstantModel::shareResources(double now)
@@ -35,7 +35,7 @@ double NetworkConstantModel::shareResources(double now)
   double min = -1.0;
 
   xbt_swag_foreach(_action, p_runningActionSet) {
-       action = (NetworkConstantActionLmmPtr) _action;
+       action = dynamic_cast<NetworkConstantActionLmmPtr>(static_cast<ActionPtr>(_action));
     if (action->m_latency > 0) {
       if (min < 0)
         min = action->m_latency;
@@ -53,7 +53,7 @@ void NetworkConstantModel::updateActionsState(double now, double delta)
   NetworkConstantActionLmmPtr action = NULL;
 
   xbt_swag_foreach_safe(_action, _next_action, p_runningActionSet) {
-       action = (NetworkConstantActionLmmPtr) _action;
+       action = dynamic_cast<NetworkConstantActionLmmPtr>(static_cast<ActionPtr>(_action));
     if (action->m_latency > 0) {
       if (action->m_latency > delta) {
         double_update(&(action->m_latency), delta);
@@ -77,7 +77,7 @@ void NetworkConstantModel::updateActionsState(double now, double delta)
   }
 }
 
-NetworkCm02ActionLmmPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+ActionPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
                                         double size, double rate)
 {
   char *src_name = src->p_name;
index ef9344b..c9c140d 100644 (file)
@@ -24,7 +24,7 @@ public:
   NetworkCm02LinkLmmPtr createResource(string name);
   double shareResources(double now);
   void updateActionsState(double now, double delta);
-  NetworkCm02ActionLmmPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+  ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
                                           double size, double rate);
   void gapRemove(ActionLmmPtr action);
   //FIXME:virtual void addTraces() =0;
@@ -49,7 +49,7 @@ public:
 class NetworkConstantActionLmm : public NetworkCm02ActionLmm {
 public:
   NetworkConstantActionLmm(NetworkConstantModelPtr model, double latency):
-         NetworkCm02ActionLmm(model, 0, false), m_latInit(latency) {
+         Action(model, 0, false), NetworkCm02ActionLmm(model, 0, false), m_latInit(latency) {
        m_latency = latency;
        if (m_latency <= 0.0) {
          p_stateSet = p_model->p_doneActionSet;
index de9093f..c45386e 100644 (file)
@@ -247,7 +247,7 @@ xbt_dynar_t surf_workstation_model_get_route(surf_workstation_model_t model,
 }
 
 surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate){
-  model->communicate(src, dst, size, rate);
+  return model->communicate(src, dst, size, rate);
 }
 
 const char *surf_resource_name(surf_cpp_resource_t resource){
index 12ecc7a..0e7a67a 100644 (file)
@@ -22,11 +22,6 @@ AS_t model_cluster_create(void)
 /* Creation routing model functions */
 AsCluster::AsCluster() : AsNone()
 {
-  /*result->get_route_and_latency = cluster_get_route_and_latency;
-  result->finalize = model_cluster_finalize;
-  result->get_graph = cluster_get_graph;
-  result->parse_AS = cluster_parse_AS;
-  result->parse_PU = cluster_parse_PU;*/
 }
 
 /* Business methods */
index cff5273..c195fdf 100644 (file)
@@ -88,10 +88,9 @@ public:
                                                   tmgr_trace_t state_trace,
                                                   e_surf_link_sharing_policy_t
                                                   policy, xbt_dict_t properties);
-  NetworkCm02ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
-                                          double size, double rate);
+
   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst) {DIE_IMPOSSIBLE;};
-  ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate) {DIE_IMPOSSIBLE;};
+  ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) {DIE_IMPOSSIBLE;};
   void addTraces() {DIE_IMPOSSIBLE;};
   WorkstationL07ModelPtr p_workstationModel;
 };