Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move some C++ helpers in xbt/
[simgrid.git] / src / surf / AsClusterTorus.cpp
index 346361f..af5abc7 100644 (file)
@@ -34,12 +34,11 @@ namespace simgrid {
     }
 
     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 = SG_PLATF_LINK_INITIALIZER;
       char *link_id;
       unsigned int j = 0;
-      /**
+      /*
        * Create all links that exist in the torus.
-       * Each rank creates #dimensions-1 links
+       * Each rank creates @a dimensions-1 links
        */
       int neighbour_rank_id = 0;        // The other node the link connects
       int current_dimension = 0,        // which dimension are we currently in?
@@ -48,6 +47,7 @@ namespace simgrid {
           dim_product = 1;      // Needed to calculate the next neighbour_id
       for (j = 0; j < xbt_dynar_length(dimensions_); j++) {
 
+        s_sg_platf_link_cbarg_t link;
         memset(&link, 0, sizeof(link));
         current_dimension = xbt_dynar_get_as(dimensions_, j, int);
         neighbour_rank_id =
@@ -72,12 +72,12 @@ namespace simgrid {
           info.link_up = Link::byName(link_id);
           info.link_down = info.link_up;
         }
-        /**
+        /*
          * Add the link to its appropriate position;
          * note that position rankId*(xbt_dynar_length(dimensions)+has_loopack?+has_limiter?)
          * holds the link "rankId->rankId"
          */
-        xbt_dynar_set(upDownLinks, position + j, &info);
+        xbt_dynar_set(privateLinks_, position + j, &info);
         dim_product *= current_dimension;
         xbt_free(link_id);
       }
@@ -92,8 +92,7 @@ namespace simgrid {
 
       if (!xbt_dynar_is_empty(dimensions)) {
         dimensions_ = xbt_dynar_new(sizeof(int), NULL);
-        /**
-         * We are in a torus cluster
+        /* We are in a torus cluster
          * Parse attribute dimensions="dim1,dim2,dim3,...,dimN"
          * and safe it in a dynarray.
          * Additionally, we need to know how many ranks we have in total
@@ -118,7 +117,7 @@ namespace simgrid {
         return;
 
       if ((src->id() == dst->id()) && has_loopback_) {
-        s_surf_parsing_link_up_down_t info = xbt_dynar_get_as(upDownLinks, src->id() * nb_links_per_node_, s_surf_parsing_link_up_down_t);
+        s_surf_parsing_link_up_down_t info = xbt_dynar_get_as(privateLinks_, src->id() * nb_links_per_node_, s_surf_parsing_link_up_down_t);
 
         route->link_list->push_back(info.link_up);
         if (lat)
@@ -127,14 +126,14 @@ namespace simgrid {
       }
 
 
-      /**
+      /*
        * Dimension based routing routes through each dimension consecutively
        * TODO Change to dynamic assignment
        */
       unsigned int j, cur_dim, dim_product = 1;
       int current_node = src->id();
       int unsigned next_node = 0;
-      /**
+      /*
        * Arrays that hold the coordinates of the current node and
        * the target; comparing the values at the i-th position of
        * both arrays, we can easily assess whether we need to route
@@ -143,7 +142,7 @@ namespace simgrid {
       unsigned int *myCoords, *targetCoords;
       myCoords = rankId_to_coords(src->id(), dimensions_);
       targetCoords = rankId_to_coords(dst->id(), dimensions_);
-      /**
+      /*
        * linkOffset describes the offset where the link
        * we want to use is stored
        * (+1 is added because each node has a link from itself to itself,
@@ -200,11 +199,11 @@ namespace simgrid {
         s_surf_parsing_link_up_down_t info;
 
         if (has_limiter_) {    // limiter for sender
-          info = xbt_dynar_get_as(upDownLinks, nodeOffset + has_loopback_, s_surf_parsing_link_up_down_t);
+          info = xbt_dynar_get_as(privateLinks_, nodeOffset + has_loopback_, s_surf_parsing_link_up_down_t);
           route->link_list->push_back(info.link_up);
         }
 
-        info = xbt_dynar_get_as(upDownLinks, linkOffset, s_surf_parsing_link_up_down_t);
+        info = xbt_dynar_get_as(privateLinks_, linkOffset, s_surf_parsing_link_up_down_t);
 
         if (use_lnk_up == false) {
           route->link_list->push_back(info.link_down);