/** @brief Add a host to the current NetZone */
void sg_platf_new_host(const simgrid::kernel::routing::HostCreationArgs* args)
{
- simgrid::s4u::Host* host = routing_get_current()->create_host(args->id, args->speed_per_pstate);
-
- if (not args->coord.empty())
- new simgrid::kernel::routing::vivaldi::Coords(host->get_netpoint(), args->coord);
+ simgrid::s4u::Host* host =
+ routing_get_current()->create_host(args->id, args->speed_per_pstate)->set_coordinates(args->coord);
if (args->properties) {
host->set_properties(*args->properties);
}
/** @brief Add a "router" to the network element list */
-simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, const char* coords)
+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());
netpoint->set_englobing_zone(current_routing);
XBT_DEBUG("Router '%s' has the id %u", netpoint->get_cname(), netpoint->id());
- if (coords && strcmp(coords, ""))
- new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords);
+ 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, nullptr));
+ current_zone->set_router(sg_platf_new_router(cluster->router_id, ""));
// Make the backbone
if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) {
void sg_platf_new_cabinet(const simgrid::kernel::routing::CabinetCreationArgs* cabinet)
{
+ auto* zone = static_cast<simgrid::kernel::routing::ClusterZone*>(routing_get_current());
for (int const& radical : *cabinet->radicals) {
- std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
- simgrid::kernel::routing::HostCreationArgs host;
- host.pstate = 0;
- host.core_amount = 1;
- host.id = hostname;
- host.speed_per_pstate.push_back(cabinet->speed);
- sg_platf_new_host(&host);
-
- simgrid::kernel::routing::LinkCreationArgs link;
- link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
- link.latency = cabinet->lat;
- link.bandwidths.push_back(cabinet->bw);
- link.id = "link_" + hostname;
- sg_platf_new_link(&link);
-
- simgrid::kernel::routing::HostLinkCreationArgs host_link;
- host_link.id = hostname;
- host_link.link_up = std::string("link_") + hostname + "_UP";
- host_link.link_down = std::string("link_") + hostname + "_DOWN";
- sg_platf_new_hostlink(&host_link);
+ std::string id = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
+ simgrid::s4u::Host* host = zone->create_host(id, std::vector<double>{cabinet->speed})->seal();
+
+ simgrid::s4u::Link* link_up =
+ zone->create_link("link_" + id + "_UP", std::vector<double>{cabinet->bw})->set_latency(cabinet->lat)->seal();
+ simgrid::s4u::Link* link_down =
+ zone->create_link("link_" + id + "_DOWN", std::vector<double>{cabinet->bw})->set_latency(cabinet->lat)->seal();
+
+ zone->add_private_link_at(host->get_netpoint()->id(), {link_up->get_impl(), link_down->get_impl()});
}
delete cabinet->radicals;
}
simgrid::s4u::Host* host = zone->create_host(peer->id, std::vector<double>{peer->speed})
->set_state_profile(peer->state_trace)
- ->set_speed_profile(peer->speed_trace);
+ ->set_speed_profile(peer->speed_trace)
+ ->set_coordinates(peer->coord)
+ ->seal();
- zone->set_peer_link(host->get_netpoint(), peer->bw_in, peer->bw_out, peer->coord);
-
- host->seal();
+ zone->set_peer_link(host->get_netpoint(), peer->bw_in, peer->bw_out);
}
-
/**
* @brief Auxiliary function to build the object NetZoneImpl
*