MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MsgElement Class Reference

#include <MsgElement.h>

+ Inheritance diagram for MsgElement:
+ Collaboration diagram for MsgElement:

Public Member Functions

ElementcopyElement (Id newParent, Id newId, unsigned int n, bool toGlobal) const
 
char * data (unsigned int rawIndex, unsigned int fieldIndex=0) const
 
unsigned int getNode (unsigned int dataIndex) const
 Inherited virtual. Just returns current node. More...
 
unsigned int getNumOnNode (unsigned int node) const
 
bool hasFields () const
 
bool isGlobal () const
 True if there is a copy of every dataEntry on all nodes. More...
 
unsigned int localDataStart () const
 Inherited virtual. Returns index of first data entry on node. More...
 
 MsgElement (Id id, const Cinfo *c, const string &name, unsigned int(*numMsg)(), char *(*lookupMsg)(unsigned int))
 
unsigned int numData () const
 Inherited virtual. Returns number of data entries. More...
 
unsigned int numField (unsigned int rawIndex) const
 Inherited virtual. Returns number of field entries for specified data. More...
 
unsigned int numLocalData () const
 Inherited virtual. Returns number of data entries. More...
 
unsigned int rawIndex (unsigned int dataIndex) const
 Inherited virtual. Just returns index. More...
 
void resize (unsigned int newNumData)
 
void resizeField (unsigned int rawIndex, unsigned int newNumField)
 
unsigned int startDataIndex (unsigned int node) const
 Inherited virtual. As this is a global we always return zero. More...
 
unsigned int totNumLocalField () const
 
void zombieSwap (const Cinfo *newCinfo)
 
 ~MsgElement ()
 
- Public Member Functions inherited from Element
void addMsg (ObjId mid)
 
void addMsgAndFunc (ObjId mid, FuncId fid, BindIndex bindIndex)
 
const Cinfocinfo () const
 
void clearAllMsgs ()
 Used upon ending of MOOSE session, to rapidly clear out messages. More...
 
void clearBinding (BindIndex b)
 
void digestMessages ()
 
void dropAllMsgsFromSrc (Id src)
 
void dropMsg (ObjId mid)
 
 Element (Id id, const Cinfo *c, const string &name)
 
unsigned int findBinding (MsgFuncBinding b) const
 
ObjId findCaller (FuncId fid) const
 
unsigned int getFieldsOfOutgoingMsg (ObjId mid, vector< pair< BindIndex, FuncId > > &ret) const
 
unsigned int getInputMsgs (vector< ObjId > &caller, FuncId fid) const
 
unsigned int getInputsWithTgtIndex (vector< pair< Id, unsigned int > > &ret, const DestFinfo *finfo) const
 
const vector< MsgFuncBinding > * getMsgAndFunc (BindIndex b) const
 
unsigned int getMsgSourceAndSender (FuncId fid, vector< ObjId > &src, vector< string > &sender) const
 
unsigned int getMsgTargetAndFunctions (DataId srcDataId, const SrcFinfo *finfo, vector< ObjId > &tgt, vector< string > &func) const
 
vector< ObjIdgetMsgTargets (DataId srcDataId, const SrcFinfo *finfo) const
 
const string & getName () const
 
unsigned int getNeighbors (vector< Id > &ret, const Finfo *finfo) const
 
int getTick () const
 
bool hasMsgs (BindIndex b) const
 
Id id () const
 
void innerSetTick (unsigned int tick)
 
bool isDoomed () const
 
void markAsDoomed ()
 
void markRewired ()
 
const vector< MsgDigest > & msgDigest (unsigned int index)
 
const vector< ObjId > & msgIn () const
 
void printMsgDigest (unsigned int srcIndex, unsigned int dataIndex) const
 
void putOffNodeTargetsInDigest (unsigned int srcNum, vector< vector< bool > > &targetNodes)
 
void putTargetsInDigest (unsigned int srcNum, const MsgFuncBinding &mfb, const FuncOrder &fo, vector< vector< bool > > &targetNodes)
 
void replaceCinfo (const Cinfo *newCinfo)
 Support function for zombieSwap, replaces Cinfo. More...
 
void setName (const string &val)
 
void setTick (int t)
 
void showFields () const
 
void showMsg () const
 
virtual ~Element ()
 

Private Attributes

char *(* lookupMsg_ )(unsigned int)
 
unsigned int(* numMsg_ )()
 

Additional Inherited Members

- Static Public Member Functions inherited from Element
static void destroyElementTree (const vector< Id > &tree)
 

Detailed Description

This is a specialized Element class for managing Msg data. Basically it just gives a wrapper for the vectors managed by each of the Msg classes.

Definition at line 20 of file MsgElement.h.

Constructor & Destructor Documentation

MsgElement::MsgElement ( Id  id,
const Cinfo c,
const string &  name,
unsigned int(*)()  numMsg,
char *(*)(unsigned int)  lookupMsg 
)
inline

This is the main constructor, used by Shell::innerCreate which makes most Elements. Also used to create base Elements to init the simulator in main.cpp. Id is the Id of the new Element Cinfo is the class name is its name

Definition at line 31 of file MsgElement.h.

34  :
35  Element( id, c, name ),
36  numMsg_( numMsg ),
37  lookupMsg_( lookupMsg )
38  {;}
Element(Id id, const Cinfo *c, const string &name)
Definition: Element.cpp:17
static char name[]
Definition: mfield.cpp:401
unsigned int(* numMsg_)()
Definition: MsgElement.h:182
char *(* lookupMsg_)(unsigned int)
Definition: MsgElement.h:187
MsgElement::~MsgElement ( )
inline

Virtual Destructor. Nothing to do here.

Definition at line 43 of file MsgElement.h.

44  {;}

Member Function Documentation

Element* MsgElement::copyElement ( Id  newParent,
Id  newId,
unsigned int  n,
bool  toGlobal 
) const
inlinevirtual

Virtual copier. Doesn't do anything. The copy happens at the lower level, involving the Msg classes and the MsgElement just manages them.

Implements Element.

Definition at line 51 of file MsgElement.h.

53  {
54  return 0;
55  }
char* MsgElement::data ( unsigned int  rawIndex,
unsigned int  fieldIndex = 0 
) const
inlinevirtual

Inherited virtual. Looks up specified field data entry. On regular objects just returns the data entry specified by the rawIndex. On FieldElements like synapses, does a second lookup on the field index. Note that the index is NOT a DataIndex: it is instead the raw index of the data on the current node. Index is also NOT the character offset, but the index to the data array in whatever type the data may be.

The DataIndex has to be filtered through the nodeMap to find a) if the entry is here, and b) what its raw index is.

Returns 0 if either index is out of range.

Implements Element.

Definition at line 145 of file MsgElement.h.

References lookupMsg_.

147  {
148  return lookupMsg_( rawIndex );
149  }
unsigned int rawIndex(unsigned int dataIndex) const
Inherited virtual. Just returns index.
Definition: MsgElement.h:103
char *(* lookupMsg_)(unsigned int)
Definition: MsgElement.h:187
unsigned int MsgElement::getNode ( unsigned int  dataIndex) const
inlinevirtual

Inherited virtual. Just returns current node.

Implements Element.

Definition at line 91 of file MsgElement.h.

References Shell::myNode().

92  {
93  return Shell::myNode();
94  }
static unsigned int myNode()

+ Here is the call graph for this function:

unsigned int MsgElement::getNumOnNode ( unsigned int  node) const
inlinevirtual

Returns number of data (or, if relevant, field) entries on specified node.

Implements Element.

Definition at line 121 of file MsgElement.h.

References numMsg_.

121  {
122  return numMsg_();
123  }
unsigned int(* numMsg_)()
Definition: MsgElement.h:182
bool MsgElement::hasFields ( ) const
inlinevirtual

Inherited virtual True if this is a FieldElement having an array of fields on each data entry. Clearly not true for the MsgElement.

Implements Element.

Definition at line 113 of file MsgElement.h.

113  {
114  return false;
115  }
bool MsgElement::isGlobal ( ) const
inlinevirtual

True if there is a copy of every dataEntry on all nodes.

Implements Element.

Definition at line 117 of file MsgElement.h.

117  {
118  return true;
119  }
unsigned int MsgElement::localDataStart ( ) const
inlinevirtual

Inherited virtual. Returns index of first data entry on node.

Implements Element.

Definition at line 74 of file MsgElement.h.

75  {
76  return 0;
77  }
unsigned int MsgElement::numData ( ) const
inlinevirtual

Inherited virtual. Returns number of data entries.

Implements Element.

Definition at line 62 of file MsgElement.h.

References numMsg_.

63  {
64  return numMsg_();
65  }
unsigned int(* numMsg_)()
Definition: MsgElement.h:182
unsigned int MsgElement::numField ( unsigned int  rawIndex) const
inlinevirtual

Inherited virtual. Returns number of field entries for specified data.

Implements Element.

Definition at line 80 of file MsgElement.h.

81  {
82  return 1;
83  }
unsigned int MsgElement::numLocalData ( ) const
inlinevirtual

Inherited virtual. Returns number of data entries.

Implements Element.

Definition at line 68 of file MsgElement.h.

References numMsg_.

69  {
70  return numMsg_();
71  }
unsigned int(* numMsg_)()
Definition: MsgElement.h:182
unsigned int MsgElement::rawIndex ( unsigned int  dataIndex) const
inlinevirtual

Inherited virtual. Just returns index.

Implements Element.

Definition at line 103 of file MsgElement.h.

References dataIndex.

104  {
105  return dataIndex;
106  }
static char dataIndex[]
Definition: mfield.cpp:406
void MsgElement::resize ( unsigned int  newNumData)
inlinevirtual

Inherited virtual Changes the number of entries in the data. Doesn't do anything for the MsgElement.

Implements Element.

Definition at line 156 of file MsgElement.h.

157  {;}
void MsgElement::resizeField ( unsigned int  rawIndex,
unsigned int  newNumField 
)
inlinevirtual

Inherited virtual. Changes the number of fields on the specified data entry. Doesn't do anything for the MsgElement.

Implements Element.

Definition at line 164 of file MsgElement.h.

165  {;}
unsigned int MsgElement::startDataIndex ( unsigned int  node) const
inlinevirtual

Inherited virtual. As this is a global we always return zero.

Implements Element.

Definition at line 97 of file MsgElement.h.

98  {
99  return 0;
100  }
unsigned int MsgElement::totNumLocalField ( ) const
inlinevirtual

Returns number of field entries on local node. If this is not a FieldElement, returns numLocalData, assuming 1 field per data.

Implements Element.

Definition at line 85 of file MsgElement.h.

References numMsg_.

86  {
87  return numMsg_();
88  }
unsigned int(* numMsg_)()
Definition: MsgElement.h:182
void MsgElement::zombieSwap ( const Cinfo newCinfo)
inlinevirtual

Virtual func. The parent does the data swap part, so here it is just the Cinfo we replace.

Reimplemented from Element.

Definition at line 172 of file MsgElement.h.

References Element::replaceCinfo(), and Element::zombieSwap().

172  {
173  replaceCinfo( newCinfo );
174  Element::zombieSwap( newCinfo );
175  }
virtual void zombieSwap(const Cinfo *zCinfo)
virtual func, this base version must be called by all derived classes
Definition: Element.cpp:159
void replaceCinfo(const Cinfo *newCinfo)
Support function for zombieSwap, replaces Cinfo.
Definition: Element.cpp:740

+ Here is the call graph for this function:

Member Data Documentation

char*( * MsgElement::lookupMsg_)(unsigned int)
private

Function to return a pointer to the selected Msg.

Definition at line 187 of file MsgElement.h.

Referenced by data().

unsigned int( * MsgElement::numMsg_)()
private

Function to return the # of Messages.

Definition at line 182 of file MsgElement.h.

Referenced by getNumOnNode(), numData(), numLocalData(), and totNumLocalField().


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