MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GlobalDataElement.cpp
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-2009 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 
10 #include "header.h"
11 #include "FuncOrder.h"
12 #include "../shell/Shell.h"
13 
15  const string& name, unsigned int numData )
16  :
17  DataElement( id, c, name, numData )
18 {;}
19 
20 
21 /*
22  * Used for copies. Note that it does NOT call the postCreation Func,
23  * so FieldElements are copied rather than created by the Cinfo when
24  * the parent element is created. This allows the copied FieldElements to
25  * retain info from the originals.
26  * Note that n is the number of individual dataEntries that are made.
27  */
29  unsigned int n )
30  :
31  DataElement( id, orig, n, 0 )
32 {;}
33 
34 // Virtual destructor.
36 {;}
37 
39  Id newParent, Id newId, unsigned int n, bool toGlobal ) const
40 {
41  if ( toGlobal )
42  return new GlobalDataElement( newId, this, n );
43  else
44  return new LocalDataElement( newId, this, n );
45 }
46 
47 
49 // DataElement info functions
51 
52 // virtual func.
53 unsigned int GlobalDataElement::numData() const
54 {
55  return numLocalData();
56 }
57 
58 unsigned int GlobalDataElement::getNode( unsigned int dataId ) const {
59  // Assume numData = 95. DataId = 0-9: 0, DataId=80-89:8, DataId >= 90:9
60  return Shell::myNode();
61 }
62 
63 unsigned int GlobalDataElement::rawIndex( unsigned int dataId ) const {
64  return dataId;
65 }
66 
67 unsigned int GlobalDataElement::getNumOnNode( unsigned int node ) const
68 {
69  return numLocalData();
70 }
Element * copyElement(Id newParent, Id newId, unsigned int n, bool toGlobal) const
GlobalDataElement(Id id, const Cinfo *c, const string &name, unsigned int numData=1)
unsigned int getNode(unsigned int dataIndex) const
Inherited virtual. Returns node location of specified object.
unsigned int numData() const
Inherited virtual. Returns number of data entries.
unsigned int getNumOnNode(unsigned int node) const
Inherited virtual.
static char name[]
Definition: mfield.cpp:401
Definition: Id.h:17
static unsigned int myNode()
unsigned int numLocalData() const
Defined only in derived classes: unsigned int numData() const;.
Definition: DataElement.cpp:61
Definition: Cinfo.h:18
unsigned int rawIndex(unsigned int dataId) const
Converts dataId to index on current node.