Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
minor typo
[simgrid.git] / src / surf / surf_routing_cluster_fat_tree.cpp
1 #include "surf_routing_cluster_fat_tree.hpp"
2
3 #include <boost/algorithm/string/split.hpp>
4 #include <boost/algorithm/string/classification.hpp>
5
6
7 AsClusterFatTree::AsClusterFatTree() : levels(0) {}
8
9
10
11 void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src,
12                                           RoutingEdgePtr dst,
13                                           sg_platf_route_cbarg_t into,
14                                           double *latency) {
15   // TODO
16 }
17
18 void AsClusterFatTree::create_links() {
19   if(this->levels == 0) {
20     return;
21   }
22   
23   for (unsigned int i = 0 ; i < this->levels) {
24     
25   }
26
27 }
28
29
30
31 void AsClusterFatTree::parse_specific_arguments(sg_platf_cluster_cbarg_t 
32                                                 cluster) {
33   std::vector<string> parameters;
34   std::vector<string> tmp;
35   boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
36   
37   if (parameters.size() != 4){
38     surf_parse_error("Fat trees are defined by the levels number and 3 vectors" 
39                      ", see the documentation for more informations");
40     // Well, there's no doc, yet
41   }
42
43   // The first parts of topo_parameters should be the levels number
44   this->levels = std::atoi(tmp[0].c_str());
45
46   // Then, a l-sized vector standing for the childs number by level
47   boost::split(tmp, parameters[1], boost::is_any_of(","));
48   if(tmp.size() != this->levels) {
49     surf_parse_error("Fat trees are defined by the levels number and 3 vectors" 
50                      ", see the documentation for more informations"); 
51   }
52   for(unsigned int i = 0 ; i < tmp.size() ; i++){
53     this->lowerLevelNodesNumber.push_back(std::atoi(tmp[i].c_str())); 
54   }
55   
56   // Then, a l-sized vector standing for the parents number by level
57    boost::split(tmp, parameters[2], boost::is_any_of(","));
58   if(tmp.size() != this->levels) {
59     surf_parse_error("Fat trees are defined by the levels number and 3 vectors" 
60                      ", see the documentation for more informations"); 
61   }
62   for(unsigned int i = 0 ; i < tmp.size() ; i++){
63     this->upperLevelNodesNumber.push_back(std::atoi(tmp[i].c_str())); 
64   }
65   
66   // Finally, a l-sized vector standing for the ports number with the lower level
67   boost::split(tmp, parameters[3], boost::is_any_of(","));
68   if(tmp.size() != this->levels) {
69     surf_parse_error("Fat trees are defined by the levels number and 3 vectors" 
70                      ", see the documentation for more informations"); 
71     
72   }
73   for(unsigned int i = 0 ; i < tmp.size() ; i++){
74     this->lowerLevelPortsNumber.push_back(std::atoi(tmp[i].c_str())); 
75   }
76 }
77