Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
reduce the public exposure of netcards_dict
[simgrid.git] / src / kernel / routing / VivaldiZone.cpp
index df98547..7549998 100644 (file)
@@ -5,7 +5,8 @@
 
 #include <boost/algorithm/string.hpp>
 
-#include <simgrid/s4u/host.hpp>
+#include "simgrid/s4u/engine.hpp"
+#include "simgrid/s4u/host.hpp"
 
 #include "src/kernel/routing/NetCard.hpp"
 #include "src/kernel/routing/VivaldiZone.hpp"
@@ -50,16 +51,16 @@ 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);
+             (nc->isNetZone() ? "AS" : (nc->isHost() ? "Host" : "Router")), nc->cname(), nc);
   return &coords->coords;
 }
-AsVivaldi::AsVivaldi(As* father, const char* name) : AsCluster(father, name)
+VivaldiZone::VivaldiZone(NetZone* father, const char* name) : ClusterZone(father, name)
 {
 }
 
-void AsVivaldi::setPeerLink(NetCard* netcard, double bw_in, double bw_out, double latency, const char* coord)
+void VivaldiZone::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");
+  xbt_assert(netcard->netzone() == this, "Cannot add a peer link to a netcard that is not in this AS");
 
   new simgrid::kernel::routing::vivaldi::Coords(netcard, coord);
 
@@ -73,15 +74,15 @@ void AsVivaldi::setPeerLink(NetCard* netcard, double bw_in, double bw_out, doubl
   free(link_down);
 }
 
-void AsVivaldi::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
+void VivaldiZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t route, double* lat)
 {
   XBT_DEBUG("vivaldi getLocalRoute from '%s'[%d] '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id());
 
-  if (src->isAS()) {
+  if (src->isNetZone()) {
     char* srcName = bprintf("router_%s", src->cname());
     char* dstName = bprintf("router_%s", dst->cname());
-    route->gw_src = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib, srcName, ROUTING_ASR_LEVEL);
-    route->gw_dst = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib, dstName, ROUTING_ASR_LEVEL);
+    route->gw_src = simgrid::s4u::Engine::instance()->netcardByNameOrNull(srcName);
+    route->gw_dst = simgrid::s4u::Engine::instance()->netcardByNameOrNull(dstName);
     xbt_free(srcName);
     xbt_free(dstName);
   }