Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid multiple declaration on the same line/statement
[simgrid.git] / src / surf / surf_routing.cpp
index d9847e2..35df080 100644 (file)
@@ -5,18 +5,11 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf_routing.hpp"
-#include "surf_routing_cluster.hpp"
 
 #include "simgrid/sg_config.h"
 #include "storage_interface.hpp"
 
 #include "src/surf/AsImpl.hpp"
-#include "src/surf/surf_routing_cluster_torus.hpp"
-#include "src/surf/surf_routing_cluster_fat_tree.hpp"
-#include "src/surf/surf_routing_dijkstra.hpp"
-#include "src/surf/surf_routing_floyd.hpp"
-#include "src/surf/surf_routing_full.hpp"
-#include "src/surf/surf_routing_vivaldi.hpp"
 #include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
 
 #include <vector>
@@ -39,18 +32,18 @@ namespace surf {
  */
 xbt_dict_t host_list = nullptr;
 
-int COORD_HOST_LEVEL=0;         //Coordinates level
+int COORD_HOST_LEVEL = -1;         //Coordinates level
 
-int MSG_FILE_LEVEL;             //Msg file level
+int MSG_FILE_LEVEL = -1;             //Msg file level
 
-int SIMIX_STORAGE_LEVEL;        //Simix storage level
-int MSG_STORAGE_LEVEL;          //Msg storage level
+int SIMIX_STORAGE_LEVEL = -1;        //Simix storage level
+int MSG_STORAGE_LEVEL = -1;          //Msg storage level
 
 xbt_lib_t as_router_lib;
-int ROUTING_ASR_LEVEL;          //Routing level
-int COORD_ASR_LEVEL;            //Coordinates level
-int NS3_ASR_LEVEL;              //host node for ns3
-int ROUTING_PROP_ASR_LEVEL;     //Where the properties are stored
+int ROUTING_ASR_LEVEL = -1;          //Routing level
+int COORD_ASR_LEVEL = -1;            //Coordinates level
+int NS3_ASR_LEVEL = -1;              //host node for ns3
+int ROUTING_PROP_ASR_LEVEL = -1;     //Where the properties are stored
 
 /** @brief Retrieve a netcard from its name
  *
@@ -72,7 +65,7 @@ simgrid::surf::RoutingPlatf *routing_platf = NULL;
 void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
 {
   tmgr_trace_t tmgr_trace;
-  if (!trace->file || strcmp(trace->file, "") != 0) {
+  if (trace->file && strcmp(trace->file, "") != 0) {
     tmgr_trace = tmgr_trace_new_from_file(trace->file);
   } else {
     xbt_assert(strcmp(trace->pc_data, ""),
@@ -143,75 +136,6 @@ void routing_model_create(Link *loopback)
 /* ************************************************************************** */
 /* ************************* GENERIC PARSE FUNCTIONS ************************ */
 
-void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
-{
-  int start, end, i;
-  char *groups , *host_id , *link_id = NULL;
-  unsigned int iter;
-  xbt_dynar_t radical_elements;
-  xbt_dynar_t radical_ends;
-
-  //Make all hosts
-  radical_elements = xbt_str_split(cabinet->radical, ",");
-  xbt_dynar_foreach(radical_elements, iter, groups) {
-
-    radical_ends = xbt_str_split(groups, "-");
-    start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *));
-
-    switch (xbt_dynar_length(radical_ends)) {
-    case 1:
-      end = start;
-      break;
-    case 2:
-      end = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 1, char *));
-      break;
-    default:
-      surf_parse_error("Malformed radical");
-      break;
-    }
-    s_sg_platf_host_cbarg_t host = SG_PLATF_HOST_INITIALIZER;
-    memset(&host, 0, sizeof(host));
-    host.pstate        = 0;
-    host.core_amount   = 1;
-
-    s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER;
-    memset(&link, 0, sizeof(link));
-    link.policy    = SURF_LINK_FULLDUPLEX;
-    link.latency   = cabinet->lat;
-    link.bandwidth = cabinet->bw;
-
-    s_sg_platf_host_link_cbarg_t host_link = SG_PLATF_HOST_LINK_INITIALIZER;
-    memset(&host_link, 0, sizeof(host_link));
-
-    for (i = start; i <= end; i++) {
-      host_id                      = bprintf("%s%d%s",cabinet->prefix,i,cabinet->suffix);
-      link_id                      = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
-      host.id                      = host_id;
-      link.id                      = link_id;
-      host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
-      xbt_dynar_push(host.speed_peak,&cabinet->speed);
-      sg_platf_new_host(&host);
-      xbt_dynar_free(&host.speed_peak);
-      sg_platf_new_link(&link);
-
-      char* link_up       = bprintf("%s_UP",link_id);
-      char* link_down     = bprintf("%s_DOWN",link_id);
-      host_link.id        = host_id;
-      host_link.link_up   = link_up;
-      host_link.link_down = link_down;
-      sg_platf_new_hostlink(&host_link);
-
-      free(host_id);
-      free(link_id);
-      free(link_up);
-      free(link_down);
-    }
-
-    xbt_dynar_free(&radical_ends);
-  }
-  xbt_dynar_free(&radical_elements);
-}
-
 static void check_disk_attachment()
 {
   xbt_lib_cursor_t cursor;