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

#include <ObjId.h>

+ Collaboration diagram for ObjId:

Public Member Functions

bool bad () const
 
char * data () const
 
Elementelement () const
 
Eref eref () const
 
bool isDataHere () const
 
bool isGlobal () const
 Returns true if the Element is global. More...
 
bool isOffNode () const
 Returns true if we need to go off-node for calling operations. More...
 
 ObjId ()
 
 ObjId (Id i, unsigned int d, unsigned int f=0)
 
 ObjId (Id i)
 
 ObjId (const string &path)
 
bool operator!= (const ObjId &other) const
 
bool operator< (const ObjId &other) const
 
bool operator== (const ObjId &other) const
 
string path () const
 

Public Attributes

unsigned int dataIndex
 
unsigned int fieldIndex
 
Id id
 

Friends

ostream & operator<< (ostream &s, const ObjId &i)
 
istream & operator>> (istream &s, ObjId &i)
 

Detailed Description

This class manages lookups for specific data entries in elements, in a node-independent manner. It is basically a composite of Id and DataIndex.

Definition at line 20 of file ObjId.h.

Constructor & Destructor Documentation

ObjId::ObjId ( )
inline

Returns the root Id

Definition at line 31 of file ObjId.h.

32  : id(), dataIndex( 0 ), fieldIndex( 0 )
33  {;}
unsigned int fieldIndex
Definition: ObjId.h:100
Id id
Definition: ObjId.h:98
unsigned int dataIndex
Definition: ObjId.h:99
ObjId::ObjId ( Id  i,
unsigned int  d,
unsigned int  f = 0 
)
inline

Creates a ObjId using specified Id and DataIndex

Definition at line 38 of file ObjId.h.

39  : id( i ), dataIndex( d ), fieldIndex( f )
40  {;}
unsigned int fieldIndex
Definition: ObjId.h:100
Id id
Definition: ObjId.h:98
unsigned int dataIndex
Definition: ObjId.h:99
ObjId::ObjId ( Id  i)
inline

Definition at line 42 of file ObjId.h.

43  : id( i ), dataIndex( 0 ), fieldIndex( 0 )
44  {;}
unsigned int fieldIndex
Definition: ObjId.h:100
Id id
Definition: ObjId.h:98
unsigned int dataIndex
Definition: ObjId.h:99
ObjId::ObjId ( const string &  path)

Creates an ObjId by reading the path string Returns bad on failure.

Member Function Documentation

bool ObjId::bad ( ) const

True if the return value is bad: either returning a failure, or the DataIndex or FieldIndex is out of range. However, this is a node-local funtion so it can't report the FieldIndex status in all cases.

Definition at line 18 of file ObjId.cpp.

References BADINDEX, dataIndex, fieldIndex, and Element::numData().

Referenced by ReadCell::addCanonicalChannel(), ReadCell::addChannelMessage(), benchmarkMsg(), ReadCell::buildCompartment(), create_Id_from_path(), HSolve::deleteIncomingMessages(), doClassSpecificMessaging(), Dsolve::fillConcChans(), moose_connect(), moose_copy(), moose_delete(), moose_element(), moose_move(), moose_ObjId_connect(), moose_setCwe(), HSolveActive::readSynapses(), ReadCell::startGraftCell(), testAssortedMsg(), testCalcJunction(), testMsgElementListing(), and testTreeTraversal().

19 {
20  Element* elm = id.element();
21  return ( elm == 0 ||
22  dataIndex == BADINDEX ||
23  fieldIndex == BADINDEX ||
24  dataIndex >= elm->numData()
25  /*
26  * We have a bit of a problem here. The FieldElement can exist
27  * with zero fields, and is invalid for field lookups but valid
28  * for the element level lookups. I should rather not create the
29  * FieldElements this way.
30  || (
31  elm->getNode( dataIndex ) == Shell::myNode() &&
32  fieldIndex >= elm->numField( dataIndex - elm->localDataStart() )
33  )
34  */
35  );
36 }
unsigned int fieldIndex
Definition: ObjId.h:100
virtual unsigned int numData() const =0
Returns number of data entries across all nodes.
const unsigned int BADINDEX
Used by ObjId and Eref.
Definition: consts.cpp:25
unsigned int dataIndex
Definition: ObjId.h:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char * ObjId::data ( ) const

Returns data entry for this object

Definition at line 113 of file ObjId.cpp.

References dataIndex, element(), and fieldIndex.

Referenced by Synapse::addMsgCallback(), addToBuf(), dispatchBuffers(), Synapse::dropMsgCallback(), Msg::getMsg(), innerFind(), main(), ReadKkit::read(), remoteFieldGetVec(), remoteGet(), remoteGetVec(), ZombieFunction::setSolver(), EndoMesh::setSurround(), test2ArgSetVec(), test_to_py(), testLookupSetGet(), testMsgField(), testSendSpike(), testSetGet(), testSetGetDouble(), testSetGetExtField(), testStrGet(), and ZombiePool::vSetSolver().

114 {
115  return id.element()->data( id.element()->rawIndex( dataIndex ),
116  fieldIndex );
117 }
unsigned int fieldIndex
Definition: ObjId.h:100
Element * element() const
Definition: ObjId.cpp:124
unsigned int dataIndex
Definition: ObjId.h:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Eref ObjId::eref ( ) const

Returns the Eref matching itself.

Definition at line 66 of file ObjId.cpp.

References dataIndex, element(), and fieldIndex.

Referenced by Shell::adopt(), allChildren(), SetGet::checkSet(), Shell::destroy(), Shell::doCopy(), Shell::doCreate(), Shell::doFind(), Shell::doMove(), TgtInfo::eref(), Field< A >::get(), LookupField< L, A >::get(), Field< A >::getVec(), Shell::innerAddMsg(), Shell::innerMove(), Neutral::isDescendant(), GetOpFunc1< T, L, A >::op(), GetEpFunc1< T, L, A >::op(), path(), Neutral::path(), SetGet0::set(), SetGet1< A >::set(), SetGet2< L, A >::set(), SetGet3< A1, A2, A3 >::set(), SetGet4< A1, A2, A3, A4 >::set(), SetGet5< A1, A2, A3, A4, A5 >::set(), SetGet6< A1, A2, A3, A4, A5, A6 >::set(), Neutral::setName(), SetGet1< A >::setVec(), SetGet2< L, A >::setVec(), singleLevelWildcard(), SetGet::strGet(), SetGet::strSet(), testGetMsg(), testObjIdToAndFromPath(), testSendSpike(), testShellAddMsg(), and testTable().

67 {
68  return Eref( id.element(), dataIndex, fieldIndex );
69 }
unsigned int fieldIndex
Definition: ObjId.h:100
Definition: Eref.h:26
Element * element() const
Definition: ObjId.cpp:124
unsigned int dataIndex
Definition: ObjId.h:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjId::isDataHere ( ) const

True if the data is present on the current node. Always true for globals, which confuses the matter somewhat.

Definition at line 95 of file ObjId.cpp.

References dataIndex, element(), and Shell::myNode().

Referenced by SetGet::checkSet(), Field< A >::get(), and LookupField< L, A >::get().

96 {
97  return ( id.element()->getNode( dataIndex ) == Shell::myNode() );
98 }
Element * element() const
Definition: ObjId.cpp:124
static unsigned int myNode()
unsigned int dataIndex
Definition: ObjId.h:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjId::isGlobal ( ) const

Returns true if the Element is global.

Definition at line 100 of file ObjId.cpp.

References element().

Referenced by isOffNode(), SetGet0::set(), SetGet1< A >::set(), SetGet2< L, A >::set(), SetGet3< A1, A2, A3 >::set(), SetGet4< A1, A2, A3, A4 >::set(), SetGet5< A1, A2, A3, A4, A5 >::set(), and SetGet6< A1, A2, A3, A4, A5, A6 >::set().

101 {
102  return ( id.element()->isGlobal() );
103 }
bool isGlobal() const
Returns true if the Element is global.
Definition: ObjId.cpp:100
Element * element() const
Definition: ObjId.cpp:124

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjId::isOffNode ( ) const

Returns true if we need to go off-node for calling operations.

Definition at line 105 of file ObjId.cpp.

References dataIndex, element(), isGlobal(), Shell::myNode(), and Shell::numNodes().

Referenced by SetGet0::set(), SetGet1< A >::set(), SetGet2< L, A >::set(), SetGet3< A1, A2, A3 >::set(), SetGet4< A1, A2, A3, A4 >::set(), SetGet5< A1, A2, A3, A4, A5 >::set(), and SetGet6< A1, A2, A3, A4, A5, A6 >::set().

106 {
107  return ( Shell::numNodes() > 1 &&
108  ( id.element()->isGlobal() ||
109  id.element()->getNode( dataIndex ) != Shell::myNode() )
110  );
111 }
bool isGlobal() const
Returns true if the Element is global.
Definition: ObjId.cpp:100
Element * element() const
Definition: ObjId.cpp:124
static unsigned int myNode()
static unsigned int numNodes()
unsigned int dataIndex
Definition: ObjId.h:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ObjId::operator!= ( const ObjId other) const

Definition at line 77 of file ObjId.cpp.

References dataIndex, fieldIndex, and id.

78 {
79  return ( id != other.id || dataIndex != other.dataIndex ||
80  fieldIndex != other.fieldIndex );
81 }
unsigned int fieldIndex
Definition: ObjId.h:100
Id id
Definition: ObjId.h:98
unsigned int dataIndex
Definition: ObjId.h:99
bool ObjId::operator< ( const ObjId other) const

For sorting

Definition at line 83 of file ObjId.cpp.

References dataIndex, fieldIndex, and id.

84 {
85  return ( id < other.id ||
86  (id == other.id && (
87  dataIndex < other.dataIndex ||
88  ( dataIndex == other.dataIndex &&
89  fieldIndex < other.fieldIndex )
90  )
91  )
92  );
93 }
unsigned int fieldIndex
Definition: ObjId.h:100
Id id
Definition: ObjId.h:98
unsigned int dataIndex
Definition: ObjId.h:99
bool ObjId::operator== ( const ObjId other) const

For equality check

Definition at line 71 of file ObjId.cpp.

References dataIndex, fieldIndex, and id.

72 {
73  return ( id == other.id && dataIndex == other.dataIndex &&
74  fieldIndex == other.fieldIndex );
75 }
unsigned int fieldIndex
Definition: ObjId.h:100
Id id
Definition: ObjId.h:98
unsigned int dataIndex
Definition: ObjId.h:99
string ObjId::path ( ) const

Returns the absolute path including all array indices.

Definition at line 119 of file ObjId.cpp.

References eref(), and Neutral::path().

Referenced by doClassSpecificMessaging(), Shell::doCopy(), Shell::doCreate(), Shell::doMove(), Function::getExpr(), Field< A >::getVec(), Function::innerSetExpr(), EndoMesh::setSurround(), testObjIdToAndFromPath(), and testTreeTraversal().

120 {
121  return Neutral::path( eref() );
122 }
static string path(const Eref &e)
Definition: Neutral.cpp:725
Eref eref() const
Definition: ObjId.cpp:66

+ 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 ObjId i 
)
friend
istream& operator>> ( istream &  s,
ObjId i 
)
friend

Member Data Documentation

unsigned int ObjId::fieldIndex

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