Element Class Reference

#include <Element.h>

Inheritance diagram for Element:
Inheritance graph
[legend]
Collaboration diagram for Element:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Static Public Member Functions

static void destroyElementTree (const vector< Id > &tree)

Detailed Description

Base class for all object lookups. Provides the MOOSE interface so that it handles messaging, class info, and basic fields. Does not do data.


Constructor & Destructor Documentation

Element::Element ( Id  id,
const Cinfo c,
const string &  name 
)

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 numData is the number of data entries, defaults to a singleton. The isGlobal flag specifies whether the created objects should be replicated on all nodes, or partitioned without replication.

Element::~Element (  )  [virtual]

Destructor

References Msg::deleteMsg(), markAsDoomed(), and Id::zeroOut().

Here is the call graph for this function:


Member Function Documentation

void Element::addMsg ( ObjId  mid  ) 

Pushes the Msg mid onto the list. The position on the list does not matter.

References markRewired().

Referenced by Msg::Msg().

Here is the call graph for this function:

void Element::addMsgAndFunc ( ObjId  mid,
FuncId  fid,
BindIndex  bindIndex 
)

Pushes back the specified Msg and Func pair into the properly indexed place on the msgBinding_ vector.

References markRewired().

Referenced by SrcFinfo::addMsg(), SparseMsg::copy(), SingleMsg::copy(), OneToOneMsg::copy(), OneToOneDataIndexMsg::copy(), OneToAllMsg::copy(), DiagonalMsg::copy(), testMsgField(), and testSendMsg().

Here is the call graph for this function:

const Cinfo * Element::cinfo (  )  const

Gets the class information for this Element

Referenced by convertConcToNumRateUsingMesh(), FieldElement::copyElement(), DataElement::DataElement(), Neutral::destroy(), fillSegIndex(), Neutral::getClass(), getCompt(), Neutral::getDestFields(), Msg::getDestFieldsOnE1(), Msg::getDestFieldsOnE2(), Neutral::getOutgoingMsgs(), Stoich::getProxyPools(), getReactantVols(), Neutral::getSourceFields(), Msg::getSrcFieldsOnE1(), Msg::getSrcFieldsOnE2(), Neutral::getValueFields(), innerCopyElements(), isPartOfDend(), localGet(), Eref::msgDigest(), GetOpFunc1< T, L, A >::op(), GetEpFunc1< T, L, A >::op(), ReadCspace::printMol(), putFuncsInOrder(), DataElement::resize(), ZombiePoolInterface::setCompartment(), Stoich::setCompartment(), Gsolve::setCompartment(), Stoich::setDsolve(), Ksolve::setDsolve(), Gsolve::setDsolve(), Stoich::setKsolve(), Gsolve::setN(), Gsolve::setNinit(), HSolve::setSeed(), ZombieReac::setSolver(), ZombieMMenz::setSolver(), ZombieFunction::setSolver(), ZombieEnz::setSolver(), Neuron::setSpineAndPsdMesh(), SteadyState::setStoich(), Ksolve::setStoich(), Gsolve::setStoich(), setTick(), HSolveUtils::targets(), tryParent(), Stoich::unZombifyModel(), Stoich::unZombifyPools(), ZombiePool::vSetSolver(), ZombieHHChannel::vSetSolver(), ZombieCompartment::vSetSolver(), ZombieCaConc::vSetSolver(), DataElement::zombieSwap(), ZombieFunction::zombify(), ReacBase::zombify(), PoolBase::zombify(), EnzBase::zombify(), CplxEnzBase::zombify(), HHChannelBase::zombify(), moose::CompartmentBase::zombify(), CaConcBase::zombify(), and DataElement::~DataElement().

void Element::clearAllMsgs (  ) 

Used upon ending of MOOSE session, to rapidly clear out messages.

Used upon ending of MOOSE session, to rapidly clear out messages, secure in the knowledge that the data structures will be destroyed separately.

References markAsDoomed().

Here is the call graph for this function:

void Element::clearBinding ( BindIndex  b  ) 

Clears out all Msgs on specified BindIndex. Used in Shell::set

References Msg::deleteMsg(), and markRewired().

Here is the call graph for this function:

virtual Element* Element::copyElement ( Id  newParent,
Id  newId,
unsigned int  n,
bool  toGlobal 
) const [pure virtual]

Copier

Implemented in FieldElement, GlobalDataElement, LocalDataElement, and MsgElement.

Referenced by innerCopyElements().

virtual char* Element::data ( unsigned int  rawIndex,
unsigned int  fieldIndex = 0 
) const [pure 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.

Implemented in DataElement, FieldElement, and MsgElement.

Referenced by buildFinfoElement(), FieldElement::data(), Eref::data(), DataElement::DataElement(), main(), Cinfo::makeCinfoElements(), FieldElement::numField(), FieldElement::resizeField(), testArith(), testCreateMsg(), testFibonacci(), testGet(), testSendMsg(), testSetGetSynapse(), and testSetGetVec().

static void Element::destroyElementTree ( const vector< Id > &  tree  )  [static]

Destroys all Elements in tree, being efficient about not trying to traverse through clearing messages to doomed Elements. Assumes tree includes all child elements. Typically the Neutral::destroy function builds up this tree and then calls this function.

Referenced by Neutral::destroy().

void Element::digestMessages (  ) 

Rebuild digested message array; traverse all messages to do so

References findNumDigest(), numData(), Shell::numNodes(), putFuncsInOrder(), putOffNodeTargetsInDigest(), and putTargetsInDigest().

Referenced by msgDigest().

Here is the call graph for this function:

void Element::dropAllMsgsFromSrc ( Id  src  ) 

Drop all messages arriving from src onto current Element, regardless of which field they come from.

References Msg::deleteMsg(), Msg::e1(), Msg::e2(), Id::element(), and Msg::getMsg().

Referenced by setTick().

Here is the call graph for this function:

void Element::dropMsg ( ObjId  mid  ) 

Removes the specified msg from the list.

Called from ~Msg. This requires the usual scan through all msgs, and could get inefficient.

References isDoomed(), and markRewired().

Referenced by Msg::~Msg().

Here is the call graph for this function:

unsigned int Element::findBinding ( MsgFuncBinding  b  )  const

Returns the binding index of the specified entry. Returns ~0 on failure.

Referenced by findCaller().

ObjId Element::findCaller ( FuncId  fid  )  const

Returns the first Msg that calls the specified Fid, on current Element. Returns 0 on failure.

References BADINDEX, Msg::e1(), Msg::e2(), findBinding(), and Msg::getMsg().

Referenced by Shell::innerMove(), Neutral::isDescendant(), Neutral::parent(), Neutral::path(), and testAssortedMsg().

Here is the call graph for this function:

unsigned int Element::getFieldsOfOutgoingMsg ( ObjId  mid,
vector< pair< BindIndex, FuncId > > &  ret 
) const

Fills in vector, each entry of which identifies the src and dest fields respectively. Src field is local and identified by BindIndex Dest field is a FuncId on the remote Element.

Referenced by Msg::getDestFieldsOnE1(), Msg::getDestFieldsOnE2(), Msg::getSrcFieldsOnE1(), Msg::getSrcFieldsOnE2(), and testMsgSrcDestFields().

unsigned int Element::getInputMsgs ( vector< ObjId > &  caller,
FuncId  fid 
) const

More general function. Fills up vector of ObjIds that call the specified Fid on current Element. Returns # found

Referenced by insertSharedMsgs().

const vector< MsgFuncBinding > * Element::getMsgAndFunc ( BindIndex  b  )  const

gets the Msg/Func binding information for specified bindIndex. This is a vector. Returns 0 on failure.

Referenced by convertConcToNumRateUsingVol(), ReacBase::getNumPrd(), ReacBase::getNumSub(), EnzBase::getNumSub(), Neutral::getOutgoingMsgs(), getReactantVols(), and innerCopyMsgs().

unsigned int Element::getMsgSourceAndSender ( FuncId  fid,
vector< ObjId > &  src,
vector< string > &  sender 
) const

Fills in matching vectors of destination ObjIds and the destination function, for the specified source Finfo and dataId on this Element. Used in Neutral::msgDests and Neutral::msgDestFunctions. Returns number of dests found.

Referenced by testMsgSrcDestFields().

unsigned int Element::getMsgTargetAndFunctions ( DataId  srcDataId,
const SrcFinfo finfo,
vector< ObjId > &  tgt,
vector< string > &  func 
) const

Fills in matching vectors of destination ObjIds and the destination function, for the specified source Finfo and dataId on this Element. Used in Neutral::msgDests and Neutral::msgDestFunctions. Returns number of dests found.

Referenced by testMsgSrcDestFields().

vector< ObjId > Element::getMsgTargets ( DataId  srcDataId,
const SrcFinfo finfo 
) const

Enumerates msg targets. Will get confused if some are across nodes.

References ALLDATA, SrcFinfo::getBindIndex(), Eref::msgDigest(), and numData().

Referenced by Adaptor::reinit(), and ChemCompt::setEntireVolume().

Here is the call graph for this function:

const string & Element::getName (  )  const
unsigned int Element::getNeighbors ( vector< Id > &  ret,
const Finfo finfo 
) const
virtual unsigned int Element::getNode ( unsigned int  dataIndex  )  const [pure virtual]

Returns node number of specified dataIndex.

Implemented in FieldElement, GlobalDataElement, LocalDataElement, and MsgElement.

Referenced by HopFunc1< A >::dataOpVec(), FieldElement::getNode(), Eref::getNode(), and Eref::isDataHere().

virtual unsigned int Element::getNumOnNode ( unsigned int  node  )  const [pure virtual]

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

Implemented in FieldElement, GlobalDataElement, LocalDataElement, and MsgElement.

Referenced by HopFunc1< A >::dataOpVec(), and HopFunc2< A1, A2 >::opVec().

int Element::getTick (  )  const

Returns Clock tick used by object. -1 means none. -2 means none for now because I am a zombie, but if I should be unzombified please put me back on my default clock tick.

Referenced by Neutral::getDt(), Neutral::getTick(), and Stoich::unZombifyModel().

virtual bool Element::hasFields (  )  const [pure virtual]

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

Implemented in DataElement, FieldElement, and MsgElement.

Referenced by OneToOneMsg::firstTgt(), GetHopFunc< A >::opGetVec(), HopFunc1< A >::opVec(), and Neutral::path().

bool Element::hasMsgs ( BindIndex  b  )  const

Returns true if there are one or more Msgs on the specified BindIndex

Referenced by NeuroMesh::transmitSpineInfo().

Id Element::id (  )  const
void Element::innerSetTick ( unsigned int  tick  ) 

Direct assignment of tick field, without doing any of the message manipulation

bool Element::isDoomed (  )  const

Referenced by dropMsg(), and Stoich::unZombifyPools().

virtual bool Element::isGlobal (  )  const [pure virtual]
virtual unsigned int Element::localDataStart (  )  const [pure virtual]
void Element::markAsDoomed (  ) 

Set flag to state that Element is due for destruction. Useful to avoid following messages that will soon be gone.

Referenced by clearAllMsgs(), and ~Element().

void Element::markRewired (  ) 
const vector< MsgDigest > & Element::msgDigest ( unsigned int  index  ) 

Raw lookup into MsgDigest vector. One for each MsgSrc X ObjEntry. If the messages have been rewired, this call triggers the re-parsing of all messages before returning the digested msgs.

References digestMessages().

Referenced by Eref::msgDigest(), and testSendMsg().

Here is the call graph for this function:

const vector< ObjId > & Element::msgIn (  )  const

Returns all incoming Msgs.

Referenced by Neutral::getIncomingMsgs().

virtual unsigned int Element::numData (  )  const [pure virtual]
virtual unsigned int Element::numField ( unsigned int  rawIndex  )  const [pure virtual]
virtual unsigned int Element::numLocalData (  )  const [pure virtual]
void Element::printMsgDigest ( unsigned int  srcIndex,
unsigned int  dataIndex 
) const

Utility function for debugging

References numData().

Here is the call graph for this function:

void Element::putOffNodeTargetsInDigest ( unsigned int  srcNum,
vector< vector< bool > > &  targetNodes 
)

Inner function that adds off-node targets to the MsgDigest

Referenced by digestMessages().

void Element::putTargetsInDigest ( unsigned int  srcNum,
const MsgFuncBinding mfb,
const FuncOrder fo,
vector< vector< bool > > &  targetNodes 
)

Inner function that adds targets to a single function in the MsgDigest

Referenced by digestMessages().

virtual unsigned int Element::rawIndex ( unsigned int  dataIndex  )  const [pure virtual]

Converts dataIndex to index on current node. No error check.

Implemented in FieldElement, GlobalDataElement, LocalDataElement, and MsgElement.

Referenced by Eref::data(), Neutral::getNumField(), FieldElement::rawIndex(), and Neutral::setNumField().

void Element::replaceCinfo ( const Cinfo newCinfo  ) 

Support function for zombieSwap, replaces Cinfo.

Referenced by MsgElement::zombieSwap(), FieldElement::zombieSwap(), DataElement::zombieSwap(), and ZombieFunction::zombify().

virtual void Element::resize ( unsigned int  newNumData  )  [pure virtual]

Changes the number of entries in the data. Not permitted for FieldElements since they are just fields on the data.

Implemented in DataElement, FieldElement, LocalDataElement, and MsgElement.

Referenced by LookupField< L, A >::getVec(), and Neutral::setNumData().

virtual void Element::resizeField ( unsigned int  rawIndex,
unsigned int  newNumField 
) [pure virtual]

Changes the number of fields on the specified data entry. Doesn't do anything for the regular Element.

Implemented in DataElement, FieldElement, and MsgElement.

Referenced by SparseMsg::randomConnect(), Neutral::setNumField(), and SparseMsg::updateAfterFill().

void Element::setName ( const string &  val  ) 

Changes name of Element

Referenced by testGet(), and testStrGet().

void Element::setTick ( int  t  ) 

Assigns clock tick to be used by object. -1 means none. This function does substantial message manipulation to set up the message from the Clock object to the current object to define the Tick. Furthermore, if the object has both init and proc methods, it will set them both up, with the init method on 't-1' and the proc method on 't'

References cinfo(), dropAllMsgsFromSrc(), Cinfo::findFinfo(), and Cinfo::name().

Referenced by innerCopyElements(), Stoich::installAndUnschedFunc(), Stoich::installAndUnschedFuncRate(), Stoich::installAndUnschedFuncReac(), Neutral::setTick(), Stoich::unZombifyModel(), and zombieSwap().

Here is the call graph for this function:

void Element::showFields (  )  const

Utility function for printing out all fields and their values

References Id::eref(), Cinfo::finfoMap(), and id().

Here is the call graph for this function:

void Element::showMsg (  )  const

Utility function for traversing and displaying all messages

References Msg::e1(), Msg::e2(), Cinfo::finfoMap(), SrcFinfo::getBindIndex(), Msg::getMsg(), getName(), and Finfo::name().

Here is the call graph for this function:

virtual unsigned int Element::startDataIndex ( unsigned int  nodeNum  )  const [pure virtual]

Returns start dataIndex on specified node.

Implemented in FieldElement, GlobalDataElement, LocalDataElement, and MsgElement.

Referenced by HopFunc1< A >::dataOpVec(), and FieldElement::startDataIndex().

virtual unsigned int Element::totNumLocalField (  )  const [pure virtual]

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

Implemented in DataElement, FieldElement, and MsgElement.

void Element::zombieSwap ( const Cinfo zCinfo  )  [virtual]

virtual func, this base version must be called by all derived classes

zombieSwap: replaces the Cinfo and data of the zombie. Allocates a new data block using zCinfo, that matches the number of entries of the old data block. Deletes old data. The base version calls the Clock object to assign a suitable default clock.

Reimplemented in DataElement, FieldElement, and MsgElement.

References Clock::lookupDefaultTick(), Cinfo::name(), and setTick().

Referenced by ReacBase::zombify(), PoolBase::zombify(), EnzBase::zombify(), CplxEnzBase::zombify(), HHChannelBase::zombify(), moose::CompartmentBase::zombify(), and CaConcBase::zombify().

Here is the call graph for this function:


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

Generated on 1 Jul 2015 for MOOSE by  doxygen 1.6.1