src/benchmark/bench_tools.h
changeset 742 235fd36336b7
parent 718 75d36edc6bc4
child 750 2713723d2210
equal deleted inserted replaced
1:2398c139396c 2:31076c9b37e7
    79   hugo::TimeStamp S(T);
    79   hugo::TimeStamp S(T);
    80   std::cout << ID << ' ' << S.getUserTime() << ' '
    80   std::cout << ID << ' ' << S.getUserTime() << ' '
    81 	    << S.getSystemTime() << ' ' << S.getRealTime() << std::endl;
    81 	    << S.getSystemTime() << ' ' << S.getRealTime() << std::endl;
    82 }
    82 }
    83 
    83 
       
    84 
       
    85 
       
    86 ///
       
    87 template<class Graph>
       
    88 void addHiperCube(Graph &G,int dim,std::vector<typename Graph::Node> &nodes)
       
    89 {
       
    90   GRAPH_TYPEDEF_FACTORY(Graph);
    84   
    91   
       
    92   std::vector<int> bits(dim+1);
       
    93   bits[0]=1;
       
    94   for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1];
       
    95   
       
    96   for(int i=0;i<bits[dim];i++) {
       
    97     nodes.push_back(G.addNode());
       
    98     for(int j=0;j<dim;j++) if(i&bits[j]) G.addEdge(nodes[i-bits[j]],nodes[i]);
       
    99   }
       
   100 }
       
   101 
       
   102 ///
       
   103 template<class Graph>
       
   104 void addBiDirHiperCube(Graph &G,int dim,std::vector<typename Graph::Node>&nodes)
       
   105 {
       
   106   GRAPH_TYPEDEF_FACTORY(Graph);
       
   107   
       
   108   std::vector<int> bits(dim+1);
       
   109   bits[0]=1;
       
   110   for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1];
       
   111   
       
   112   for(int i=0;i<bits[dim];i++) {
       
   113     nodes.push_back(G.addNode());
       
   114     for(int j=0;j<dim;j++) if(i&bits[j]) {
       
   115       G.addEdge(nodes[i-bits[j]],nodes[i]);
       
   116       G.addEdge(nodes[i],nodes[i-bits[j]]);
       
   117     }
       
   118     
       
   119   }
       
   120 }  
    85 
   121 
    86 #endif
   122 #endif