00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _SPARSE_MSG_H
00011 #define _SPARSE_MSG_H
00012
00042 class SparseMsg: public Msg
00043 {
00044 friend unsigned int Msg::initMsgManagers();
00045 public:
00046 SparseMsg( Element* e1, Element* e2, unsigned int msgIndex );
00047 ~SparseMsg();
00048
00049 Eref firstTgt( const Eref& src ) const;
00050
00051 void sources( vector< vector< Eref > >& v ) const;
00052 void targets( vector< vector< Eref > >& v ) const;
00053
00054 unsigned int randomConnect( double probability );
00055
00056 Id managerId() const;
00057
00058 ObjId findOtherEnd( ObjId end ) const;
00059
00060 Msg* copy( Id origSrc, Id newSrc, Id newTgt,
00061 FuncId fid, unsigned int b, unsigned int n ) const;
00062
00066 void setMatrix( const SparseMatrix< unsigned int >& m );
00067
00071 SparseMatrix< unsigned int >& getMatrix();
00072
00073
00074
00076
00078 void setRandomConnectivity( double probability, long seed );
00079 double getProbability() const;
00080 void setProbability( double value );
00081
00082 long getSeed() const;
00083 void setSeed( long value );
00084
00085 void setEntry( unsigned int row, unsigned int column,
00086 unsigned int value );
00087
00088 void unsetEntry( unsigned int row, unsigned int column );
00089
00090
00091
00092 unsigned int getNumRows() const;
00093 unsigned int getNumColumns() const;
00094 unsigned int getNumEntries() const;
00095 void clear();
00096 void transpose();
00097
00102 void pairFill( vector< unsigned int > src,
00103 vector< unsigned int> dest );
00104
00109 void tripletFill( vector< unsigned int > src,
00110 vector< unsigned int> dest,
00111 vector< unsigned int > field );
00112
00117 void updateAfterFill();
00118
00120 static unsigned int numMsg();
00121 static char* lookupMsg( unsigned int index );
00122
00123 static const Cinfo* initCinfo();
00124
00125 private:
00126 SparseMatrix< unsigned int > matrix_;
00127 unsigned int numThreads_;
00128 unsigned int nrows_;
00129 double p_;
00130 unsigned long seed_;
00131 static Id managerId_;
00132 static vector< SparseMsg* > msg_;
00133 };
00134
00135 #endif // _SPARSE_MSG_H