Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill dead code
[simgrid.git] / src / surf / surf_routing.c
index 688b0fe..36dffef 100644 (file)
@@ -1390,9 +1390,9 @@ void routing_parse_Scluster(void)
   {
          if(xbt_dict_size(patterns)==0)
                  patterns = xbt_dict_new();
-         xbt_dict_set(patterns,"id",struct_cluster->id,NULL);
-         xbt_dict_set(patterns,"prefix",struct_cluster->prefix,NULL);
-         xbt_dict_set(patterns,"suffix",struct_cluster->suffix,NULL);
+         xbt_dict_set(patterns,"id",xbt_strdup(struct_cluster->id),free);
+         xbt_dict_set(patterns,"prefix",xbt_strdup(struct_cluster->prefix),free);
+         xbt_dict_set(patterns,"suffix",xbt_strdup(struct_cluster->suffix),free);
   }
 
   unsigned int iter;
@@ -1551,12 +1551,6 @@ void routing_parse_Scluster(void)
                sg_platf_new_host(&host);
                XBT_DEBUG("</host>");
 
-               A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
-               if(struct_cluster->sharing_policy == A_surfxml_cluster_sharing_policy_FULLDUPLEX)
-               {A_surfxml_link_sharing_policy =  A_surfxml_link_sharing_policy_FULLDUPLEX;}
-               if(struct_cluster->sharing_policy == A_surfxml_cluster_sharing_policy_FATPIPE)
-               {A_surfxml_link_sharing_policy =  A_surfxml_link_sharing_policy_FATPIPE;}
-
                XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id,struct_cluster->bw, struct_cluster->lat);
 
                memset(&link,0,sizeof(link));
@@ -1580,8 +1574,6 @@ void routing_parse_Scluster(void)
                }
                sg_platf_new_link(&link);
 
-               ETag_surfxml_link();
-
                surf_parsing_link_up_down_t info = xbt_new0(s_surf_parsing_link_up_down_t, 1);
                if (link.policy == SURF_LINK_FULLDUPLEX) {
                        char* tmp_link =  bprintf("%s_UP",link_id);
@@ -1611,13 +1603,19 @@ void routing_parse_Scluster(void)
   }
   xbt_dynar_free(&radical_elements);
 
-  //Make the router
+  // Add a router. It is magically used thanks to the way in which surf_routing_cluster is written, and it's very useful to connect clusters together
   XBT_DEBUG(" ");
   XBT_DEBUG("<router id=\"%s\"/>", struct_cluster->router_id);
-  SURFXML_BUFFER_SET(router_id, struct_cluster->router_id);
-  SURFXML_BUFFER_SET(router_coordinates, "");
-  SURFXML_START_TAG(router);
-  SURFXML_END_TAG(router);
+  s_sg_platf_router_cbarg_t router;
+  char *newid=NULL;
+  memset(&router,0,sizeof(router));
+  router.id = struct_cluster->router_id;
+  router.coord = "";
+  if (!router.id || !strcmp(router.id,""))
+    router.id = newid = bprintf("%s%s_router%s", struct_cluster->prefix, struct_cluster->id, struct_cluster->suffix);
+  sg_platf_new_router(&router);
+  if (newid)
+    free(newid);
 
   //Make the backbone
   if( (struct_cluster->bb_bw!= 0)  && (struct_cluster->bb_lat!=0)  ){
@@ -1642,7 +1640,6 @@ void routing_parse_Scluster(void)
          }
 
          sg_platf_new_link(&link);
-         ETag_surfxml_link();
 
          surf_parsing_link_up_down_t info = xbt_new0(s_surf_parsing_link_up_down_t, 1);
          info->link_up   = xbt_lib_get_or_null(link_lib, link_backbone, SURF_LINK_LEVEL);