Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use enum class for cluster topology
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 12 Jan 2018 09:18:55 +0000 (10:18 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 12 Jan 2018 09:18:55 +0000 (10:18 +0100)
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp

index f451fad..c6fd856 100644 (file)
@@ -154,18 +154,18 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   ZoneCreationArgs zone;
   zone.id = cluster->id;
   switch (cluster->topology) {
-  case SURF_CLUSTER_TORUS:
-    zone.routing = A_surfxml_AS_routing_ClusterTorus;
-    break;
-  case SURF_CLUSTER_DRAGONFLY:
-    zone.routing = A_surfxml_AS_routing_ClusterDragonfly;
-    break;
-  case SURF_CLUSTER_FAT_TREE:
-    zone.routing = A_surfxml_AS_routing_ClusterFatTree;
-    break;
-  default:
-    zone.routing = A_surfxml_AS_routing_Cluster;
-    break;
+    case ClusterTopology::TORUS:
+      zone.routing = A_surfxml_AS_routing_ClusterTorus;
+      break;
+    case ClusterTopology::DRAGONFLY:
+      zone.routing = A_surfxml_AS_routing_ClusterDragonfly;
+      break;
+    case ClusterTopology::FAT_TREE:
+      zone.routing = A_surfxml_AS_routing_ClusterFatTree;
+      break;
+    default:
+      zone.routing = A_surfxml_AS_routing_Cluster;
+      break;
   }
   sg_platf_new_Zone_begin(&zone);
   simgrid::kernel::routing::ClusterZone* current_as = static_cast<ClusterZone*>(routing_get_current());
@@ -250,7 +250,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
     }
 
     //call the cluster function that adds the others links
-    if (cluster->topology == SURF_CLUSTER_FAT_TREE) {
+    if (cluster->topology == ClusterTopology::FAT_TREE) {
       static_cast<FatTreeZone*>(current_as)->addProcessingNode(i);
     } else {
       current_as->create_links_for_node(cluster, i, rankId, current_as->nodePositionWithLimiter(rankId));
index 48ed849..2a62c6d 100644 (file)
@@ -23,13 +23,6 @@ extern "C" {
 typedef size_t yy_size_t;
 #endif
 
-enum e_surf_cluster_topology_t {
-  SURF_CLUSTER_DRAGONFLY = 3,
-  SURF_CLUSTER_FAT_TREE  = 2,
-  SURF_CLUSTER_FLAT      = 1,
-  SURF_CLUSTER_TORUS     = 0
-};
-
 /* ***************************************** */
 /*
  * Platform creation functions. Instead of passing 123 arguments to the creation functions
@@ -93,6 +86,8 @@ public:
   std::vector<simgrid::surf::LinkImpl*> link_list;
 };
 
+enum class ClusterTopology { DRAGONFLY = 3, FAT_TREE = 2, FLAT = 1, TORUS = 0 };
+
 class ClusterCreationArgs {
 public:
   std::string id;
@@ -108,7 +103,7 @@ public:
   double loopback_bw  = 0;
   double loopback_lat = 0;
   double limiter_link = 0;
-  e_surf_cluster_topology_t topology;
+  ClusterTopology topology;
   std::string topo_parameters;
   std::map<std::string, std::string>* properties;
   std::string router_id;
index fdb04ed..f41d907 100644 (file)
@@ -485,16 +485,16 @@ void ETag_surfxml_cluster(){
 
   switch(AX_surfxml_cluster_topology){
   case A_surfxml_cluster_topology_FLAT:
-    cluster.topology= SURF_CLUSTER_FLAT ;
+    cluster.topology = ClusterTopology::FLAT;
     break;
   case A_surfxml_cluster_topology_TORUS:
-    cluster.topology= SURF_CLUSTER_TORUS ;
+    cluster.topology = ClusterTopology::TORUS;
     break;
   case A_surfxml_cluster_topology_FAT___TREE:
-    cluster.topology = SURF_CLUSTER_FAT_TREE;
+    cluster.topology = ClusterTopology::FAT_TREE;
     break;
   case A_surfxml_cluster_topology_DRAGONFLY:
-    cluster.topology= SURF_CLUSTER_DRAGONFLY ;
+    cluster.topology = ClusterTopology::DRAGONFLY;
     break;
   default:
     surf_parse_error(std::string("Invalid cluster topology for cluster ") + cluster.id);