#include <DataElement.h>
Public Member Functions | |
DataElement (Id id, const Cinfo *c, const string &name, unsigned int numData=1) | |
DataElement (Id id, const Element *orig, unsigned int n, unsigned int startEntry) | |
~DataElement () | |
unsigned int | numLocalData () const |
Defined only in derived classes: unsigned int numData() const;. | |
unsigned int | numField (unsigned int rawIndex) const |
Define only in derived classes: getNode( unsigned int dataIndex ) const;. | |
unsigned int | totNumLocalField () const |
bool | hasFields () const |
Do not define getNode() or rawIndex() funcs, those are derived. | |
char * | data (unsigned int rawIndex, unsigned int fieldIndex=0) const |
void | resize (unsigned int newNumData) |
void | resizeField (unsigned int rawIndex, unsigned int newNumField) |
void | zombieSwap (const Cinfo *newCinfo) |
Virtual func. |
This is the base class for managing the data in the MOOSE interface. Elaborates on base class for how it handles destruction. Subclasses of this handle special node decomposition. This does basic data management with raw indices.
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.
This constructor copies over the original n times. It is used for doing all copies, in Shell::innerCopyElements.
References Element::cinfo(), DinfoBase::copyData(), Element::data(), Cinfo::dinfo(), Element::numData(), and DinfoBase::sizeIncrement().
DataElement::~DataElement | ( | ) |
Virtual Destructor
References Element::cinfo(), DinfoBase::destroyData(), and Cinfo::dinfo().
char * DataElement::data | ( | unsigned int | rawIndex, | |
unsigned int | fieldIndex = 0 | |||
) | const [virtual] |
Inherited 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.
Implements Element.
bool DataElement::hasFields | ( | ) | const [inline, virtual] |
Do not define getNode() or rawIndex() funcs, those are derived.
Inherited virtual True if this is a FieldElement having an array of fields on each data entry. Clearly not true for the base Element.
Implements Element.
unsigned int DataElement::numField | ( | unsigned int | rawIndex | ) | const [virtual] |
Define only in derived classes: getNode( unsigned int dataIndex ) const;.
Inherited virtual. Returns number of field entries for specified data
Implements Element.
unsigned int DataElement::numLocalData | ( | ) | const [virtual] |
Defined only in derived classes: unsigned int numData() const;.
copyElement function is defined only in derived classes. Inherited virtual. Returns number of data entries on this node
Implements Element.
Referenced by LocalDataElement::getNode(), GlobalDataElement::getNumOnNode(), and GlobalDataElement::numData().
void DataElement::resize | ( | unsigned int | newNumLocalData | ) | [virtual] |
Inherited virtual. Changes the total number of data entries on Element in entire simulation. Not permitted for FieldElements since they are just fields on the data.
virtual func, overridden. Here we resize the local data. This function would be called by derived classes to do their own data management as per node decomposition.
Implements Element.
Reimplemented in LocalDataElement.
References Element::cinfo(), DinfoBase::copyData(), DinfoBase::destroyData(), and Cinfo::dinfo().
void DataElement::resizeField | ( | unsigned int | rawIndex, | |
unsigned int | newNumField | |||
) | [inline, virtual] |
unsigned int DataElement::totNumLocalField | ( | ) | const [virtual] |
Inherited virtual: Returns number of field entries on current node, same as numLocalData().
Implements Element.
void DataElement::zombieSwap | ( | const Cinfo * | newCinfo | ) | [virtual] |
Virtual func.
Reimplemented from Element.
References DinfoBase::allocData(), Element::cinfo(), DinfoBase::destroyData(), Cinfo::dinfo(), Element::replaceCinfo(), and DinfoBase::sizeIncrement().