-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathGlobalDataElement.h
97 lines (79 loc) · 2.93 KB
/
GlobalDataElement.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2013 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
#ifndef _GLOBAL_DATA_ELEMENT_H
#define _GLOBAL_DATA_ELEMENT_H
class SrcFinfo;
class FuncOrder;
/**
* This is the usual class for managing the MOOSE interface.
* Handles the data.
* Elaborates on base class for how it handles destruction.
* Does block-wise partitioning between nodes.
*/
class GlobalDataElement: public DataElement
{
public:
/**
* 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.
*/
GlobalDataElement( Id id, const Cinfo* c, const string& name,
unsigned int numData = 1 );
/**
* This constructor copies over the original n times. It is
* used for doing all copies, in Shell::innerCopyElements.
*/
GlobalDataElement( Id id, const Element* orig, unsigned int n );
/**
* Virtual Destructor
*/
~GlobalDataElement();
/**
* Virtual copier. Makes a copy of self.
*/
Element* copyElement( Id newParent, Id newId, unsigned int n,
bool toGlobal ) const;
/////////////////////////////////////////////////////////////////
// Information access fields
/////////////////////////////////////////////////////////////////
/// Inherited virtual. Returns number of data entries
unsigned int numData() const;
/// Inherited virtual. Returns index of first entry on this node
unsigned int localDataStart() const {
return 0;
}
/// Inherited virtual. Returns node location of specified object
unsigned int getNode( unsigned int dataIndex ) const;
/// Inherited virtual. Returns start dataIndex on specified node
unsigned int startDataIndex( unsigned int node ) const
{
return 0;
}
/// Converts dataId to index on current node.
unsigned int rawIndex( unsigned int dataId ) const;
bool isGlobal() const {
return true;
}
/// Inherited virtual.
unsigned int getNumOnNode( unsigned int node ) const;
/////////////////////////////////////////////////////////////////
// data access stuff: All is just inherited.
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
private:
// All is inherited from DataElement.
};
#endif // _GLOBAL_DATA_ELEMENT_H