#include <RandomFixNumberConnections.h>
Public Types | |
typedef set< pair< int, int > > | ConnectedPairsVector |
Public Member Functions | |
RandomFixNumberConnections (const double conn_prob) | |
New RandomFixNumberConnections with a given connection probability. | |
RandomFixNumberConnections (const double conn_prob, MPI::Intracomm const &mpiComm) | |
New RandomFixNumberConnections with a given connection probability and an MPI::Intracomm. | |
virtual | ~RandomFixNumberConnections () |
virtual void | init (const SimObjectPopulation &srcPopulation, const SimObjectPopulation &destPopulation) |
Tell the iterator about the populations to connect. | |
virtual void | reset (SimObject::ID::SortedVector::const_iterator src_begin_it, SimObject::ID::SortedVector::const_iterator src_end_it, SimObject::ID::SortedVector::const_iterator dest_begin_it, SimObject::ID::SortedVector::const_iterator dest_end_it) |
Reset/Prepare the iterator to connect src to dst (specified by the begin and end iterators). | |
virtual bool | next (pair< SimObject::ID, SimObject::ID > &connection) |
Move on to the next connection. If true is returned the connection pair is set properly. | |
virtual size_t | estimate () |
Return an estimated number of connections which will be generated (if possible). | |
Protected Attributes | |
ConnectedPairsVector | connected_pairs |
double | conn_prob |
const SimObjectPopulation * | src_popul |
const SimObjectPopulation * | dest_popul |
UniformDistribution * | uni_rnd |
int | curr_src_idx |
int | curr_dest_idx |
int | src_max_idx |
int | dest_max_idx |
unsigned int | num_connections |
SimObject::ID::SortedVector::const_iterator | from_begin_it |
SimObject::ID::SortedVector::const_iterator | to_begin_it |
The actual number of connections made is conn_prob * size(source_population) * size(destination_population)
Definition at line 23 of file RandomFixNumberConnections.h.
typedef set< pair<int, int> > RandomFixNumberConnections::ConnectedPairsVector |
Definition at line 26 of file RandomFixNumberConnections.h.
RandomFixNumberConnections::RandomFixNumberConnections | ( | const double | conn_prob | ) |
New RandomFixNumberConnections with a given connection probability.
Definition at line 13 of file RandomFixNumberConnections.cpp.
References uni_rnd.
RandomFixNumberConnections::RandomFixNumberConnections | ( | const double | conn_prob, | |
MPI::Intracomm const & | mpiComm | |||
) |
New RandomFixNumberConnections with a given connection probability and an MPI::Intracomm.
Definition at line 24 of file RandomFixNumberConnections.cpp.
References num_connections, and uni_rnd.
RandomFixNumberConnections::~RandomFixNumberConnections | ( | ) | [virtual] |
Definition at line 37 of file RandomFixNumberConnections.cpp.
References conn_prob, num_connections, and uni_rnd.
void RandomFixNumberConnections::init | ( | const SimObjectPopulation & | src, | |
const SimObjectPopulation & | dst | |||
) | [virtual] |
Tell the iterator about the populations to connect.
Implements ConnectionIterator.
Definition at line 46 of file RandomFixNumberConnections.cpp.
References conn_prob, dest_popul, num_connections, SimObjectPopulation::size(), and src_popul.
void RandomFixNumberConnections::reset | ( | SimObject::ID::SortedVector::const_iterator | src_begin, | |
SimObject::ID::SortedVector::const_iterator | src_end, | |||
SimObject::ID::SortedVector::const_iterator | dst_begin, | |||
SimObject::ID::SortedVector::const_iterator | dst_end | |||
) | [virtual] |
Reset/Prepare the iterator to connect src to dst (specified by the begin and end iterators).
Implements ConnectionIterator.
Definition at line 61 of file RandomFixNumberConnections.cpp.
References conn_prob, curr_dest_idx, curr_src_idx, dest_max_idx, from_begin_it, num_connections, src_max_idx, and to_begin_it.
bool RandomFixNumberConnections::next | ( | pair< SimObject::ID, SimObject::ID > & | connection | ) | [virtual] |
Move on to the next connection. If true is returned the connection pair is set properly.
Implements ConnectionIterator.
Definition at line 78 of file RandomFixNumberConnections.cpp.
References conn_prob, connected_pairs, curr_dest_idx, curr_src_idx, dest_max_idx, from_begin_it, ConnectionIterator::last_conn_idx, ConnectionIterator::last_conn_valid, num_connections, src_max_idx, to_begin_it, and uni_rnd.
size_t RandomFixNumberConnections::estimate | ( | ) | [virtual] |
Return an estimated number of connections which will be generated (if possible).
Reimplemented from ConnectionIterator.
Definition at line 55 of file RandomFixNumberConnections.cpp.
References num_connections.
double RandomFixNumberConnections::conn_prob [protected] |
Definition at line 51 of file RandomFixNumberConnections.h.
Referenced by init(), next(), reset(), and ~RandomFixNumberConnections().
const SimObjectPopulation* RandomFixNumberConnections::src_popul [protected] |
const SimObjectPopulation* RandomFixNumberConnections::dest_popul [protected] |
UniformDistribution* RandomFixNumberConnections::uni_rnd [protected] |
Definition at line 55 of file RandomFixNumberConnections.h.
Referenced by next(), RandomFixNumberConnections(), and ~RandomFixNumberConnections().
int RandomFixNumberConnections::curr_src_idx [protected] |
int RandomFixNumberConnections::curr_dest_idx [protected] |
int RandomFixNumberConnections::src_max_idx [protected] |
int RandomFixNumberConnections::dest_max_idx [protected] |
unsigned int RandomFixNumberConnections::num_connections [protected] |
Definition at line 63 of file RandomFixNumberConnections.h.
Referenced by estimate(), init(), next(), RandomFixNumberConnections(), reset(), and ~RandomFixNumberConnections().