RandomConnections Class Reference

Fast implementation of pure random connections with a given connection probability. More...

#include <RandomConnections.h>

Inheritance diagram for RandomConnections:

Inheritance graph
[legend]
Collaboration diagram for RandomConnections:

Collaboration graph
[legend]

List of all members.

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 SimObjectPopulationsrc_popul
const SimObjectPopulationdest_popul
GeometricDistributiongeom_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


Detailed Description

Fast implementation of pure random connections with a given connection probability.

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.


Constructor & Destructor Documentation

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]

Definition at line 33 of file RandomConnections.cpp.

References conn_prob, and geom_rnd.


Member Function Documentation

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.

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.


Member Data Documentation

Definition at line 45 of file RandomConnections.h.

Referenced by next(), and ~RandomConnections().

Definition at line 46 of file RandomConnections.h.

Referenced by init().

Definition at line 47 of file RandomConnections.h.

Referenced by init().

Definition at line 49 of file RandomConnections.h.

Referenced by next(), RandomConnections(), and ~RandomConnections().

Definition at line 51 of file RandomConnections.h.

Referenced by next(), and reset().

Definition at line 52 of file RandomConnections.h.

Referenced by next(), and reset().

Definition at line 54 of file RandomConnections.h.

Referenced by next(), and reset().

Definition at line 55 of file RandomConnections.h.

Referenced by next(), and reset().

Definition at line 57 of file RandomConnections.h.

Referenced by next(), and reset().

Definition at line 58 of file RandomConnections.h.

Referenced by next(), and reset().


The documentation for this class was generated from the following files:

Generated on Wed Jul 9 16:34:52 2008 for PCSIM by  doxygen 1.5.5