MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DataElement.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 #ifndef _DATA_ELEMENT_H
10 #define _DATA_ELEMENT_H
11 
12 class SrcFinfo;
13 class FuncOrder;
14 
21 class DataElement: public Element
22 {
23  public:
35  DataElement( Id id, const Cinfo* c, const string& name,
36  unsigned int numData = 1 );
37 
42  DataElement( Id id, const Element* orig, unsigned int n,
43  unsigned int startEntry );
44 
48  ~DataElement();
49 
54  // Information access fields
57 
59 
61  unsigned int numLocalData() const;
62 
64 
66  unsigned int numField( unsigned int rawIndex ) const;
67 
72  unsigned int totNumLocalField() const;
73 
75 
81  bool hasFields() const {
82  return false;
83  }
84 
86  // data access stuff
88 
105  char* data( unsigned int rawIndex,
106  unsigned int fieldIndex = 0 ) const;
107 
114  void resize( unsigned int newNumData );
115 
122  unsigned int rawIndex, unsigned int newNumField )
123  {;}
124 
126  // Zombie stuff.
127 
129  void zombieSwap( const Cinfo* newCinfo );
130 
131  private:
132 
136  char* data_;
137 
141  unsigned int numLocalData_;
142 
148  unsigned int size_;
149 };
150 
151 #endif // _DATA_ELEMENT_H
void zombieSwap(const Cinfo *newCinfo)
Virtual func.
void resizeField(unsigned int rawIndex, unsigned int newNumField)
Definition: DataElement.h:121
unsigned int numField(unsigned int rawIndex) const
Define only in derived classes: getNode( unsigned int dataIndex ) const;.
Definition: DataElement.cpp:67
char * data_
Definition: DataElement.h:136
unsigned int size_
Definition: DataElement.h:148
unsigned int totNumLocalField() const
Definition: DataElement.cpp:73
char * data(unsigned int rawIndex, unsigned int fieldIndex=0) const
Definition: DataElement.cpp:82
void resize(unsigned int newNumData)
Definition: DataElement.cpp:95
virtual unsigned int numData() const =0
Returns number of data entries across all nodes.
unsigned int numLocalData_
Definition: DataElement.h:141
static char name[]
Definition: mfield.cpp:401
bool hasFields() const
Do not define getNode() or rawIndex() funcs, those are derived.
Definition: DataElement.h:81
Definition: Id.h:17
virtual unsigned int rawIndex(unsigned int dataIndex) const =0
unsigned int numLocalData() const
Defined only in derived classes: unsigned int numData() const;.
Definition: DataElement.cpp:61
DataElement(Id id, const Cinfo *c, const string &name, unsigned int numData=1)
Definition: Cinfo.h:18