+s4u::SplitDuplexLink* NetZoneImpl::create_split_duplex_link(const std::string& name,
+ const std::vector<double>& bandwidths)
+{
+ auto* link_up = network_model_->create_link(name + "_UP", bandwidths);
+ auto* link_down = network_model_->create_link(name + "_DOWN", bandwidths);
+ auto link = std::make_unique<resource::SplitDuplexLinkImpl>(name, link_up, link_down);
+ auto* link_iface = link->get_iface();
+ EngineImpl::get_instance()->add_split_duplex_link(name, std::move(link));
+ return link_iface;
+}
+
+s4u::Disk* NetZoneImpl::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
+{
+ xbt_assert(disk_model_,
+ "Impossible to create disk: %s. Invalid disk model: nullptr. Have you set the parent of this NetZone: %s?",
+ name.c_str(), get_cname());
+ auto* l = disk_model_->create_disk(name, read_bandwidth, write_bandwidth);
+
+ return l->get_iface();
+}
+
+NetPoint* NetZoneImpl::create_router(const std::string& name)
+{
+ xbt_assert(nullptr == s4u::Engine::get_instance()->netpoint_by_name_or_null(name),
+ "Refusing to create a router named '%s': this name already describes a node.", name.c_str());
+
+ return (new NetPoint(name, NetPoint::Type::Router))->set_englobing_zone(this);
+}
+int NetZoneImpl::add_component(NetPoint* elm)
+{
+ vertices_.push_back(elm);
+ return vertices_.size() - 1; // The rank of the newly created object
+}
+
+std::vector<resource::LinkImpl*> NetZoneImpl::get_link_list_impl(const std::vector<s4u::LinkInRoute>& link_list,
+ bool backroute) const
+{
+ std::vector<resource::LinkImpl*> links;
+
+ for (const auto& link : link_list) {
+ if (link.get_link()->get_sharing_policy() != s4u::Link::SharingPolicy::SPLITDUPLEX) {
+ links.push_back(link.get_link()->get_impl());
+ continue;
+ }
+ // split-duplex links
+ const auto* sd_link = dynamic_cast<const s4u::SplitDuplexLink*>(link.get_link());
+ xbt_assert(sd_link,
+ "Add_route: cast to SpliDuplexLink impossible. This should not happen, please contact SimGrid team");
+ resource::LinkImpl* link_impl;
+ switch (link.get_direction()) {
+ case s4u::LinkInRoute::Direction::UP:
+ if (backroute)
+ link_impl = sd_link->get_link_down()->get_impl();
+ else
+ link_impl = sd_link->get_link_up()->get_impl();
+ break;
+ case s4u::LinkInRoute::Direction::DOWN:
+ if (backroute)
+ link_impl = sd_link->get_link_up()->get_impl();
+ else
+ link_impl = sd_link->get_link_down()->get_impl();
+ break;
+ default:
+ throw std::invalid_argument("Invalid add_route. Split-Duplex link without a direction: " +
+ link.get_link()->get_name());
+ }
+ links.push_back(link_impl);
+ }
+ return links;
+}
+
+void NetZoneImpl::add_route(NetPoint* /*src*/, NetPoint* /*dst*/, NetPoint* /*gw_src*/, NetPoint* /*gw_dst*/,
+ const std::vector<s4u::LinkInRoute>& /*link_list_*/, bool /*symmetrical*/)
+{
+ xbt_die("NetZone '%s' does not accept new routes (wrong class).", get_cname());