RandomFixNumberConnections Class Reference

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

#include <RandomFixNumberConnections.h>

Inheritance diagram for RandomFixNumberConnections:

Inheritance graph
[legend]
Collaboration diagram for RandomFixNumberConnections:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

Fast implementation of random connections with a given connection probability.

The actual number of connections made is conn_prob * size(source_population) * size(destination_population)

Definition at line 23 of file RandomFixNumberConnections.h.


Member Typedef Documentation

Definition at line 26 of file RandomFixNumberConnections.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Here is the call graph for this function:

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.


Member Data Documentation

Definition at line 49 of file RandomFixNumberConnections.h.

Referenced by next().

Definition at line 51 of file RandomFixNumberConnections.h.

Referenced by init(), next(), reset(), and ~RandomFixNumberConnections().

Definition at line 52 of file RandomFixNumberConnections.h.

Referenced by init().

Definition at line 53 of file RandomFixNumberConnections.h.

Referenced by init().

Definition at line 57 of file RandomFixNumberConnections.h.

Referenced by next(), and reset().

Definition at line 58 of file RandomFixNumberConnections.h.

Referenced by next(), and reset().

Definition at line 60 of file RandomFixNumberConnections.h.

Referenced by next(), and reset().

Definition at line 61 of file RandomFixNumberConnections.h.

Referenced by next(), and reset().

Definition at line 65 of file RandomFixNumberConnections.h.

Referenced by next(), and reset().

Definition at line 66 of file RandomFixNumberConnections.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