#include <Msg.h>
Public Member Functions | |
Msg (ObjId mid, Element *e1, Element *e2) | |
Constructor. | |
virtual | ~Msg () |
Destructor. | |
virtual Eref | firstTgt (const Eref &src) const =0 |
virtual void | sources (vector< vector< Eref > > &v) const =0 |
virtual void | targets (vector< vector< Eref > > &v) const =0 |
Element * | e1 () const |
Element * | e2 () const |
Id | getE1 () const |
Id | getE2 () const |
vector< string > | getSrcFieldsOnE1 () const |
vector< string > | getDestFieldsOnE2 () const |
vector< string > | getSrcFieldsOnE2 () const |
vector< string > | getDestFieldsOnE1 () const |
ObjId | mid () const |
virtual ObjId | findOtherEnd (ObjId) const =0 |
ObjId | getAdjacent (ObjId) const |
virtual Msg * | copy (Id origSrc, Id newSrc, Id newTgt, FuncId fid, unsigned int b, unsigned int n) const =0 |
bool | isForward (const Element *src) const |
Static Public Member Functions | |
static void | deleteMsg (ObjId mid) |
static const Msg * | getMsg (ObjId m) |
static const Cinfo * | initCinfo () |
static unsigned int | initMsgManagers () |
static void | clearAllMsgs () |
static const Msg * | lastMsg () |
static bool | isLastTrump () |
True when MOOSE has been terminated and is being cleaned up. | |
Protected Attributes | |
ObjId | mid_ |
Element * | e1_ |
Index of this Msg on the msg_ vector. | |
Element * | e2_ |
Element 1 attached to Msg. | |
Static Protected Attributes | |
static Id | msgManagerId_ |
Element 2 attached to Msg. | |
static bool | lastTrump_ = false |
Flag to indicate termination of program. |
Manages data flow between two elements. Is always many-to-many, with assorted variants.
Msg::~Msg | ( | ) | [virtual] |
Destructor.
References Element::dropMsg(), e1_, e2_, lastTrump_, and mid_.
void Msg::clearAllMsgs | ( | ) | [static] |
Clears out the Msg data stored in each Msg subtype.
References lastTrump_, SparseMsg::lookupMsg(), DiagonalMsg::lookupMsg(), OneToAllMsg::lookupMsg(), OneToOneMsg::lookupMsg(), SingleMsg::lookupMsg(), SparseMsg::numMsg(), DiagonalMsg::numMsg(), OneToAllMsg::numMsg(), OneToOneMsg::numMsg(), and SingleMsg::numMsg().
Referenced by main().
virtual Msg* Msg::copy | ( | Id | origSrc, | |
Id | newSrc, | |||
Id | newTgt, | |||
FuncId | fid, | |||
unsigned int | b, | |||
unsigned int | n | |||
) | const [pure virtual] |
Make a copy of this Msg. The original msg was on origSrc. The new Msg should go from newSrc to newTgt, and have the function fid, on bindIndex b. The copy may have to be a higher-order Msg type to handle arrays if n > 1. Note that n is not the number of msgs, but the multiplier by which numData will be scaled.
Implemented in DiagonalMsg, OneToAllMsg, OneToOneDataIndexMsg, OneToOneMsg, SingleMsg, and SparseMsg.
Referenced by innerCopyMsgs().
void Msg::deleteMsg | ( | ObjId | mid | ) | [static] |
Deletes a message identified by its mid.
References getMsg().
Referenced by Element::clearBinding(), Neutral::destroy(), Element::dropAllMsgsFromSrc(), Shell::innerMove(), and Element::~Element().
Element* Msg::e1 | ( | ) | const [inline] |
Return the first element
References e1_.
Referenced by SharedFinfo::addMsg(), SparseMsg::copy(), SingleMsg::copy(), OneToOneMsg::copy(), OneToOneDataIndexMsg::copy(), OneToAllMsg::copy(), DiagonalMsg::copy(), Element::dropAllMsgsFromSrc(), Element::findCaller(), SparseMsg::findOtherEnd(), SingleMsg::findOtherEnd(), OneToOneMsg::findOtherEnd(), OneToOneDataIndexMsg::findOtherEnd(), OneToAllMsg::findOtherEnd(), DiagonalMsg::findOtherEnd(), initCinfo(), innerCopyMsgs(), putFuncsInOrder(), SparseMsg::randomConnect(), SingleMsg::setI1(), OneToAllMsg::setI1(), SingleMsg::setI2(), DiagonalMsg::setStride(), SingleMsg::setTargetField(), Element::showMsg(), SparseMsg::transpose(), and SparseMsg::updateAfterFill().
Element* Msg::e2 | ( | ) | const [inline] |
Return the second element
References e2_.
Referenced by SharedFinfo::addMsg(), SparseMsg::copy(), SingleMsg::copy(), OneToOneMsg::copy(), OneToOneDataIndexMsg::copy(), OneToAllMsg::copy(), DiagonalMsg::copy(), Element::dropAllMsgsFromSrc(), Element::findCaller(), SparseMsg::findOtherEnd(), SingleMsg::findOtherEnd(), OneToOneMsg::findOtherEnd(), OneToOneDataIndexMsg::findOtherEnd(), OneToAllMsg::findOtherEnd(), DiagonalMsg::findOtherEnd(), Neutral::getIncomingMsgs(), getReactantVols(), initCinfo(), innerCopyMsgs(), putFuncsInOrder(), SparseMsg::randomConnect(), SingleMsg::setI1(), OneToAllMsg::setI1(), SingleMsg::setI2(), DiagonalMsg::setStride(), Element::showMsg(), SparseMsg::transpose(), and SparseMsg::updateAfterFill().
Find the other end of this Msg. In most cases this is a straightforward return of e1 or e2, plus perhaps a DataId. But in some complex msgs we need to figure out DataIds that match with the target. In many-to-one cases we just return the first entry. If no Element match, return ObjId( Id(), DataId::bad() ) If Element e matches but not DataId, return ObjId( e.id(), DataId::bad() )
Implemented in DiagonalMsg, OneToAllMsg, OneToOneDataIndexMsg, OneToOneMsg, SingleMsg, and SparseMsg.
Referenced by getAdjacent(), Neutral::isDescendant(), Neutral::parent(), Neutral::path(), and testAssortedMsg().
Obtain the first target Eref for the specified Src Eref It is really meant only to work with messages with a single target ObjId for each given src, typically OneToOne.
Implemented in DiagonalMsg, OneToAllMsg, OneToOneDataIndexMsg, OneToOneMsg, SingleMsg, and SparseMsg.
Wrapper for findOtherEnd - to expose it as a LookupFinfo.
References findOtherEnd().
Referenced by initCinfo().
vector< string > Msg::getDestFieldsOnE1 | ( | ) | const |
Return names of DestFinfos for messages going from e2 to e1.
References Element::cinfo(), Cinfo::destFinfoName(), e1_, e2_, Element::getFieldsOfOutgoingMsg(), Element::getName(), and mid_.
Referenced by initCinfo(), and testMsgSrcDestFields().
vector< string > Msg::getDestFieldsOnE2 | ( | ) | const |
Return names of DestFinfos for messages going from e1 to e2.
References Element::cinfo(), Cinfo::destFinfoName(), e1_, e2_, Element::getFieldsOfOutgoingMsg(), Element::getName(), and mid_.
Referenced by initCinfo(), and testMsgSrcDestFields().
Id Msg::getE1 | ( | ) | const |
Return the first element id
References e1_, and Element::id().
Referenced by initCinfo().
Id Msg::getE2 | ( | ) | const |
Return the second element id
References e2_, and Element::id().
Referenced by initCinfo().
Looks up the message .
References ObjId::data().
Referenced by SharedFinfo::addMsg(), deleteMsg(), Element::dropAllMsgsFromSrc(), Element::findCaller(), Neutral::getIncomingMsgs(), getReactantVols(), innerCopyMsgs(), Neutral::isDescendant(), Neutral::parent(), Neutral::path(), putFuncsInOrder(), Element::showMsg(), and testAssortedMsg().
vector< string > Msg::getSrcFieldsOnE1 | ( | ) | const |
Return names of SrcFinfos for messages going from e1 to e2.
References Element::cinfo(), e1_, e2_, Element::getFieldsOfOutgoingMsg(), Element::getName(), mid_, and Cinfo::srcFinfoName().
Referenced by initCinfo(), and testMsgSrcDestFields().
vector< string > Msg::getSrcFieldsOnE2 | ( | ) | const |
Return names of SrcFinfos for messages going from e2 to e1.
References Element::cinfo(), e1_, e2_, Element::getFieldsOfOutgoingMsg(), Element::getName(), mid_, and Cinfo::srcFinfoName().
Referenced by initCinfo(), and testMsgSrcDestFields().
const Cinfo * Msg::initCinfo | ( | ) | [static] |
Set up the Msg to be accessed like an Element Although the bare Msg class is never seen, we will use it as a base class and set up some common fields here.
Reimplemented in DiagonalMsg, OneToAllMsg, OneToOneDataIndexMsg, OneToOneMsg, SingleMsg, and SparseMsg.
References e1(), e2(), getAdjacent(), getDestFieldsOnE1(), getDestFieldsOnE2(), getE1(), getE2(), getSrcFieldsOnE1(), getSrcFieldsOnE2(), and Neutral::initCinfo().
Referenced by SparseMsg::initCinfo(), SingleMsg::initCinfo(), OneToOneMsg::initCinfo(), OneToOneDataIndexMsg::initCinfo(), OneToAllMsg::initCinfo(), and DiagonalMsg::initCinfo().
unsigned int Msg::initMsgManagers | ( | ) | [static] |
Sets up the Element managers for each of the Msg classes
References Shell::adopt(), OneToOneDataIndexMsg::initCinfo(), SparseMsg::initCinfo(), DiagonalMsg::initCinfo(), OneToAllMsg::initCinfo(), OneToOneMsg::initCinfo(), SingleMsg::initCinfo(), Neutral::initCinfo(), OneToOneDataIndexMsg::lookupMsg(), SparseMsg::lookupMsg(), DiagonalMsg::lookupMsg(), OneToAllMsg::lookupMsg(), OneToOneMsg::lookupMsg(), SingleMsg::lookupMsg(), msgManagerId_, Id::nextId(), OneToOneDataIndexMsg::numMsg(), SparseMsg::numMsg(), DiagonalMsg::numMsg(), OneToAllMsg::numMsg(), OneToOneMsg::numMsg(), and SingleMsg::numMsg().
Referenced by init().
bool Msg::isForward | ( | const Element * | src | ) | const [inline] |
Checks if the message is going forward. Now merged into Msg::addToQ for most cases.
References e1_.
bool Msg::isLastTrump | ( | ) | [static] |
True when MOOSE has been terminated and is being cleaned up.
References lastTrump_.
Referenced by Clock::~Clock().
const Msg * Msg::lastMsg | ( | ) | [static] |
Returns the most recently constructed msg.
Static utility function, provided so that the shell function doing message creation can retrieve the most recent message made.
ObjId Msg::mid | ( | ) | const [inline] |
References mid_.
Referenced by Shell::adopt(), SparseMsg::copy(), SingleMsg::copy(), OneToOneMsg::copy(), OneToOneDataIndexMsg::copy(), OneToAllMsg::copy(), DiagonalMsg::copy(), Neutral::getIncomingMsgs(), Shell::innerMove(), FieldElementFinfoBase::postCreationFunc(), testCreateMsg(), testFibonacci(), testMsgField(), testMsgSrcDestFields(), testSendMsg(), testSendSpike(), testSharedMsg(), and testSparseMsg().
virtual void Msg::sources | ( | vector< vector< Eref > > & | v | ) | const [pure virtual] |
Return all the sources of e2 from e1, that is, all the msgs coming into specified entries on e2 from e1.
ALLDATA used when the sources include all data entries on a source. Indexing is v[dataId in range e2.numData][src list]
Implemented in DiagonalMsg, OneToAllMsg, OneToOneDataIndexMsg, OneToOneMsg, SingleMsg, and SparseMsg.
virtual void Msg::targets | ( | vector< vector< Eref > > & | v | ) | const [pure virtual] |
Return all the targets of e1 on e2, that is, all the msgs going from specified entries on e1 to e2. ALLDATA used when the targets include all data entries on a target. Indexing is v[dataId in range e1.numData][tgt list]
Implemented in DiagonalMsg, OneToAllMsg, OneToOneDataIndexMsg, OneToOneMsg, SingleMsg, and SparseMsg.
Referenced by testSendMsg().
Index of this Msg on the msg_ vector.
Referenced by e1(), SparseMsg::firstTgt(), SingleMsg::firstTgt(), OneToOneMsg::firstTgt(), OneToOneDataIndexMsg::firstTgt(), OneToAllMsg::firstTgt(), DiagonalMsg::firstTgt(), getDestFieldsOnE1(), getDestFieldsOnE2(), getE1(), getSrcFieldsOnE1(), getSrcFieldsOnE2(), isForward(), and ~Msg().
Referenced by e2(), SparseMsg::firstTgt(), SingleMsg::firstTgt(), OneToOneMsg::firstTgt(), OneToOneDataIndexMsg::firstTgt(), OneToAllMsg::firstTgt(), DiagonalMsg::firstTgt(), getDestFieldsOnE1(), getDestFieldsOnE2(), getE2(), getSrcFieldsOnE1(), getSrcFieldsOnE2(), SparseMsg::randomConnect(), SparseMsg::updateAfterFill(), and ~Msg().
bool Msg::lastTrump_ = false [static, protected] |
Flag to indicate termination of program.
Referenced by clearAllMsgs(), isLastTrump(), and ~Msg().
Referenced by getDestFieldsOnE1(), getDestFieldsOnE2(), getSrcFieldsOnE1(), getSrcFieldsOnE2(), mid(), Msg(), DiagonalMsg::~DiagonalMsg(), ~Msg(), OneToAllMsg::~OneToAllMsg(), OneToOneDataIndexMsg::~OneToOneDataIndexMsg(), OneToOneMsg::~OneToOneMsg(), SingleMsg::~SingleMsg(), and SparseMsg::~SparseMsg().
Id Msg::msgManagerId_ [static, protected] |
Keeps track of the Id of the parent of all the MsgManager Elms.
Referenced by initMsgManagers().