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

#include <Neutral.h>

+ Collaboration diagram for Neutral:

Public Member Functions

void blockNodeBalance (const Eref &e, unsigned int, unsigned int, unsigned int)
 
unsigned int buildTree (const Eref &e, vector< Id > &tree) const
 
void destroy (const Eref &e, int stage)
 
void generalNodeBalance (const Eref &e, unsigned int myNode, vector< unsigned int > nodeAssignment)
 
vector< IdgetChildren (const Eref &e) const
 
string getClass (const Eref &e) const
 
vector< string > getDestFields (const Eref &e) const
 Information function to return names of all DestFinfos. More...
 
double getDt (const Eref &e) const
 Returns dt associated with this object based on its clock tick. More...
 
unsigned int getFieldIndex (const Eref &e) const
 fieldIndex specifies field entry if FieldElement. Otherwise zero More...
 
unsigned int getId (const Eref &e) const
 Id is the Id of the object, converted to unsigned int. More...
 
vector< ObjIdgetIncomingMsgs (const Eref &e) const
 
unsigned int getIndex (const Eref &e) const
 Index is the dataIndex of the object. More...
 
vector< string > getMsgDestFunctions (const Eref &e, string src) const
 
vector< ObjIdgetMsgDests (const Eref &e, string src) const
 
string getName (const Eref &e) const
 
vector< IdgetNeighbors (const Eref &e, string field) const
 
unsigned int getNumData (const Eref &e) const
 
unsigned int getNumField (const Eref &e) const
 
ObjId getObjId (const Eref &e) const
 
vector< ObjIdgetOutgoingMsgs (const Eref &e) const
 
ObjId getParent (const Eref &e) const
 
string getPath (const Eref &e) const
 
vector< string > getSourceFields (const Eref &e) const
 Information function to return names of all SrcFinfos. More...
 
Neutral getThis () const
 
int getTick (const Eref &e) const
 Returns clock tick of this object. More...
 
vector< string > getValueFields (const Eref &e) const
 Information function to return names of all value Finfos. More...
 
bool isA (const Eref &e, string className) const
 
 Neutral ()
 
void setName (const Eref &e, string name)
 
void setNumData (const Eref &e, unsigned int num)
 
void setNumField (const Eref &e, unsigned int num)
 
void setThis (Neutral v)
 
void setTick (const Eref &e, int num)
 

Static Public Member Functions

static Id child (const Eref &e, const string &name)
 
static void children (const Eref &e, vector< Id > &ret)
 
static const CinfoinitCinfo ()
 
static bool isDescendant (Id me, Id ancestor)
 
static bool isGlobalField (const string &field)
 
static ObjId parent (const Eref &e)
 
static ObjId parent (ObjId id)
 
static string path (const Eref &e)
 

Friends

ostream & operator<< (ostream &s, const Neutral &d)
 
istream & operator>> (istream &s, Neutral &d)
 

Detailed Description

Definition at line 22 of file Neutral.h.

Constructor & Destructor Documentation

Neutral::Neutral ( )

Definition at line 273 of file Neutral.cpp.

275 {
276  ;
277 }

Member Function Documentation

void Neutral::blockNodeBalance ( const Eref e,
unsigned  int,
unsigned  int,
unsigned  int 
)

Request conversion of data into a blockDataHandler subclass, and to carry out node balancing of data as per args.

Definition at line 627 of file Neutral.cpp.

Referenced by initCinfo().

629 {
630 }

+ Here is the caller graph for this function:

unsigned int Neutral::buildTree ( const Eref e,
vector< Id > &  tree 
) const

Builds a vector of all descendants of e

Definition at line 583 of file Neutral.cpp.

References ALLDATA, Eref::element(), getChildren(), and Element::id().

Referenced by destroy(), and verifyKids().

585 {
586  unsigned int ret = 1;
587  Eref er( e.element(), ALLDATA );
588  vector< Id > kids = getChildren( er );
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 )
592  ret += buildTree( i->eref(), tree );
593  tree.push_back( e.element()->id() );
594  return ret;
595 }
Element * element() const
Definition: Eref.h:42
unsigned int buildTree(const Eref &e, vector< Id > &tree) const
Definition: Neutral.cpp:583
Id id() const
Definition: Element.cpp:71
const unsigned int ALLDATA
Used by ObjId and Eref.
Definition: consts.cpp:22
vector< Id > getChildren(const Eref &e) const
Definition: Neutral.cpp:334
Definition: Eref.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Id Neutral::child ( const Eref e,
const string &  name 
)
static

Finds specific named child

Definition at line 665 of file Neutral.cpp.

References ALLDATA, Eref::dataIndex(), Msg::e2(), Eref::element(), Cinfo::findFinfo(), Msg::findOtherEnd(), SrcFinfo::getBindIndex(), Msg::getE2(), DestFinfo::getFid(), Msg::getMsg(), Element::getMsgAndFunc(), Element::getName(), Element::hasFields(), Element::id(), name, Eref::objId(), and parent().

Referenced by ReadKkit::assignPoolCompartments(), buildFromProto(), ReadKkit::buildSumTotal(), SetGet::checkSet(), doClassSpecificMessaging(), Shell::doCopy(), Shell::doCreate(), Shell::doFind(), Shell::doMove(), setName(), Neuron::setSpineAndPsdMesh(), and testTreeTraversal().

666 {
667  static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
668  static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
669  static const FuncId pafid = pf2->getFid();
670  static const Finfo* cf = neutralCinfo->findFinfo( "childOut" );
671  static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf );
672  static const BindIndex bi = cf2->getBindIndex();
673 
674  const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi );
675 
676  vector< Id > ret;
677 
678  for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
679  i != bvec->end(); ++i ) {
680  if ( i->fid == pafid ) {
681  const Msg* m = Msg::getMsg( i->mid );
682  assert( m );
683  Element* e2 = m->e2();
684  if ( e2->getName() == name ) {
685  if ( e.dataIndex() == ALLDATA ) {// Child of any index is OK
686  return e2->id();
687  } else {
688  ObjId parent = m->findOtherEnd( m->getE2() );
689  // If child is a fieldElement, then all parent indices
690  // are permitted. Otherwise insist parent dataIndex OK.
691  if ( e2->hasFields() || parent == e.objId() )
692  return e2->id();
693  }
694  }
695  }
696  }
697  return Id();
698 }
virtual ObjId findOtherEnd(ObjId) const =0
Element * e2() const
Definition: Msg.h:68
static ObjId parent(const Eref &e)
Definition: Neutral.cpp:701
unsigned short BindIndex
Definition: header.h:62
BindIndex getBindIndex() const
Definition: SrcFinfo.cpp:28
unsigned int dataIndex() const
Definition: Eref.h:50
static const Cinfo * neutralCinfo
Definition: Neutral.cpp:270
Definition: ObjId.h:20
Element * element() const
Definition: Eref.h:42
Id id() const
Definition: Element.cpp:71
const unsigned int ALLDATA
Used by ObjId and Eref.
Definition: consts.cpp:22
FuncId getFid() const
Definition: DestFinfo.cpp:45
Id getE2() const
Definition: Msg.cpp:75
virtual bool hasFields() const =0
ObjId objId() const
Definition: Eref.cpp:57
const vector< MsgFuncBinding > * getMsgAndFunc(BindIndex b) const
Definition: Element.cpp:300
Definition: Msg.h:18
static char name[]
Definition: mfield.cpp:401
Definition: Id.h:17
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59
unsigned int FuncId
Definition: header.h:42
const string & getName() const
Definition: Element.cpp:56
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::children ( const Eref e,
vector< Id > &  ret 
)
static

return ids of all the children in ret.

Definition at line 342 of file Neutral.cpp.

References ALLDATA, Eref::dataIndex(), Eref::element(), Cinfo::findFinfo(), SrcFinfo::getBindIndex(), DestFinfo::getFid(), Msg::getMsg(), Element::getMsgAndFunc(), and Msg::targets().

Referenced by ReadCell::addChannelMessage(), addSpine(), allChildren(), Neuron::buildSegmentTree(), checkChildren(), Cell::children(), HSolve::children(), Shell::cleanSimulation(), ReadCspace::deployParameters(), ChemCompt::getChildConcs(), getChildren(), hasScaleFormula(), initCinfo(), innerCopyElements(), ReadCspace::makePlots(), ChemCompt::setChildConcs(), singleLevelWildcard(), testCopyFieldElement(), testTable(), and verifyKids().

343 {
344  /*
345  vector< Id > temp;
346  getNeighbors( ret, neutralCinfo->findFinfo( "childOut" ) );
347  for ( vector< Id >::iterator i = temp.begin(); i != temp.end(); ++i ) {
348  if ( ret
349  }
350  */
351 
352 
353 
354  static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
355  static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
356  static const FuncId pafid = pf2->getFid();
357  static const Finfo* cf = neutralCinfo->findFinfo( "childOut" );
358  static const SrcFinfo* cf2 = dynamic_cast< const SrcFinfo* >( cf );
359  static const BindIndex bi = cf2->getBindIndex();
360 
361  const vector< MsgFuncBinding >* bvec = e.element()->getMsgAndFunc( bi );
362 
363  for ( vector< MsgFuncBinding >::const_iterator i = bvec->begin();
364  i != bvec->end(); ++i ) {
365  if ( i->fid == pafid ) {
366  const Msg* m = Msg::getMsg( i->mid );
367  assert( m );
368  vector< vector< Eref > > kids;
369  m->targets( kids );
370  if ( e.dataIndex() == ALLDATA ) {
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() );
376  }
377  } else {
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() );
382  }
383  }
384  }
385 }
unsigned short BindIndex
Definition: header.h:62
BindIndex getBindIndex() const
Definition: SrcFinfo.cpp:28
unsigned int dataIndex() const
Definition: Eref.h:50
static const Cinfo * neutralCinfo
Definition: Neutral.cpp:270
Element * element() const
Definition: Eref.h:42
virtual void targets(vector< vector< Eref > > &v) const =0
const unsigned int ALLDATA
Used by ObjId and Eref.
Definition: consts.cpp:22
FuncId getFid() const
Definition: DestFinfo.cpp:45
const vector< MsgFuncBinding > * getMsgAndFunc(BindIndex b) const
Definition: Element.cpp:300
Definition: Msg.h:18
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59
unsigned int FuncId
Definition: header.h:42
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::destroy ( const Eref e,
int  stage 
)

Destroys Element and all children

Definition at line 605 of file Neutral.cpp.

References ALLDATA, buildTree(), Element::cinfo(), Msg::deleteMsg(), Element::destroyElementTree(), Eref::element(), Cinfo::isA(), and Eref::objId().

Referenced by Shell::destroy(), and initCinfo().

606 {
607  if ( e.element()->cinfo()->isA( "Msg" ) ) {
608  Msg::deleteMsg( e.objId() );
609  return;
610  }
611  vector< Id > tree;
612  Eref er( e.element(), ALLDATA );
613  unsigned int numDescendants = buildTree( er, tree );
614  /*
615  cout << "Neutral::destroy: id = " << e.id() <<
616  ", name = " << e.element()->getName() <<
617  ", numDescendants = " << numDescendants << endl;
618  */
619  assert( numDescendants == tree.size() );
621 }
Element * element() const
Definition: Eref.h:42
unsigned int buildTree(const Eref &e, vector< Id > &tree) const
Definition: Neutral.cpp:583
const unsigned int ALLDATA
Used by ObjId and Eref.
Definition: consts.cpp:22
static void deleteMsg(ObjId mid)
Definition: Msg.cpp:52
ObjId objId() const
Definition: Eref.cpp:57
Definition: Eref.h:26
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
const Cinfo * cinfo() const
Definition: Element.cpp:66
static void destroyElementTree(const vector< Id > &tree)
Definition: Element.cpp:676

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::generalNodeBalance ( const Eref e,
unsigned int  myNode,
vector< unsigned int >  nodeAssignment 
)

Request conversion of data into a generalDataHandler subclass, and to carry out node balancing of data as per args.

Definition at line 636 of file Neutral.cpp.

Referenced by initCinfo().

638 {
639 }

+ Here is the caller graph for this function:

vector< Id > Neutral::getChildren ( const Eref e) const

Looks up all the Element children of the current Element

Gets Element children, not individual entries in the array.

Definition at line 334 of file Neutral.cpp.

References children().

Referenced by buildTree(), initCinfo(), testCopy(), and testMove().

335 {
336  vector< Id > ret;
337  children( e, ret );
338  return ret;
339 }
static void children(const Eref &e, vector< Id > &ret)
Definition: Neutral.cpp:342

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string Neutral::getClass ( const Eref e) const

Looks up the Class name of the current Element

Definition at line 393 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), and Cinfo::name().

Referenced by initCinfo().

394 {
395  return e.element()->cinfo()->name();
396 }
Element * element() const
Definition: Eref.h:42
const std::string & name() const
Definition: Cinfo.cpp:260
const Cinfo * cinfo() const
Definition: Element.cpp:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< string > Neutral::getDestFields ( const Eref e) const

Information function to return names of all DestFinfos.

Definition at line 481 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), Cinfo::getDestFinfo(), Cinfo::getNumDestFinfo(), and Finfo::name().

Referenced by initCinfo().

482 {
483  unsigned int num = e.element()->cinfo()->getNumDestFinfo();
484  vector< string > ret( num );
485  for ( unsigned int i = 0; i < num; ++i ) {
486  const Finfo *f = e.element()->cinfo()->getDestFinfo( i );
487  assert( f );
488  ret[i] = f->name();
489  }
490  return ret;
491 }
Finfo * getDestFinfo(unsigned int i) const
Definition: Cinfo.cpp:430
unsigned int getNumDestFinfo() const
Definition: Cinfo.cpp:444
const string & name() const
Definition: Finfo.cpp:80
Element * element() const
Definition: Eref.h:42
const Cinfo * cinfo() const
Definition: Element.cpp:66
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double Neutral::getDt ( const Eref e) const

Returns dt associated with this object based on its clock tick.

Definition at line 447 of file Neutral.cpp.

References Eref::element(), LookupField< L, A >::get(), and Element::getTick().

Referenced by initCinfo().

448 {
449  int tick = e.element()->getTick();
450  if ( tick < 0 )
451  return 0.0;
452  Id clockId( 1 );
454  clockId, "tickDt", tick );
455 }
static A get(const ObjId &dest, const string &field, L index)
Definition: SetGet.h:532
Element * element() const
Definition: Eref.h:42
int getTick() const
Definition: Element.cpp:186
Definition: Id.h:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int Neutral::getFieldIndex ( const Eref e) const

fieldIndex specifies field entry if FieldElement. Otherwise zero

Definition at line 432 of file Neutral.cpp.

References Eref::fieldIndex().

Referenced by initCinfo().

433 {
434  return e.fieldIndex();
435 }
unsigned int fieldIndex() const
Definition: Eref.h:61

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int Neutral::getId ( const Eref e) const

Id is the Id of the object, converted to unsigned int.

Definition at line 422 of file Neutral.cpp.

References Eref::id(), and Id::value().

Referenced by initCinfo().

423 {
424  return e.id().value();
425 }
Id id() const
Definition: Eref.cpp:62
unsigned int value() const
Definition: Id.cpp:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< ObjId > Neutral::getIncomingMsgs ( const Eref e) const

Readonly field access function for getting all incoming Msgs.

Definition at line 511 of file Neutral.cpp.

References Msg::e2(), Eref::element(), Msg::getMsg(), Msg::mid(), and Element::msgIn().

Referenced by initCinfo().

512 {
513  vector< ObjId > ret;
514  const vector< ObjId >& msgIn = e.element()->msgIn();
515 
516  for (unsigned int i = 0; i < msgIn.size(); ++i ) {
517  const Msg* m = Msg::getMsg( msgIn[i] );
518  assert( m );
519  if ( m->e2() == e.element() )
520  ret.push_back( m->mid() );
521  }
522  return ret;
523 }
const vector< ObjId > & msgIn() const
Definition: Element.cpp:387
Element * e2() const
Definition: Msg.h:68
ObjId mid() const
Definition: Msg.h:106
Element * element() const
Definition: Eref.h:42
Definition: Msg.h:18
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int Neutral::getIndex ( const Eref e) const

Index is the dataIndex of the object.

Definition at line 427 of file Neutral.cpp.

References Eref::dataIndex().

Referenced by initCinfo().

428 {
429  return e.dataIndex();
430 }
unsigned int dataIndex() const
Definition: Eref.h:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< string > Neutral::getMsgDestFunctions ( const Eref e,
string  src 
) const

Return vector of function names called on each target ObjId of the specified SrcFinfo, by the current object. Twin function to getMsgDests.

Definition at line 557 of file Neutral.cpp.

References Element::cinfo(), Eref::dataIndex(), Eref::element(), Cinfo::findFinfo(), Element::getMsgTargetAndFunctions(), Eref::id(), and Id::path().

Referenced by initCinfo().

558 {
559  vector< string > ret( 0 );
560  const Finfo* finfo = e.element()->cinfo()->findFinfo( field );
561  const SrcFinfo* sf = dynamic_cast< const SrcFinfo* >( finfo );
562  if ( sf ) {
563  vector< ObjId > tgt;
564  vector< string > func;
566  tgt, func );
567  return func;
568  } else {
569  cout << "Warning: Neutral::getMsgDestFunctions: Id.Field '" <<
570  e.id().path() << "." << field <<
571  "' not found or not a SrcFinfo\n";
572  }
573  return ret;
574 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
unsigned int dataIndex() const
Definition: Eref.h:50
unsigned int getMsgTargetAndFunctions(DataId srcDataId, const SrcFinfo *finfo, vector< ObjId > &tgt, vector< string > &func) const
Definition: Element.cpp:772
Element * element() const
Definition: Eref.h:42
const Cinfo * cinfo() const
Definition: Element.cpp:66
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< ObjId > Neutral::getMsgDests ( const Eref e,
string  src 
) const

Return vector of target ObjIds called by the specified SrcFinfo, by the current object. Twin function to getMsgDestFunctions.

Definition at line 538 of file Neutral.cpp.

References Element::cinfo(), Eref::dataIndex(), Eref::element(), Cinfo::findFinfo(), Element::getMsgTargetAndFunctions(), Eref::id(), and Id::path().

Referenced by initCinfo().

539 {
540  const Finfo* finfo = e.element()->cinfo()->findFinfo( field );
541  const SrcFinfo* sf = dynamic_cast< const SrcFinfo* >( finfo );
542  if ( sf ) {
543  vector< ObjId > tgt;
544  vector< string > func;
546  tgt, func );
547  return tgt;
548  } else {
549  cout << "Warning: Neutral::getMsgDests: Id.Field '" <<
550  e.id().path() << "." << field <<
551  "' not found or not a SrcFinfo\n";
552  }
553  static vector< ObjId > ret( 0 );
554  return ret;
555 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
unsigned int dataIndex() const
Definition: Eref.h:50
unsigned int getMsgTargetAndFunctions(DataId srcDataId, const SrcFinfo *finfo, vector< ObjId > &tgt, vector< string > &func) const
Definition: Element.cpp:772
Element * element() const
Definition: Eref.h:42
const Cinfo * cinfo() const
Definition: Element.cpp:66
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string Neutral::getName ( const Eref e) const

Definition at line 316 of file Neutral.cpp.

References Eref::element(), and Element::getName().

Referenced by initCinfo().

317 {
318  return e.element()->getName();
319 }
Element * element() const
Definition: Eref.h:42
const string & getName() const
Definition: Element.cpp:56

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< Id > Neutral::getNeighbors ( const Eref e,
string  field 
) const

Readonly field access function for getting Ids connected to current Id via specified Field. Field is specified by its name. Returns an empty vector if it fails.

Definition at line 525 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), Cinfo::findFinfo(), Element::getNeighbors(), Eref::id(), and Id::path().

Referenced by initCinfo().

526 {
527  vector< Id > ret;
528  const Finfo* finfo = e.element()->cinfo()->findFinfo( field );
529  if ( finfo )
530  e.element()->getNeighbors( ret, finfo );
531  else
532  cout << "Warning: Neutral::getNeighbors: Id.Field '" <<
533  e.id().path() << "." << field <<
534  "' not found\n";
535  return ret;
536 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
Element * element() const
Definition: Eref.h:42
const Cinfo * cinfo() const
Definition: Element.cpp:66
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int Neutral::getNumData ( const Eref e) const

Definition at line 398 of file Neutral.cpp.

References Eref::element(), and Element::numData().

Referenced by initCinfo().

399 {
400  return e.element()->numData();
401 }
Element * element() const
Definition: Eref.h:42
virtual unsigned int numData() const =0
Returns number of data entries across all nodes.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int Neutral::getNumField ( const Eref e) const

Definition at line 408 of file Neutral.cpp.

References Eref::dataIndex(), Eref::element(), Eref::isDataHere(), Element::numField(), and Element::rawIndex().

Referenced by initCinfo().

409 {
410  assert( e.isDataHere() );
411  unsigned int rawIndex = e.element()->rawIndex( e.dataIndex() );
412  return e.element()->numField( rawIndex );
413 }
bool isDataHere() const
Definition: Eref.cpp:47
unsigned int dataIndex() const
Definition: Eref.h:50
Element * element() const
Definition: Eref.h:42
virtual unsigned int numField(unsigned int rawIndex) const =0
Returns number of field entries for specified data.
virtual unsigned int rawIndex(unsigned int dataIndex) const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjId Neutral::getObjId ( const Eref e) const

Simply returns own ObjId

Definition at line 321 of file Neutral.cpp.

References Eref::objId().

Referenced by initCinfo().

322 {
323  return e.objId();
324 }
ObjId objId() const
Definition: Eref.cpp:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< ObjId > Neutral::getOutgoingMsgs ( const Eref e) const

Readonly field access function for getting all outgoing Msgs.

Definition at line 493 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), Element::getMsgAndFunc(), and Cinfo::numBindIndex().

Referenced by initCinfo().

494 {
495  vector< ObjId > ret;
496  unsigned int numBindIndex = e.element()->cinfo()->numBindIndex();
497 
498  for ( unsigned int i = 0; i < numBindIndex; ++i ) {
499  const vector< MsgFuncBinding >* v =
500  e.element()->getMsgAndFunc( i );
501  if ( v ) {
502  for ( vector< MsgFuncBinding >::const_iterator mb = v->begin();
503  mb != v->end(); ++mb ) {
504  ret.push_back( mb->mid );
505  }
506  }
507  }
508  return ret;
509 }
Element * element() const
Definition: Eref.h:42
const vector< MsgFuncBinding > * getMsgAndFunc(BindIndex b) const
Definition: Element.cpp:300
const Cinfo * cinfo() const
Definition: Element.cpp:66
unsigned int numBindIndex() const
Definition: Cinfo.cpp:265

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjId Neutral::getParent ( const Eref e) const

Looks up the full Id info for the parent of the current Element

Definition at line 326 of file Neutral.cpp.

References parent().

Referenced by initCinfo(), and testCopy().

327 {
328  return parent( e );
329 }
static ObjId parent(const Eref &e)
Definition: Neutral.cpp:701

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string Neutral::getPath ( const Eref e) const

Traverses to root, building path.

Definition at line 388 of file Neutral.cpp.

References path().

Referenced by initCinfo().

389 {
390  return path( e );
391 }
static string path(const Eref &e)
Definition: Neutral.cpp:725

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< string > Neutral::getSourceFields ( const Eref e) const

Information function to return names of all SrcFinfos.

Definition at line 469 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), Cinfo::getNumSrcFinfo(), Cinfo::getSrcFinfo(), and Finfo::name().

Referenced by initCinfo().

470 {
471  unsigned int num = e.element()->cinfo()->getNumSrcFinfo();
472  vector< string > ret( num );
473  for ( unsigned int i = 0; i < num; ++i ) {
474  const Finfo *f = e.element()->cinfo()->getSrcFinfo( i );
475  assert( f );
476  ret[i] = f->name();
477  }
478  return ret;
479 }
unsigned int getNumSrcFinfo() const
Definition: Cinfo.cpp:421
const string & name() const
Definition: Finfo.cpp:80
Element * element() const
Definition: Eref.h:42
Finfo * getSrcFinfo(unsigned int i) const
Definition: Cinfo.cpp:406
const Cinfo * cinfo() const
Definition: Element.cpp:66
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Neutral Neutral::getThis ( ) const

Field access functions for the entire object. For Neutrals the getThis function does return the Neutral object, but it has no data to set. However, the function name acts as a placeholder and derived objects can override the function so that the entire object can be accessed as a field and also used for inter-node data transfer.

Definition at line 289 of file Neutral.cpp.

Referenced by initCinfo().

290 {
291  return *this;
292 }

+ Here is the caller graph for this function:

int Neutral::getTick ( const Eref e) const

Returns clock tick of this object.

Definition at line 437 of file Neutral.cpp.

References Eref::element(), and Element::getTick().

Referenced by initCinfo().

438 {
439  return e.element()->getTick();
440 }
Element * element() const
Definition: Eref.h:42
int getTick() const
Definition: Element.cpp:186

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector< string > Neutral::getValueFields ( const Eref e) const

Information function to return names of all value Finfos.

Definition at line 457 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), Cinfo::getNumValueFinfo(), Cinfo::getValueFinfo(), and Finfo::name().

Referenced by initCinfo().

458 {
459  unsigned int num = e.element()->cinfo()->getNumValueFinfo();
460  vector< string > ret( num );
461  for ( unsigned int i = 0; i < num; ++i ) {
462  const Finfo *f = e.element()->cinfo()->getValueFinfo( i );
463  assert( f );
464  ret[i] = f->name();
465  }
466  return ret;
467 }
Finfo * getValueFinfo(unsigned int i) const
Definition: Cinfo.cpp:453
unsigned int getNumValueFinfo() const
Definition: Cinfo.cpp:467
const string & name() const
Definition: Finfo.cpp:80
Element * element() const
Definition: Eref.h:42
const Cinfo * cinfo() const
Definition: Element.cpp:66
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Cinfo * Neutral::initCinfo ( )
static

Standard initialization function, used whenever we want to look up the class Cinfo

Definition at line 16 of file Neutral.cpp.

References blockNodeBalance(), children(), destroy(), generalNodeBalance(), getChildren(), getClass(), getDestFields(), getDt(), getFieldIndex(), getId(), getIncomingMsgs(), getIndex(), getMsgDestFunctions(), getMsgDests(), getName(), getNeighbors(), getNumData(), getNumField(), getObjId(), getOutgoingMsgs(), getParent(), getPath(), getSourceFields(), getThis(), getTick(), getValueFields(), id, isA(), name, neutralCinfo, parent(), path(), setName(), setNumData(), setNumField(), setThis(), and setTick().

Referenced by Shell::adopt(), init(), Group::initCinfo(), Boundary::initCinfo(), Mstring::initCinfo(), MMPump::initCinfo(), Species::initCinfo(), Synapse::initCinfo(), RandSpike::initCinfo(), Annotator::initCinfo(), ConcChan::initCinfo(), VectorTable::initCinfo(), SpikeGen::initCinfo(), IntFire::initCinfo(), Nernst::initCinfo(), DiffAmp::initCinfo(), Stats::initCinfo(), MarkovGslSolver::initCinfo(), Arith::initCinfo(), RC::initCinfo(), TableBase::initCinfo(), Cell::initCinfo(), PIDController::initCinfo(), GapJunction::initCinfo(), EnzBase::initCinfo(), ChanBase::initCinfo(), Spine::initCinfo(), moose::VClamp::initCinfo(), Variable::initCinfo(), ReacBase::initCinfo(), SynHandlerBase::initCinfo(), IzhikevichNrn::initCinfo(), SteadyState::initCinfo(), HHGate2D::initCinfo(), Clock::initCinfo(), Interpol2D::initCinfo(), Func::initCinfo(), Neuron::initCinfo(), PyRun::initCinfo(), MarkovSolverBase::initCinfo(), PulseGen::initCinfo(), CaConcBase::initCinfo(), DifBufferBase::initCinfo(), MeshEntry::initCinfo(), DifShellBase::initCinfo(), Ksolve::initCinfo(), Gsolve::initCinfo(), Function::initCinfo(), Finfo::initCinfo(), MarkovRateTable::initCinfo(), HSolve::initCinfo(), PoolBase::initCinfo(), PostMaster::initCinfo(), Msg::initCinfo(), Adaptor::initCinfo(), HHGate::initCinfo(), Dsolve::initCinfo(), moose::CompartmentBase::initCinfo(), Cinfo::initCinfo(), ChemCompt::initCinfo(), Stoich::initCinfo(), Shell::initCinfo(), TestId::initCinfo(), Msg::initMsgManagers(), innerCopyMsgs(), Shell::innerMove(), Cinfo::isA(), FieldElementFinfoBase::postCreationFunc(), showFields(), testCinfoFields(), testFinfoFields(), testIsA(), and testSetGetExtField().

17 {
19  // Element Value Finfos
21 
23  "name",
24  "Name of object",
27 
28  // Should be renamed to myId
30  "me",
31  "ObjId for current object",
33 
35  "parent",
36  "Parent ObjId for current object",
38 
40  "children",
41  "vector of ObjIds listing all children of current object",
43 
45  "path",
46  "text path for object",
48 
49  /*
50  */
52  "className",
53  "Class Name of object",
55 
57  "numData",
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 "
61  "FieldElement.",
64 
66  "numField",
67  "For a FieldElement: number of entries of self."
68  "For a regular Element: One.",
71 
73  "idValue",
74  "Object id of self, converted to an unsigned int.",
75  &Neutral::getId );
76 
78  "index",
79  "For a FieldElement: Object index of parent."
80  "For a regular Element: Object index (dataId) of self.",
82 
84  "fieldIndex",
85  "For a FieldElement: field Index of self."
86  "For a regular Element: zero.",
88 
90  tick(
91  "tick",
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.",
100  &Neutral::getTick );
101 
103  dt(
104  "dt",
105  "Timestep used for this Element. Zero if not scheduled.",
106  &Neutral::getDt );
107 
108 
110  valueFields(
111  "valueFields",
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.",
118  );
119 
121  sourceFields(
122  "sourceFields",
123  "List of all source fields on Element, that is fields that "
124  "can act as message sources. ",
126  );
127 
129  destFields(
130  "destFields",
131  "List of all destination fields on Element, that is, fields"
132  "that are accessed as Element functions.",
134  );
135 
137  "msgOut",
138  "Messages going out from this Element",
140 
142  "msgIn",
143  "Messages coming in to this Element",
145 
147  "neighbors",
148  "Ids of Elements connected this Element on specified field.",
150 
152  "msgDests",
153  "ObjIds receiving messages from the specified SrcFinfo",
155 
157  "msgDestFunctions",
158  "Matching function names for each ObjId receiving a msg from "
159  "the specified SrcFinfo",
161 
163  "isA",
164  "Returns true if the current object is derived from the specified "
165  "the specified class",
166  &Neutral::isA );
167 
169  // Value Finfos
171  static ValueFinfo< Neutral, Neutral > thisFinfo (
172  "this",
173  "Access function for entire object",
176  );
178  // SrcFinfos
180  static SrcFinfo1< int > childOut( "childOut",
181  "Message to child Elements");
182 
184  // DestFinfos
186  static DestFinfo parentMsg( "parentMsg",
187  "Message from Parent Element(s)",
189 
190  static DestFinfo blockNodeBalance( "blockNodeBalance",
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",
202 
203  static DestFinfo generalNodeBalance( "generalNodeBalance",
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",
210  new EpFunc2< Neutral, unsigned int, vector< unsigned int > >(
212 
214  // Setting up the Finfo list.
216  static Finfo* neutralFinfos[] = {
217  &childOut, // SrcFinfo
218  &parentMsg, // DestFinfo
219  &thisFinfo, // Value
220  &name, // Value
221  &me, // ReadOnlyValue
222  &parent, // ReadOnlyValue
223  &children, // ReadOnlyValue
224  &path, // ReadOnlyValue
225  &className, // ReadOnlyValue
226  &numData, // Value
227  &numField, // Value
228  &id, // ReadOnlyValue
229  &index, // ReadOnlyValue
230  &fieldIndex, // ReadOnlyValue
231  &tick, // Value
232  &dt, // ReadOnlyValue
233  &valueFields, // ReadOnlyValue
234  &sourceFields, // ReadOnlyValue
235  &destFields, // ReadOnlyValue
236  &msgOut, // ReadOnlyValue
237  &msgIn, // ReadOnlyValue
238  &neighbors, // ReadOnlyLookupValue
239  &msgDests, // ReadOnlyLookupValue
240  &msgDestFunctions, // ReadOnlyLookupValue
241  &isA, // ReadOnlyLookupValue
242  };
243 
245  // Setting up the Cinfo.
247 
248  static string doc[] =
249  {
250  "Name", "Neutral",
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."
255  };
256  static Dinfo< Neutral > dinfo;
257  static Cinfo neutralCinfo (
258  "Neutral",
259  0, // No base class.
260  neutralFinfos,
261  sizeof( neutralFinfos ) / sizeof( Finfo* ),
262  &dinfo,
263  doc,
264  sizeof(doc)/sizeof(string)
265  );
266 
267  return &neutralCinfo;
268 }
bool isA(const Eref &e, string className) const
Definition: Neutral.cpp:576
unsigned int getNumField(const Eref &e) const
Definition: Neutral.cpp:408
static ObjId parent(const Eref &e)
Definition: Neutral.cpp:701
ObjId getParent(const Eref &e) const
Definition: Neutral.cpp:326
vector< ObjId > getMsgDests(const Eref &e, string src) const
Definition: Neutral.cpp:538
unsigned int getFieldIndex(const Eref &e) const
fieldIndex specifies field entry if FieldElement. Otherwise zero
Definition: Neutral.cpp:432
ObjId getObjId(const Eref &e) const
Definition: Neutral.cpp:321
string getPath(const Eref &e) const
Definition: Neutral.cpp:388
Definition: Dinfo.h:60
void setTick(const Eref &e, int num)
Definition: Neutral.cpp:442
Definition: EpFunc.h:64
void setNumData(const Eref &e, unsigned int num)
Definition: Neutral.cpp:403
double getDt(const Eref &e) const
Returns dt associated with this object based on its clock tick.
Definition: Neutral.cpp:447
vector< string > getDestFields(const Eref &e) const
Information function to return names of all DestFinfos.
Definition: Neutral.cpp:481
static const Cinfo * neutralCinfo
Definition: Neutral.cpp:270
vector< string > getMsgDestFunctions(const Eref &e, string src) const
Definition: Neutral.cpp:557
static void children(const Eref &e, vector< Id > &ret)
Definition: Neutral.cpp:342
vector< Id > getNeighbors(const Eref &e, string field) const
Definition: Neutral.cpp:525
vector< string > getValueFields(const Eref &e) const
Information function to return names of all value Finfos.
Definition: Neutral.cpp:457
static string path(const Eref &e)
Definition: Neutral.cpp:725
Definition: EpFunc.h:95
vector< ObjId > getOutgoingMsgs(const Eref &e) const
Definition: Neutral.cpp:493
unsigned int getIndex(const Eref &e) const
Index is the dataIndex of the object.
Definition: Neutral.cpp:427
vector< Id > getChildren(const Eref &e) const
Definition: Neutral.cpp:334
vector< ObjId > getIncomingMsgs(const Eref &e) const
Definition: Neutral.cpp:511
unsigned int getId(const Eref &e) const
Id is the Id of the object, converted to unsigned int.
Definition: Neutral.cpp:422
unsigned int getNumData(const Eref &e) const
Definition: Neutral.cpp:398
void setName(const Eref &e, string name)
Definition: Neutral.cpp:294
void blockNodeBalance(const Eref &e, unsigned int, unsigned int, unsigned int)
Definition: Neutral.cpp:627
vector< string > getSourceFields(const Eref &e) const
Information function to return names of all SrcFinfos.
Definition: Neutral.cpp:469
string getClass(const Eref &e) const
Definition: Neutral.cpp:393
void generalNodeBalance(const Eref &e, unsigned int myNode, vector< unsigned int > nodeAssignment)
Definition: Neutral.cpp:636
void destroy(const Eref &e, int stage)
Definition: Neutral.cpp:605
static char name[]
Definition: mfield.cpp:401
int getTick(const Eref &e) const
Returns clock tick of this object.
Definition: Neutral.cpp:437
void setThis(Neutral v)
Definition: Neutral.cpp:284
string getName(const Eref &e) const
Definition: Neutral.cpp:316
Neutral getThis() const
Definition: Neutral.cpp:289
static char id[]
Definition: mfield.cpp:404
void setNumField(const Eref &e, unsigned int num)
Definition: Neutral.cpp:415
Definition: Cinfo.h:18
Definition: EpFunc.h:79
Definition: Finfo.h:12

+ Here is the call graph for this function:

bool Neutral::isA ( const Eref e,
string  className 
) const

Returns True if the object is derived from the specified class

Definition at line 576 of file Neutral.cpp.

References Element::cinfo(), Eref::element(), and Cinfo::isA().

Referenced by initCinfo().

577 {
578  return e.element()->cinfo()->isA( className );
579 }
Element * element() const
Definition: Eref.h:42
bool isA(const string &ancestor) const
Definition: Cinfo.cpp:280
const Cinfo * cinfo() const
Definition: Element.cpp:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Neutral::isDescendant ( Id  me,
Id  ancestor 
)
static

Checks if 'me' is a descendant of 'ancestor'

Definition at line 647 of file Neutral.cpp.

References Eref::element(), ObjId::eref(), Id::eref(), Element::findCaller(), Cinfo::findFinfo(), Msg::findOtherEnd(), DestFinfo::getFid(), Msg::getMsg(), Element::id(), and Eref::objId().

Referenced by Shell::doCopy(), Shell::doMove(), and testDescendant().

648 {
649  static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
650  static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
651  static const FuncId pafid = pf2->getFid();
652 
653  Eref e = me.eref();
654 
655  while ( e.element()->id() != Id() && e.element()->id() != ancestor ) {
656  ObjId mid = e.element()->findCaller( pafid );
657  assert( mid != ObjId() );
658  ObjId fid = Msg::getMsg( mid )->findOtherEnd( e.objId() );
659  e = fid.eref();
660  }
661  return ( e.element()->id() == ancestor );
662 }
virtual ObjId findOtherEnd(ObjId) const =0
static const Cinfo * neutralCinfo
Definition: Neutral.cpp:270
Definition: ObjId.h:20
Eref eref() const
Definition: Id.cpp:125
Element * element() const
Definition: Eref.h:42
Id id() const
Definition: Element.cpp:71
ObjId findCaller(FuncId fid) const
Definition: Element.cpp:350
FuncId getFid() const
Definition: DestFinfo.cpp:45
ObjId objId() const
Definition: Eref.cpp:57
Definition: Eref.h:26
Eref eref() const
Definition: ObjId.cpp:66
Definition: Id.h:17
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59
unsigned int FuncId
Definition: header.h:42
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Neutral::isGlobalField ( const string &  field)
static

Checks if specified field is a global, typically because it is present on the Element and therefore should be assigned uniformly on all nodes

Definition at line 781 of file Neutral.cpp.

782 {
783  if ( field.length() < 8 )
784  return 0;
785  if ( field.substr( 0, 4 ) == "set_" ) {
786  if ( field == "set_name" )
787  return 1;
788  if ( field == "set_group" )
789  return 1;
790  if ( field == "set_lastDimension" ) // This is the critical one!
791  return 1;
792  }
793  return 0;
794 }
ObjId Neutral::parent ( const Eref e)
static

Returns parent object

Definition at line 701 of file Neutral.cpp.

References Eref::objId().

Referenced by Synapse::addMsgCallback(), addSpine(), child(), doClassSpecificMessaging(), Shell::doFind(), Synapse::dropMsgCallback(), findModelParent(), getCompt(), getParent(), initCinfo(), innerCopyElements(), ReadCspace::printMol(), MeshEntry::reinit(), setName(), storeFunctionMsgs(), and testObjIdToAndFromPath().

702 {
703  return Neutral::parent( e.objId() );
704 }
static ObjId parent(const Eref &e)
Definition: Neutral.cpp:701
ObjId objId() const
Definition: Eref.cpp:57

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjId Neutral::parent ( ObjId  id)
static

Definition at line 706 of file Neutral.cpp.

References ObjId::element(), Element::findCaller(), Cinfo::findFinfo(), Msg::findOtherEnd(), DestFinfo::getFid(), Msg::getMsg(), and ObjId::id.

707 {
708  static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
709  static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
710  static const FuncId pafid = pf2->getFid();
711 
712  if ( oid.id == Id() ) {
713  cout << "Warning: Neutral::parent: tried to take parent of root\n";
714  return Id();
715  }
716 
717  ObjId mid = oid.element()->findCaller( pafid );
718  assert( mid != ObjId() );
719 
720  ObjId pa = Msg::getMsg( mid )->findOtherEnd( oid );
721  return pa;
722 }
virtual ObjId findOtherEnd(ObjId) const =0
static const Cinfo * neutralCinfo
Definition: Neutral.cpp:270
Definition: ObjId.h:20
ObjId findCaller(FuncId fid) const
Definition: Element.cpp:350
FuncId getFid() const
Definition: DestFinfo.cpp:45
Element * element() const
Definition: ObjId.cpp:124
Definition: Id.h:17
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59
unsigned int FuncId
Definition: header.h:42
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:

string Neutral::path ( const Eref e)
static

Finds the path of element e

Definition at line 725 of file Neutral.cpp.

References ObjId::dataIndex, Eref::element(), ObjId::element(), ObjId::eref(), Eref::fieldIndex(), Element::findCaller(), Cinfo::findFinfo(), Msg::findOtherEnd(), DestFinfo::getFid(), Msg::getMsg(), Element::getName(), Element::hasFields(), ObjId::id, and Eref::objId().

Referenced by getPath(), initCinfo(), ObjId::path(), and Id::path().

726 {
727  static const Finfo* pf = neutralCinfo->findFinfo( "parentMsg" );
728  static const DestFinfo* pf2 = dynamic_cast< const DestFinfo* >( pf );
729  static const FuncId pafid = pf2->getFid();
730 
731  vector< ObjId > pathVec;
732  ObjId curr = e.objId();
733  stringstream ss;
734 
735  pathVec.push_back( curr );
736  while ( curr.id != Id() ) {
737  ObjId mid = curr.eref().element()->findCaller( pafid );
738  if ( mid == ObjId() ) {
739  cout << "Error: Neutral::path:Cannot follow msg of ObjId: " <<
740  e.objId() << " for func: " << pafid << endl;
741  break;
742  }
743  curr = Msg::getMsg( mid )->findOtherEnd( curr );
744  pathVec.push_back( curr );
745  }
746  if ( pathVec.size() <= 1 )
747  return "/";
748  for ( unsigned int i = 1; i < pathVec.size(); ++i ) {
749  ss << "/";
750  ObjId& oid = pathVec[ pathVec.size() - i - 1 ];
751  ss << oid.element()->getName();
752  if ( !oid.element()->hasFields() )
753  ss << "[" << oid.dataIndex << "]";
754  /*
755  if ( !oid.element()->hasFields() )
756  ss << "[" << oid.dataIndex << "]";
757  if ( oid.element()->numData() > 1 )
758  ss << "[" << oid.dataIndex << "]";
759  */
760  }
761  // Append braces if Eref was for a fieldElement. This should
762  // work even if it is off-node.
763  if ( e.element()->hasFields() ) {
764  ss << "[" << e.fieldIndex() << "]";
765  }
766 
767  return ss.str();
768 }
virtual ObjId findOtherEnd(ObjId) const =0
Id id
Definition: ObjId.h:98
static const Cinfo * neutralCinfo
Definition: Neutral.cpp:270
Definition: ObjId.h:20
Element * element() const
Definition: Eref.h:42
unsigned int fieldIndex() const
Definition: Eref.h:61
ObjId findCaller(FuncId fid) const
Definition: Element.cpp:350
FuncId getFid() const
Definition: DestFinfo.cpp:45
virtual bool hasFields() const =0
ObjId objId() const
Definition: Eref.cpp:57
Element * element() const
Definition: ObjId.cpp:124
Eref eref() const
Definition: ObjId.cpp:66
Definition: Id.h:17
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59
unsigned int FuncId
Definition: header.h:42
const string & getName() const
Definition: Element.cpp:56
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
unsigned int dataIndex
Definition: ObjId.h:99
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::setName ( const Eref e,
string  name 
)

Field access functions for the name of the Element/Neutral

Definition at line 294 of file Neutral.cpp.

References child(), Eref::element(), ObjId::eref(), Eref::id(), Shell::isNameValid(), name, parent(), Id::path(), Element::setName(), and Id::value().

Referenced by initCinfo().

295 {
296  if ( e.id().value() <= 3 ) {
297  cout << "Warning: Neutral::setName on '" << e.id().path() <<
298  "'. Cannot rename core objects\n";
299  return;
300  }
301  if ( !Shell::isNameValid( name ) ) {
302  cout << "Warning: Neutral::setName on '" << e.id().path() <<
303  "'. Illegal character in name.\n";
304  return;
305  }
306  ObjId pa = parent( e );
307  Id sibling = Neutral::child( pa.eref(), name );
308  if ( sibling == Id() ) { // OK, no existing object with same name.
309  e.element()->setName( name );
310  } else {
311  cout << "Warning: Neutral::setName: an object with the name '" <<
312  name << "'\n already exists on the same parent. Not changed\n";
313  }
314 }
Id id() const
Definition: Eref.cpp:62
static ObjId parent(const Eref &e)
Definition: Neutral.cpp:701
void setName(const string &val)
Definition: Element.cpp:61
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
unsigned int value() const
Definition: Id.cpp:197
static Id child(const Eref &e, const string &name)
Definition: Neutral.cpp:665
Definition: ObjId.h:20
Element * element() const
Definition: Eref.h:42
static char name[]
Definition: mfield.cpp:401
Eref eref() const
Definition: ObjId.cpp:66
Definition: Id.h:17
static bool isNameValid(const string &name)
Definition: Shell.cpp:499

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::setNumData ( const Eref e,
unsigned int  num 
)

numData is the number of data entries on this Element.

Definition at line 403 of file Neutral.cpp.

References Eref::element(), and Element::resize().

Referenced by initCinfo().

404 {
405  e.element()->resize( num );
406 }
Element * element() const
Definition: Eref.h:42
virtual void resize(unsigned int newNumData)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::setNumField ( const Eref e,
unsigned int  num 
)

numField is the size of the field array on the FieldElement specified by the Eref including its data index.

Definition at line 415 of file Neutral.cpp.

References Eref::dataIndex(), Eref::element(), Eref::isDataHere(), Element::rawIndex(), and Element::resizeField().

Referenced by initCinfo().

416 {
417  assert( e.isDataHere() );
418  unsigned int rawIndex = e.element()->rawIndex( e.dataIndex() );
419  e.element()->resizeField( rawIndex, num );
420 }
bool isDataHere() const
Definition: Eref.cpp:47
unsigned int dataIndex() const
Definition: Eref.h:50
Element * element() const
Definition: Eref.h:42
virtual unsigned int rawIndex(unsigned int dataIndex) const =0
virtual void resizeField(unsigned int rawIndex, unsigned int newNumField)=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Neutral::setThis ( Neutral  v)

Field access functions for the entire object. For Neutrals the setThis function is a dummy: it doesn't do anything because the Neutral has no data to set. However, the function name acts as a placeholder and derived objects can override the function so that the entire object can be accessed as a field and also for inter-node data transfer.

Definition at line 284 of file Neutral.cpp.

Referenced by initCinfo().

285 {
286  ;
287 }

+ Here is the caller graph for this function:

void Neutral::setTick ( const Eref e,
int  num 
)

The clock Tick specifies the timing and order of execution of the 'process' action of this object in the simulation. The timing is set by assigning the appropriate dt to this tick in the Clock object. A value of -1 means that the object is disabled.

Definition at line 442 of file Neutral.cpp.

References Eref::element(), and Element::setTick().

Referenced by initCinfo().

443 {
444  e.element()->setTick( num );
445 }
Element * element() const
Definition: Eref.h:42
void setTick(int t)
Definition: Element.cpp:251

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

ostream& operator<< ( ostream &  s,
const Neutral d 
)
friend
istream& operator>> ( istream &  s,
Neutral d 
)
friend

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