Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Single way to create links in NetZone
[simgrid.git] / src / kernel / routing / NetZoneImpl.cpp
index 9ce2ab4..4df1cef 100644 (file)
@@ -109,6 +109,8 @@ NetZoneImpl::~NetZoneImpl()
 void NetZoneImpl::add_child(NetZoneImpl* new_zone)
 {
   xbt_assert(not sealed_, "Cannot add a new child to the sealed zone %s", get_cname());
+  /* set the father behavior */
+  hierarchy_ = RoutingMode::recursive;
   children_.push_back(new_zone);
 }
 
@@ -150,16 +152,8 @@ s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<d
   return network_model_->create_link(name, bandwidths)->get_iface();
 }
 
-s4u::Link* NetZoneImpl::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
-{
-  return network_model_->create_wifi_link(name, bandwidths)->get_iface();
-}
-
 s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
 {
-  if (hierarchy_ == RoutingMode::unset)
-    hierarchy_ = RoutingMode::base;
-
   auto* res = (new surf::HostImpl(name))->get_iface();
   res->set_netpoint((new NetPoint(name, NetPoint::Type::Host))->set_englobing_zone(this));
 
@@ -487,8 +481,10 @@ void NetZoneImpl::set_parent(NetZoneImpl* parent)
   xbt_assert(not sealed_, "Impossible to set parent to an already sealed NetZone(%s)", this->get_cname());
   parent_ = parent;
   netpoint_->set_englobing_zone(parent_);
-  /* copying models from parent host, to be reviewed when we allow multi-models */
   if (parent) {
+    /* adding this class as child */
+    parent->add_child(this);
+    /* copying models from parent host, to be reviewed when we allow multi-models */
     set_network_model(parent->get_network_model());
     set_cpu_pm_model(parent->get_cpu_pm_model());
     set_cpu_vm_model(parent->get_cpu_vm_model());