#include <RandomConnections.h>
Public Member Functions | |
RandomConnections (const double conn_prob) | |
New RandomConnections with a given connection probability. | |
RandomConnections (const double conn_prob, MPI::Intracomm const &mpiComm) | |
New RandomConnections with a given connection probability and an MPI::Intracomm. | |
virtual | ~RandomConnections () |
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 | |
double | conn_prob |
const SimObjectPopulation * | src_popul |
const SimObjectPopulation * | dest_popul |
GeometricDistribution * | geom_rnd |
int | curr_src_idx |
int | curr_dest_idx |
int | src_max_idx |
int | dest_max_idx |
SimObject::ID::SortedVector::const_iterator | from_begin_it |
SimObject::ID::SortedVector::const_iterator | to_begin_it |
The implementation uses the fact that the differences of indices follow a geometric distribution with parameter 1 - conn_prob
Definition at line 20 of file RandomConnections.h.
RandomConnections::RandomConnections | ( | const double | conn_prob | ) |
New RandomConnections with a given connection probability.
Definition at line 13 of file RandomConnections.cpp.
References geom_rnd.
RandomConnections::RandomConnections | ( | const double | conn_prob, | |
MPI::Intracomm const & | mpiComm | |||
) |
New RandomConnections with a given connection probability and an MPI::Intracomm.
Definition at line 23 of file RandomConnections.cpp.
References geom_rnd.
RandomConnections::~RandomConnections | ( | ) | [virtual] |
void RandomConnections::init | ( | const SimObjectPopulation & | src, | |
const SimObjectPopulation & | dst | |||
) | [virtual] |
Tell the iterator about the populations to connect.
Implements ConnectionIterator.
Definition at line 39 of file RandomConnections.cpp.
References dest_popul, and src_popul.
void RandomConnections::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 51 of file RandomConnections.cpp.
References curr_dest_idx, curr_src_idx, dest_max_idx, from_begin_it, src_max_idx, and to_begin_it.
bool RandomConnections::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 66 of file RandomConnections.cpp.
References conn_prob, curr_dest_idx, curr_src_idx, dest_max_idx, from_begin_it, geom_rnd, ConnectionIterator::last_conn_idx, ConnectionIterator::last_conn_valid, ConnectionIterator::m_rnd_eng, src_max_idx, and to_begin_it.
size_t RandomConnections::estimate | ( | ) | [virtual] |
Return an estimated number of connections which will be generated (if possible).
Reimplemented from ConnectionIterator.
Definition at line 46 of file RandomConnections.cpp.
double RandomConnections::conn_prob [protected] |
const SimObjectPopulation* RandomConnections::src_popul [protected] |
const SimObjectPopulation* RandomConnections::dest_popul [protected] |
GeometricDistribution* RandomConnections::geom_rnd [protected] |
Definition at line 49 of file RandomConnections.h.
Referenced by next(), RandomConnections(), and ~RandomConnections().
int RandomConnections::curr_src_idx [protected] |
int RandomConnections::curr_dest_idx [protected] |
int RandomConnections::src_max_idx [protected] |
int RandomConnections::dest_max_idx [protected] |