Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
[simgrid.git] / src / surf / network_cm02.cpp
index 88b131c..72a7965 100644 (file)
@@ -170,8 +170,8 @@ NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self))
 
 NetworkCm02Model::~NetworkCm02Model() {}
 
-Link* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
-                                   e_surf_link_sharing_policy_t policy)
+LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
+                                       e_surf_link_sharing_policy_t policy)
 {
   return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
 }
@@ -216,7 +216,6 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
       action->gapRemove();
     }
   }
-  return;
 }
 
 
@@ -290,24 +289,24 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   int failed = 0;
   double bandwidth_bound;
   double latency = 0.0;
-  std::vector<Link*> * back_route = nullptr;
+  std::vector<LinkImpl*>* back_route = nullptr;
   int constraints_per_variable = 0;
 
-  std::vector<Link*> *route = new std::vector<Link*>();
+  std::vector<LinkImpl*>* route = new std::vector<LinkImpl*>();
 
-  XBT_IN("(%s,%s,%g,%g)", src->name().c_str(), dst->name().c_str(), size, rate);
+  XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate);
 
   src->routeTo(dst, route, &latency);
   xbt_assert(!route->empty() || latency,
              "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
-             src->name().c_str(), dst->name().c_str());
+             src->cname(), dst->cname());
 
   for (auto link: *route)
     if (link->isOff())
       failed = 1;
 
   if (sg_network_crosstraffic == 1) {
-    back_route = new std::vector<Link*>();
+    back_route = new std::vector<LinkImpl*>();
     dst->routeTo(src, back_route, nullptr);
     for (auto link: *back_route)
       if (link->isOff())
@@ -341,7 +340,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
                "Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!");
 
     gapAppend(size, route->at(0), action);
-    XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->name().c_str(), dst->name().c_str(), action->senderGap_,
+    XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->cname(), dst->cname(), action->senderGap_,
               action->latency_);
   }
 
@@ -368,7 +367,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   for (auto link: *route)
     lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), 1.0);
 
-  if (sg_network_crosstraffic == 1) {
+  if (back_route != nullptr) { //  sg_network_crosstraffic was activated
     XBT_DEBUG("Fullduplex active adding backward flow using 5%%");
     for (auto link : *back_route)
       lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), .05);
@@ -382,13 +381,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   delete back_route;
   XBT_OUT();
 
-  Link::onCommunicate(action, src, dst);
+  LinkImpl::onCommunicate(action, src, dst);
   return action;
 }
 
-void NetworkCm02Model::gapAppend(double size, const Link* link, NetworkAction* action)
-{
-  // Nothing
+void NetworkCm02Model::gapAppend(double size, const LinkImpl* link, NetworkAction* action){
+    // Nothing
 };
 
 /************
@@ -396,7 +394,7 @@ void NetworkCm02Model::gapAppend(double size, const Link* link, NetworkAction* a
  ************/
 NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
                                  e_surf_link_sharing_policy_t policy, lmm_system_t system)
-    : Link(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
+    : LinkImpl(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
 {
   bandwidth_.scale = 1.0;
   bandwidth_.peak  = bandwidth;
@@ -407,7 +405,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, doub
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(getConstraint());
 
-  Link::onCreation(this);
+  LinkImpl::onCreation(this);
 }
 
 
@@ -551,10 +549,8 @@ void NetworkCm02Action::updateRemainingLazy(double now)
   lastValue_ = lmm_variable_getvalue(getVariable());
 }
 
-void NetworkCm02Link::gapAppend(double size, const Link* link, NetworkAction* action)
-{
-  // Nothing
+void NetworkCm02Link::gapAppend(double size, const LinkImpl* link, NetworkAction* action){
+    // Nothing
 };
-
 }
 }