ESScript
Revision_4488
Main Page
Namespaces
Classes
Files
File List
File Members
finley
src
finley/src/NodeFile.h
Go to the documentation of this file.
1
2
/*****************************************************************************
3
*
4
* Copyright (c) 2003-2013 by University of Queensland
5
* http://www.uq.edu.au
6
*
7
* Primary Business: Queensland, Australia
8
* Licensed under the Open Software License version 3.0
9
* http://www.opensource.org/licenses/osl-3.0.php
10
*
11
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12
* Development since 2012 by School of Earth Sciences
13
*
14
*****************************************************************************/
15
16
#ifndef __FINLEY_NODEFILE_H__
17
#define __FINLEY_NODEFILE_H__
18
19
#define MAX_numDim 3
20
21
#include "
Finley.h
"
22
#include "
NodeMapping.h
"
23
#include "
Util.h
"
24
#include "paso/Distribution.h"
25
#include "paso/Coupler.h"
26
#include "esysUtils/Esys_MPI.h"
27
28
namespace
finley {
29
30
class
NodeFile
31
{
32
public
:
33
NodeFile
(
int
nDim,
Esys_MPIInfo
*mpiInfo);
34
~NodeFile
();
35
36
void
allocTable
(
int
numNodes
);
37
void
freeTable
();
38
39
inline
int
getFirstReducedNode
();
40
inline
int
getLastReducedNode
();
41
inline
int
getGlobalNumReducedNodes
();
42
inline
int
*
borrowGlobalReducedNodesIndex
();
43
44
inline
int
getFirstNode
();
45
inline
int
getLastNode
();
46
inline
int
getGlobalNumNodes
();
47
inline
int
*
borrowGlobalNodesIndex
();
48
49
inline
int
getNumReducedNodes
();
50
inline
int
getNumDegreesOfFreedom
();
51
inline
int
getNumNodes
();
52
inline
int
getNumReducedDegreesOfFreedom
();
53
54
inline
int
*
borrowTargetReducedNodes
();
55
inline
int
*
borrowTargetDegreesOfFreedom
();
56
inline
int
*
borrowTargetNodes
();
57
inline
int
*
borrowTargetReducedDegreesOfFreedom
();
58
59
inline
int
*
borrowReducedNodesTarget
();
60
inline
int
*
borrowDegreesOfFreedomTarget
();
61
inline
int
*
borrowNodesTarget
();
62
inline
int
*
borrowReducedDegreesOfFreedomTarget
();
63
64
int
createDenseDOFLabeling
();
65
int
createDenseNodeLabeling
(
int
* node_distribution,
const
int
* dof_distribution);
66
int
createDenseReducedLabeling
(
int
* reducedMask,
bool
useNodes);
67
void
assignMPIRankToDOFs
(
int
* mpiRankOfDOF,
int
*distribution);
68
69
void
copyTable
(
int
offset,
int
idOffset,
int
dofOffset,
const
NodeFile
* in);
70
void
gather
(
int
* index,
const
NodeFile
* in);
71
void
gather_global
(
int
* index,
const
NodeFile
* in);
72
void
scatter
(
int
* index,
const
NodeFile
* in);
73
74
void
setCoordinates
(
const
escript::Data
& newX);
75
void
setTags
(
const
int
newTag,
const
escript::Data
& mask);
76
inline
void
updateTagList
();
77
78
std::pair<int,int>
getDOFRange
()
const
;
79
80
private
:
81
std::pair<int,int>
getGlobalIdRange
()
const
;
82
std::pair<int,int>
getGlobalDOFRange
()
const
;
83
std::pair<int,int>
getGlobalNodeIDIndexRange
()
const
;
84
int
prepareLabeling
(
int
* mask, std::vector<int>& buffer,
85
std::vector<int>& distribution,
bool
useNodes);
86
87
public
:
89
91
Esys_MPIInfo
*
MPIInfo
;
93
int
numNodes
;
95
int
numDim
;
97
int
*
Id
;
99
int
*
Tag
;
101
std::vector<int>
tagsInUse
;
105
int
*
globalDegreesOfFreedom
;
107
double
*
Coordinates
;
110
int
*
globalReducedDOFIndex
;
113
int
*
globalReducedNodesIndex
;
115
int
*
globalNodesIndex
;
116
117
Finley_NodeMapping
*
nodesMapping
;
118
Finley_NodeMapping
*
reducedNodesMapping
;
119
Finley_NodeMapping
*
degreesOfFreedomMapping
;
120
Finley_NodeMapping
*
reducedDegreesOfFreedomMapping
;
121
122
Paso_Distribution
*
nodesDistribution
;
123
Paso_Distribution
*
reducedNodesDistribution
;
124
Paso_Distribution
*
degreesOfFreedomDistribution
;
125
Paso_Distribution
*
reducedDegreesOfFreedomDistribution
;
126
127
Paso_Connector
*
degreesOfFreedomConnector
;
128
Paso_Connector
*
reducedDegreesOfFreedomConnector
;
129
131
int
*
reducedNodesId
;
132
int
*
degreesOfFreedomId
;
133
int
*
reducedDegreesOfFreedomId
;
134
137
int
status
;
138
};
139
140
//
141
// implementation of inline methods
142
//
143
144
inline
int
NodeFile::getFirstReducedNode
()
145
{
146
return
Paso_Distribution_getFirstComponent
(
reducedNodesDistribution
);
147
}
148
149
inline
int
NodeFile::getLastReducedNode
()
150
{
151
return
Paso_Distribution_getLastComponent
(
reducedNodesDistribution
);
152
}
153
154
inline
int
NodeFile::getGlobalNumReducedNodes
()
155
{
156
return
Paso_Distribution_getGlobalNumComponents
(
reducedNodesDistribution
);
157
}
158
159
inline
int
*
NodeFile::borrowGlobalReducedNodesIndex
()
160
{
161
return
globalReducedNodesIndex
;
162
}
163
164
inline
int
NodeFile::getFirstNode
()
165
{
166
return
Paso_Distribution_getFirstComponent
(
nodesDistribution
);
167
}
168
169
inline
int
NodeFile::getLastNode
()
170
{
171
return
Paso_Distribution_getLastComponent
(
nodesDistribution
);
172
}
173
174
inline
int
NodeFile::getGlobalNumNodes
()
175
{
176
return
Paso_Distribution_getGlobalNumComponents
(
nodesDistribution
);
177
}
178
179
inline
int
*
NodeFile::borrowGlobalNodesIndex
()
180
{
181
return
globalNodesIndex
;
182
}
183
184
inline
int
NodeFile::getNumReducedNodes
()
185
{
186
return
reducedNodesMapping
->
numTargets
;
187
}
188
189
inline
int
NodeFile::getNumDegreesOfFreedom
()
190
{
191
return
Paso_Distribution_getMyNumComponents
(
degreesOfFreedomDistribution
);
192
}
193
194
inline
int
NodeFile::getNumNodes
()
195
{
196
return
nodesMapping
->
numNodes
;
197
}
198
199
inline
int
NodeFile::getNumReducedDegreesOfFreedom
()
200
{
201
return
Paso_Distribution_getMyNumComponents
(
reducedDegreesOfFreedomDistribution
);
202
}
203
204
inline
int
*
NodeFile::borrowTargetReducedNodes
()
205
{
206
return
reducedNodesMapping
->
target
;
207
}
208
209
inline
int
*
NodeFile::borrowTargetDegreesOfFreedom
()
210
{
211
return
degreesOfFreedomMapping
->
target
;
212
}
213
214
inline
int
*
NodeFile::borrowTargetNodes
()
215
{
216
return
nodesMapping
->
target
;
217
}
218
219
inline
int
*
NodeFile::borrowTargetReducedDegreesOfFreedom
()
220
{
221
return
reducedDegreesOfFreedomMapping
->
target
;
222
}
223
224
inline
int
*
NodeFile::borrowReducedNodesTarget
()
225
{
226
return
reducedNodesMapping
->
map
;
227
}
228
229
inline
int
*
NodeFile::borrowDegreesOfFreedomTarget
()
230
{
231
return
degreesOfFreedomMapping
->
map
;
232
}
233
234
inline
int
*
NodeFile::borrowNodesTarget
()
235
{
236
return
nodesMapping
->
map
;
237
}
238
239
inline
int
*
NodeFile::borrowReducedDegreesOfFreedomTarget
()
240
{
241
return
reducedDegreesOfFreedomMapping
->
map
;
242
}
243
244
inline
void
NodeFile::updateTagList
()
245
{
246
util::setValuesInUse
(
Tag
,
numNodes
,
tagsInUse
,
MPIInfo
);
247
}
248
249
250
}
// namespace finley
251
252
#endif // __FINLEY_NODEFILE_H__
253
Generated on Fri Jun 28 2013 11:10:52 for ESScript by
1.8.1.2