00001 00011 #ifndef RANDOMCONNECTIONS_H 00012 #define RANDOMCONNECTIONS_H 00013 00014 #include <ConnectionIterator.h> 00015 00017 00020 class RandomConnections : public ConnectionIterator { 00021 00022 public: 00023 00025 RandomConnections( const double conn_prob ); 00026 00028 RandomConnections( const double conn_prob, MPI::Intracomm const& mpiComm ); 00029 00030 virtual ~RandomConnections(); 00031 00032 virtual void init(const SimObjectPopulation &srcPopulation, const SimObjectPopulation &destPopulation); 00033 00034 virtual void reset(SimObject::ID::SortedVector::const_iterator src_begin_it, 00035 SimObject::ID::SortedVector::const_iterator src_end_it, 00036 SimObject::ID::SortedVector::const_iterator dest_begin_it, 00037 SimObject::ID::SortedVector::const_iterator dest_end_it); 00038 00039 virtual bool next( pair<SimObject::ID, SimObject::ID> &connection ); 00040 00041 virtual size_t estimate(); 00042 00043 protected: 00044 00045 double conn_prob; 00046 const SimObjectPopulation * src_popul; 00047 const SimObjectPopulation * dest_popul; 00048 00049 GeometricDistribution *geom_rnd; 00050 00051 int curr_src_idx; 00052 int curr_dest_idx; 00053 00054 int src_max_idx; 00055 int dest_max_idx; 00056 00057 SimObject::ID::SortedVector::const_iterator from_begin_it; 00058 SimObject::ID::SortedVector::const_iterator to_begin_it; 00059 00060 }; 00061 00062 #endif