COIN-OR::LEMON - Graph Library

Changeset 711:b6c56353832c in lemon-0.x for src/benchmark/hcube.cc


Ignore:
Timestamp:
07/20/04 11:50:11 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@963
Message:

Some tools of common usage was put to bench_tool.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/benchmark/hcube.cc

    r708 r711  
    77#include<hugo/time_measure.h>
    88#include<iostream>
    9 #include<../work/jacint/max_flow.h>
     9//#include<../work/jacint/max_flow.h>
     10#include"bench_tools.h"
    1011
    1112using namespace std;
    1213using namespace hugo;
    13 
    14 ///An experimental typedef factory
    15 #define GRAPH_TYPEDEF_FACTORY(Graph) \
    16    typedef typename Graph::   Node      Node;\
    17    typedef typename Graph::   NodeIt    NodeIn;\
    18    typedef typename Graph::   Edge      Edge;\
    19    typedef typename Graph::   EdgeIt    EdgeIt;\
    20    typedef typename Graph:: InEdgeIt  InEdgeIt;\
    21    typedef typename Graph::OutEdgeIt OutEdgeIt;
    22 
    23 #define GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph) \
    24    typedef Graph::   Node      Node;\
    25    typedef Graph::   NodeIt    NodeIn;\
    26    typedef Graph::   Edge      Edge;\
    27    typedef Graph::   EdgeIt    EdgeIt;\
    28    typedef Graph:: InEdgeIt  InEdgeIt;\
    29    typedef Graph::OutEdgeIt OutEdgeIt;
    30 
    31 
    32 class Primes
    33 {
    34   vector<int> primes;
    35   int n;
    36  
    37   bool isPrime(int m)
    38   {
    39     for(int i=0;m<primes[i]*primes[i];i++) if(!(m%primes[i])) return false;
    40     return true;
    41   }
    42 public:
    43   Primes() : n(1) {}
    44  
    45   int operator() ()
    46     {
    47       if(primes.size()==0) {
    48         primes.push_back(2);
    49         return 2;
    50       }
    51       else {
    52         do n+=2; while(!isPrime(n));
    53         primes.push_back(n);
    54         return n;
    55       }
    56     }
    57 };
    5814
    5915template<class Graph>
Note: See TracChangeset for help on using the changeset viewer.