Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups in the API and fields of NetCard
[simgrid.git] / src / surf / surf_routing_cluster_torus.cpp
index 1288cf8..8efc676 100644 (file)
@@ -27,7 +27,8 @@ inline unsigned int *rankId_to_coords(int rankId, xbt_dynar_t dimensions)
 
 namespace simgrid {
   namespace surf {
-    AsClusterTorus::AsClusterTorus():AsCluster() {
+    AsClusterTorus::AsClusterTorus(const char*name)
+      : AsCluster(name) {
     }
     AsClusterTorus::~AsClusterTorus() {
       xbt_dynar_free(&p_dimensions);
@@ -78,7 +79,7 @@ namespace simgrid {
          * note that position rankId*(xbt_dynar_length(dimensions)+has_loopack?+has_limiter?)
          * holds the link "rankId->rankId"
          */
-        xbt_dynar_set(p_linkUpDownList, position + j, &info);
+        xbt_dynar_set(upDownLinks, position + j, &info);
         dim_product *= current_dimension;
         xbt_free(link_id);
       }
@@ -113,14 +114,14 @@ namespace simgrid {
     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(), dst->getName(), dst->getId());
+          src->name(), src->id(), dst->name(), dst->id());
 
       if (dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER)
         return;
 
-      if ((src->getId() == dst->getId()) && p_has_loopback) {
+      if ((src->id() == dst->id()) && p_has_loopback) {
         s_surf_parsing_link_up_down_t info =
-            xbt_dynar_get_as(p_linkUpDownList, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
+            xbt_dynar_get_as(upDownLinks, src->id() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
         xbt_dynar_push_as(route->link_list, void *, info.link_up);
 
         if (lat)
@@ -134,7 +135,7 @@ namespace simgrid {
        * TODO Change to dynamic assignment
        */
       unsigned int j, cur_dim, dim_product = 1;
-      int current_node = src->getId();
+      int current_node = src->id();
       int unsigned next_node = 0;
       /**
        * Arrays that hold the coordinates of the current node and
@@ -143,8 +144,8 @@ namespace simgrid {
        * into this dimension or not.
        */
       unsigned int *myCoords, *targetCoords;
-      myCoords = rankId_to_coords(src->getId(), p_dimensions);
-      targetCoords = rankId_to_coords(dst->getId(), p_dimensions);
+      myCoords = rankId_to_coords(src->id(), p_dimensions);
+      targetCoords = rankId_to_coords(dst->id(), p_dimensions);
       /**
        * linkOffset describes the offset where the link
        * we want to use is stored
@@ -152,18 +153,18 @@ namespace simgrid {
        * which can only be the case if src->m_id == dst->m_id -- see above
        * for this special case)
        */
-      int nodeOffset = (xbt_dynar_length(p_dimensions) + 1) * src->getId();
+      int nodeOffset = (xbt_dynar_length(p_dimensions) + 1) * src->id();
 
       int linkOffset = nodeOffset;
       bool use_lnk_up = false;  // Is this link of the form "cur -> next" or "next -> cur"?
       // false means: next -> cur
-      while (current_node != dst->getId()) {
+      while (current_node != dst->id()) {
         dim_product = 1;        // First, we will route in x-dimension
         for (j = 0; j < xbt_dynar_length(p_dimensions); j++) {
           cur_dim = xbt_dynar_get_as(p_dimensions, j, int);
 
           // current_node/dim_product = position in current dimension
-          if ((current_node / dim_product) % cur_dim != (dst->getId() / dim_product) % cur_dim) {
+          if ((current_node / dim_product) % cur_dim != (dst->id() / dim_product) % cur_dim) {
 
             if ((targetCoords[j] > myCoords[j] && targetCoords[j] <= myCoords[j] + cur_dim / 2) // Is the target node on the right, without the wrap-around?
                 || (myCoords[j] > cur_dim / 2 && (myCoords[j] + cur_dim / 2) % cur_dim >= targetCoords[j])) {   // Or do we need to use the wrap around to reach it?
@@ -202,11 +203,11 @@ namespace simgrid {
         s_surf_parsing_link_up_down_t info;
 
         if (p_has_limiter) {    // limiter for sender
-          info = xbt_dynar_get_as(p_linkUpDownList, nodeOffset + p_has_loopback, s_surf_parsing_link_up_down_t);
+          info = xbt_dynar_get_as(upDownLinks, nodeOffset + p_has_loopback, s_surf_parsing_link_up_down_t);
           xbt_dynar_push_as(route->link_list, void *, info.link_up);
         }
 
-        info = xbt_dynar_get_as(p_linkUpDownList, linkOffset, s_surf_parsing_link_up_down_t);
+        info = xbt_dynar_get_as(upDownLinks, linkOffset, s_surf_parsing_link_up_down_t);
 
         if (use_lnk_up == false) {
           xbt_dynar_push_as(route->link_list, void *, info.link_down);