- static xbt_dynar_t getCoordsFromNetcard(NetCard *nc)
- {
- xbt_dynar_t res = nullptr;
- char *tmp_name;
-
- if (nc->isHost()) {
- tmp_name = bprintf("peer_%s", nc->name().c_str());
- simgrid::s4u::Host *host = simgrid::s4u::Host::by_name_or_null(tmp_name);
- if (host == nullptr)
- host = simgrid::s4u::Host::by_name_or_null(nc->name());
- if (host != nullptr)
- res = host->extension<simgrid::kernel::routing::vivaldi::Coords>()->coords;
- }
- else if(nc->isRouter() || nc->isAS()){
- tmp_name = bprintf("router_%s", nc->name().c_str());
- res = (xbt_dynar_t) xbt_lib_get_or_null(as_router_lib, tmp_name, COORD_ASR_LEVEL);
- }
- else{
- THROW_IMPOSSIBLE;
- }
+static std::vector<double>* getCoordsFromNetcard(NetCard* nc)
+{
+ simgrid::kernel::routing::vivaldi::Coords* coords = nc->extension<simgrid::kernel::routing::vivaldi::Coords>();
+ xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
+ (nc->isAS() ? "AS" : (nc->isHost() ? "Host" : "Router")), nc->cname(), nc);
+ return &coords->coords;
+}
+AsVivaldi::AsVivaldi(As* father, const char* name) : AsCluster(father, name)
+{
+}
+
+void AsVivaldi::setPeerLink(NetCard* netcard, double bw_in, double bw_out, double latency, const char* coord)
+{
+ xbt_assert(netcard->containingAS() == this, "Cannot add a peer link to a netcard that is not in this AS");