Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
NetCardImpl: automatic and ignorable field renamings
[simgrid.git] / src / surf / surf_routing.cpp
index 66f1972..126f532 100644 (file)
@@ -101,8 +101,8 @@ struct s_model_type routing_models[] = {
    model_none_create},
   {"Vivaldi", "Vivaldi routing", model_vivaldi_create},
   {"Cluster", "Cluster routing", model_cluster_create},
-  {"Torus_Cluster", "Torus Cluster routing", model_torus_cluster_create},
-  {"Fat_Tree_Cluster", "Fat Tree Cluster routing", model_fat_tree_cluster_create},
+  {"TorusCluster", "Torus Cluster routing", model_torus_cluster_create},
+  {"FatTreeCluster", "Fat Tree Cluster routing", model_fat_tree_cluster_create},
   {NULL, NULL, NULL}
 };
 
@@ -168,9 +168,8 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
   XBT_DEBUG("routing_AS_begin");
   routing_model_description_t model = NULL;
 
-  xbt_assert(!xbt_lib_get_or_null
-             (as_router_lib, AS->id, ROUTING_ASR_LEVEL),
-             "The AS \"%s\" already exists", AS->id);
+  xbt_assert(NULL == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL),
+      "Refusing to create a second AS called \"%s\".", AS->id);
 
   _sg_cfg_init_status = 2; /* horrible hack: direct access to the global
                             * controlling the level of configuration to prevent
@@ -179,8 +178,8 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
   /* search the routing model */
   switch(AS->routing){
     case A_surfxml_AS_routing_Cluster:               model = &routing_models[SURF_MODEL_CLUSTER];break;
-    case A_surfxml_AS_routing_Cluster___torus:       model = &routing_models[SURF_MODEL_TORUS_CLUSTER];break;
-    case A_surfxml_AS_routing_Cluster___fat___tree:  model = &routing_models[SURF_MODEL_FAT_TREE_CLUSTER];break;
+    case A_surfxml_AS_routing_ClusterTorus:    model = &routing_models[SURF_MODEL_TORUS_CLUSTER];break;
+    case A_surfxml_AS_routing_ClusterFatTree:  model = &routing_models[SURF_MODEL_FAT_TREE_CLUSTER];break;
     case A_surfxml_AS_routing_Dijkstra:              model = &routing_models[SURF_MODEL_DIJKSTRA];break;
     case A_surfxml_AS_routing_DijkstraCache:         model = &routing_models[SURF_MODEL_DIJKSTRACACHE];break;
     case A_surfxml_AS_routing_Floyd:                 model = &routing_models[SURF_MODEL_FLOYD];break;
@@ -198,11 +197,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
   new_as->p_hierarchy = SURF_ROUTING_NULL;
   new_as->p_name = xbt_strdup(AS->id);
 
-  simgrid::surf::NetCard *info =
-    new simgrid::surf::NetCardImpl(xbt_strdup(new_as->p_name),
-                                            -1,
-                                            SURF_NETWORK_ELEMENT_AS,
-                                            current_routing);
+  simgrid::surf::NetCard *info = new simgrid::surf::NetCardImpl(new_as->p_name, SURF_NETWORK_ELEMENT_AS, current_routing);
   if (current_routing == NULL && routing_platf->p_root == NULL) {
 
     /* it is the first one */
@@ -253,13 +248,9 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
  */
 void routing_AS_end()
 {
-
-  if (current_routing == NULL) {
-    THROWF(arg_error, 0, "Close an AS, but none was under construction");
-  } else {
-    current_routing->Seal();
-    current_routing = current_routing->p_routingFather;
-  }
+  xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
+  current_routing->Seal();
+  current_routing = current_routing->p_routingFather;
 }
 
 /* Aux Business methods */