Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simplify the code taking Cpu::m_speedPeak changes into account
[simgrid.git] / src / surf / surf_routing_cluster_torus.cpp
index a1e2d97..645a313 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014. The SimGrid Team.
+/* Copyright (c) 2014-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -25,9 +25,12 @@ inline unsigned int* rankId_to_coords(int rankId, xbt_dynar_t dimensions) {
 
 AS_t model_torus_cluster_create(void)
 {
-  return new AsClusterTorus();
+  return new simgrid::surf::AsClusterTorus();
 }
 
+namespace simgrid {
+namespace surf {
+
 /* Creation routing model functions */
 AsClusterTorus::AsClusterTorus() : AsCluster()
 {
@@ -42,7 +45,7 @@ AsClusterTorus::~AsClusterTorus()
 
 
 void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position){
-  s_sg_platf_link_cbarg_t link;
+  s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER;
   char* link_id;
   unsigned int j = 0;
   /**
@@ -70,15 +73,13 @@ void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int
       s_surf_parsing_link_up_down_t info;
       if (link.policy == SURF_LINK_FULLDUPLEX) {
           char *tmp_link = bprintf("%s_UP", link_id);
-          info.link_up =
-              xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+          info.link_up = Link::byName(tmp_link);
           free(tmp_link);
           tmp_link = bprintf("%s_DOWN", link_id);
-          info.link_down =
-              xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+          info.link_down = Link::byName(tmp_link);
           free(tmp_link);
       } else {
-          info.link_up = xbt_lib_get_or_null(link_lib, link_id, SURF_LINK_LEVEL);
+          info.link_up = Link::byName(link_id);
           info.link_down = info.link_up;
       }
       /**
@@ -120,7 +121,7 @@ void AsClusterTorus::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster){
     xbt_dynar_free(&dimensions);
 }
 
-void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat){
+void AsClusterTorus::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat){
 
   XBT_VERB("torus_get_route_and_latency from '%s'[%d] to '%s'[%d]",
                src->getName(), src->getId(),
@@ -239,3 +240,6 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
 
   return;
 }
+
+}
+}