unsigned int id_ = -1;
std::string name_;
NetPoint::Type component_type_;
- NetZoneImpl* englobing_zone_;
+ NetZoneImpl* englobing_zone_ = nullptr;
};
} // namespace routing
} // namespace kernel
s4u::Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth);
/** @brief Make a link within that NetZone */
virtual s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths);
+ /** @brief Make a router within that NetZone */
+ NetPoint* create_router(const std::string& name);
/** @brief Creates a new route in this NetZone */
virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
NetPoint* NetPoint::set_coordinates(const std::string& coords)
{
- new vivaldi::Coords(this, coords);
+ if (not coords.empty())
+ new vivaldi::Coords(this, coords);
return this;
}
} // namespace routing
return count;
}
-s4u::Disk* NetZoneImpl::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
+s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
{
- auto* l = disk_model_->create_disk(name, read_bandwidth, write_bandwidth);
+ auto* res = (new surf::HostImpl(name))->get_iface();
+ res->set_netpoint((new NetPoint(name, NetPoint::Type::Host))->set_englobing_zone(this));
- return l->get_iface();
+ cpu_model_pm_->create_cpu(res, speed_per_pstate);
+
+ return res;
}
s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<double>& bandwidths)
return network_model_->create_link(name, bandwidths)->get_iface();
}
-s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
+s4u::Disk* NetZoneImpl::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
{
- auto* res = (new surf::HostImpl(name))->get_iface();
- res->set_netpoint((new NetPoint(name, NetPoint::Type::Host))->set_englobing_zone(this));
-
- cpu_model_pm_->create_cpu(res, speed_per_pstate);
+ auto* l = disk_model_->create_disk(name, read_bandwidth, write_bandwidth);
- return res;
+ 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);
->set_core_count(args->core_amount)
->set_state_profile(args->state_trace)
->set_speed_profile(args->speed_trace);
- // host->get_impl()->set_disks(args->disks);
}
void sg_platf_new_host_set_properties(const std::unordered_map<std::string, std::string>& props)
/** @brief Add a "router" to the network element list */
simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, const std::string& coords)
{
- xbt_assert(nullptr == simgrid::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());
-
- auto* netpoint = new simgrid::kernel::routing::NetPoint(name, simgrid::kernel::routing::NetPoint::Type::Router);
- netpoint->set_englobing_zone(current_routing);
+ auto* netpoint = current_routing->create_router(name)->set_coordinates(coords);
XBT_DEBUG("Router '%s' has the id %u", netpoint->get_cname(), netpoint->id());
- if (not coords.empty())
- netpoint->set_coordinates(coords);
-
return netpoint;
}
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
if (cluster->router_id.empty())
cluster->router_id = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix;
- current_zone->set_router(sg_platf_new_router(cluster->router_id, ""));
+ current_zone->set_router(current_zone->create_router(cluster->router_id));
// Make the backbone
if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) {