31 "ObjId for current object",
36 "Parent ObjId for current object",
41 "vector of ObjIds listing all children of current object",
46 "text path for object",
53 "Class Name of object",
58 "# of Data entries on Element."
59 "Note that on a FieldElement this does NOT refer to field entries,"
60 "but to the number of DataEntries on the parent of the "
67 "For a FieldElement: number of entries of self."
68 "For a regular Element: One.",
74 "Object id of self, converted to an unsigned int.",
79 "For a FieldElement: Object index of parent."
80 "For a regular Element: Object index (dataId) of self.",
85 "For a FieldElement: field Index of self."
86 "For a regular Element: zero.",
92 "Clock tick for this Element for periodic execution in the "
93 "main simulation event loop. A default is normally assigned, "
94 "based on object class, but one can override to any value "
95 "between 0 and 19. Assigning to -1 means that the object is "
96 "disabled and will not be called during simulation execution "
97 "The actual timestep (dt) belonging to a clock tick is defined "
98 "by the Clock object.",
105 "Timestep used for this Element. Zero if not scheduled.",
112 "List of all value fields on Element."
113 "These fields are accessed through the assignment operations "
114 "in the Python interface."
115 "These fields may also be accessed as functions through the "
116 "set<FieldName> and get<FieldName> commands.",
123 "List of all source fields on Element, that is fields that "
124 "can act as message sources. ",
131 "List of all destination fields on Element, that is, fields"
132 "that are accessed as Element functions.",
138 "Messages going out from this Element",
143 "Messages coming in to this Element",
148 "Ids of Elements connected this Element on specified field.",
153 "ObjIds receiving messages from the specified SrcFinfo",
158 "Matching function names for each ObjId receiving a msg from "
159 "the specified SrcFinfo",
164 "Returns true if the current object is derived from the specified "
165 "the specified class",
173 "Access function for entire object",
181 "Message to child Elements");
187 "Message from Parent Element(s)",
191 "Request conversion of data into a blockDataHandler subclass,"
192 "and to carry out node balancing of data."
193 "The amount of data is not altered, and if the data is already a"
194 "blockDataHandler subclass it retains its original dimensions"
195 "If converting from a generalDataHandler to blockHandler it treats"
196 "it as a linear array"
197 "The function preserves the old data and shuffles info around"
198 "between nodes to complete the balancing."
199 "Arguments are: myNode, startNode, endNode",
204 "Request conversion of data into a generalDataHandler subclass,"
205 "and to carry out node balancing of data as per specified args."
206 "The amount of data is not altered. The generalDataHandler loses"
207 "any dimensional information that may have been present in an "
208 "earlier blockDataHandler incarnation."
209 "Arguments are: myNode, nodeAssignment",
216 static Finfo* neutralFinfos[] = {
248 static string doc[] =
251 "Author",
"Upinder S. Bhalla, 2007, NCBS",
252 "Description",
"Neutral: Base class for all MOOSE classes. Provides"
253 "access functions for housekeeping fields and operations, message"
254 "traversal, and so on."
261 sizeof( neutralFinfos ) /
sizeof(
Finfo* ),
264 sizeof(doc)/
sizeof(
string)
297 cout <<
"Warning: Neutral::setName on '" << e.
id().
path() <<
298 "'. Cannot rename core objects\n";
302 cout <<
"Warning: Neutral::setName on '" << e.
id().
path() <<
303 "'. Illegal character in name.\n";
308 if ( sibling ==
Id() ) {
311 cout <<
"Warning: Neutral::setName: an object with the name '" <<
312 name <<
"'\n already exists on the same parent. Not changed\n";
363 for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
364 i != bvec->end(); ++i ) {
365 if ( i->fid == pafid ) {
368 vector< vector< Eref > > kids;
371 for ( vector< vector< Eref > >::iterator
372 i = kids.begin(); i != kids.end(); ++i ) {
373 for ( vector< Eref >::iterator
374 j = i->begin(); j != i->end(); ++j )
375 ret.push_back( j->id() );
378 const vector< Eref >& temp = kids[e.
dataIndex()];
379 for ( vector< Eref >::const_iterator
380 i = temp.begin(); i != temp.end(); ++i )
381 ret.push_back( i->id() );
454 clockId,
"tickDt", tick );
460 vector< string > ret( num );
461 for (
unsigned int i = 0; i < num; ++i ) {
472 vector< string > ret( num );
473 for (
unsigned int i = 0; i < num; ++i ) {
484 vector< string > ret( num );
485 for (
unsigned int i = 0; i < num; ++i ) {
498 for (
unsigned int i = 0; i < numBindIndex; ++i ) {
499 const vector< MsgFuncBinding >* v =
502 for ( vector< MsgFuncBinding >::const_iterator mb = v->begin();
503 mb != v->end(); ++mb ) {
504 ret.push_back( mb->mid );
516 for (
unsigned int i = 0; i < msgIn.size(); ++i ) {
520 ret.push_back( m->
mid() );
532 cout <<
"Warning: Neutral::getNeighbors: Id.Field '" <<
533 e.
id().
path() <<
"." << field <<
544 vector< string > func;
549 cout <<
"Warning: Neutral::getMsgDests: Id.Field '" <<
550 e.
id().
path() <<
"." << field <<
551 "' not found or not a SrcFinfo\n";
553 static vector< ObjId > ret( 0 );
559 vector< string > ret( 0 );
564 vector< string > func;
569 cout <<
"Warning: Neutral::getMsgDestFunctions: Id.Field '" <<
570 e.
id().
path() <<
"." << field <<
571 "' not found or not a SrcFinfo\n";
586 unsigned int ret = 1;
589 sort( kids.begin(), kids.end() );
590 kids.erase( unique( kids.begin(), kids.end() ), kids.end() );
591 for ( vector< Id >::iterator i = kids.begin(); i != kids.end(); ++i )
613 unsigned int numDescendants =
buildTree( er, tree );
619 assert( numDescendants == tree.size() );
628 unsigned int,
unsigned int,
unsigned int )
637 unsigned int myNode, vector< unsigned int > nodeAssignment )
657 assert( mid !=
ObjId() );
661 return ( e.
element()->
id() == ancestor );
678 for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
679 i != bvec->end(); ++i ) {
680 if ( i->fid == pafid ) {
712 if ( oid.
id ==
Id() ) {
713 cout <<
"Warning: Neutral::parent: tried to take parent of root\n";
718 assert( mid !=
ObjId() );
731 vector< ObjId > pathVec;
735 pathVec.push_back( curr );
736 while ( curr.
id !=
Id() ) {
738 if ( mid ==
ObjId() ) {
739 cout <<
"Error: Neutral::path:Cannot follow msg of ObjId: " <<
740 e.
objId() <<
" for func: " << pafid << endl;
744 pathVec.push_back( curr );
746 if ( pathVec.size() <= 1 )
748 for (
unsigned int i = 1; i < pathVec.size(); ++i ) {
750 ObjId& oid = pathVec[ pathVec.size() - i - 1 ];
783 if ( field.length() < 8 )
785 if ( field.substr( 0, 4 ) ==
"set_" ) {
786 if ( field ==
"set_name" )
788 if ( field ==
"set_group" )
790 if ( field ==
"set_lastDimension" )
bool isA(const Eref &e, string className) const
virtual ObjId findOtherEnd(ObjId) const =0
const vector< ObjId > & msgIn() const
unsigned int getNumField(const Eref &e) const
static ObjId parent(const Eref &e)
Finfo * getDestFinfo(unsigned int i) const
Finfo * getValueFinfo(unsigned int i) const
unsigned int getNumSrcFinfo() const
ObjId getParent(const Eref &e) const
vector< ObjId > getMsgDests(const Eref &e, string src) const
void setName(const string &val)
static A get(const ObjId &dest, const string &field, L index)
unsigned int getFieldIndex(const Eref &e) const
fieldIndex specifies field entry if FieldElement. Otherwise zero
unsigned int getNumDestFinfo() const
BindIndex getBindIndex() const
ObjId getObjId(const Eref &e) const
std::string path(const std::string &separator="/") const
unsigned int value() const
string getPath(const Eref &e) const
void setTick(const Eref &e, int num)
unsigned int dataIndex() const
unsigned int getMsgTargetAndFunctions(DataId srcDataId, const SrcFinfo *finfo, vector< ObjId > &tgt, vector< string > &func) const
unsigned int getNumValueFinfo() const
static bool isGlobalField(const string &field)
void setNumData(const Eref &e, unsigned int num)
double getDt(const Eref &e) const
Returns dt associated with this object based on its clock tick.
vector< string > getDestFields(const Eref &e) const
Information function to return names of all DestFinfos.
static Id child(const Eref &e, const string &name)
istream & operator>>(istream &s, Neutral &d)
static const Cinfo * neutralCinfo
vector< string > getMsgDestFunctions(const Eref &e, string src) const
static void children(const Eref &e, vector< Id > &ret)
const string & name() const
Element * element() const
unsigned int buildTree(const Eref &e, vector< Id > &tree) const
vector< Id > getNeighbors(const Eref &e, string field) const
unsigned int fieldIndex() const
virtual void targets(vector< vector< Eref > > &v) const =0
vector< string > getValueFields(const Eref &e) const
Information function to return names of all value Finfos.
static string path(const Eref &e)
vector< ObjId > getOutgoingMsgs(const Eref &e) const
unsigned int getIndex(const Eref &e) const
Index is the dataIndex of the object.
ostream & operator<<(ostream &s, const Neutral &d)
const unsigned int ALLDATA
Used by ObjId and Eref.
vector< Id > getChildren(const Eref &e) const
vector< ObjId > getIncomingMsgs(const Eref &e) const
const std::string & name() const
unsigned int getId(const Eref &e) const
Id is the Id of the object, converted to unsigned int.
static unsigned int myNode
static bool isDescendant(Id me, Id ancestor)
static void deleteMsg(ObjId mid)
ObjId findCaller(FuncId fid) const
unsigned int getNumData(const Eref &e) const
virtual unsigned int numField(unsigned int rawIndex) const =0
Returns number of field entries for specified data.
void setName(const Eref &e, string name)
void blockNodeBalance(const Eref &e, unsigned int, unsigned int, unsigned int)
virtual bool hasFields() const =0
vector< string > getSourceFields(const Eref &e) const
Information function to return names of all SrcFinfos.
bool isA(const string &ancestor) const
Finfo * getSrcFinfo(unsigned int i) const
const vector< MsgFuncBinding > * getMsgAndFunc(BindIndex b) const
const Cinfo * cinfo() const
string getClass(const Eref &e) const
virtual unsigned int numData() const =0
Returns number of data entries across all nodes.
void generalNodeBalance(const Eref &e, unsigned int myNode, vector< unsigned int > nodeAssignment)
Element * element() const
void destroy(const Eref &e, int stage)
static void destroyElementTree(const vector< Id > &tree)
int getTick(const Eref &e) const
Returns clock tick of this object.
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
virtual unsigned int rawIndex(unsigned int dataIndex) const =0
static const Msg * getMsg(ObjId m)
unsigned int numBindIndex() const
static const Cinfo * initCinfo()
string getName(const Eref &e) const
const string & getName() const
virtual void resizeField(unsigned int rawIndex, unsigned int newNumField)=0
void setNumField(const Eref &e, unsigned int num)
virtual void resize(unsigned int newNumData)=0
static bool isNameValid(const string &name)
const Finfo * findFinfo(const string &name) const