OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
src
ippl
src
SubField
SubFieldAssignDefs.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
/***************************************************************************
3
*
4
* The IPPL Framework
5
*
6
*
7
* Visit http://people.web.psi.ch/adelmann/ for more details
8
*
9
***************************************************************************/
10
11
#ifndef SUB_FIELD_ASSIGN_DEFS_H
12
#define SUB_FIELD_ASSIGN_DEFS_H
13
14
// include files
15
#include "
Field/AssignDefs.h
"
16
17
// forward references
18
template
<
class
T,
unsigned
int
D,
class
S>
class
SubFieldIter
;
19
20
22
//
23
// Is the domain specification object compressed?
24
//
26
27
struct
DomainCompressed
{
28
typedef
bool
PETE_Return_t
;
29
};
30
31
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
32
inline
bool
33
for_each
(
SubFieldIter<T,D,S>
&p,
DomainCompressed
, C)
34
{
35
return
p.DomainCompressed();
36
}
37
38
template
<
class
T,
class
C,
unsigned
int
D>
39
inline
bool
40
for_each
(
typename
BareField<T,D>::iterator
&,
DomainCompressed
, C)
41
{
42
return
true
;
43
}
44
45
template
<
class
C>
46
inline
bool
47
for_each
(
Index::cursor
&,
DomainCompressed
, C)
48
{
49
return
false
;
50
}
51
52
template
<
class
T,
class
C>
53
inline
bool
54
for_each
(
PETE_Scalar<T>
&,
DomainCompressed
, C)
55
{
56
return
true
;
57
}
58
59
61
//
62
// Do the terms all use the same kind of subset object?
63
//
65
66
struct
SameSubsetType
{
67
typedef
bool
PETE_Return_t
;
68
int
fID
;
69
SameSubsetType
(
int
id
) :
fID
(id) {}
70
};
71
72
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
73
inline
bool
74
for_each
(
SubFieldIter<T,D,S>
&p,
SameSubsetType
s, C)
75
{
76
return
p.matchType(s.
fID
);
77
}
78
79
template
<
class
T,
class
C,
unsigned
int
D>
80
inline
bool
81
for_each
(
typename
BareField<T,D>::iterator
&,
SameSubsetType
/*s*/
, C)
82
{
83
return
false
;
84
}
85
86
template
<
class
C>
87
inline
bool
88
for_each
(
Index::cursor
&,
SameSubsetType
, C)
89
{
90
return
true
;
91
}
92
93
template
<
class
T,
class
C>
94
inline
bool
95
for_each
(
PETE_Scalar<T>
&,
SameSubsetType
, C)
96
{
97
return
true
;
98
}
99
100
102
//
103
// Initialize all subset objects in an expression before the loop starts
104
//
106
107
struct
SubsetInit
{
108
typedef
int
PETE_Return_t
;
109
};
110
111
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
112
inline
int
113
for_each
(
SubFieldIter<T,D,S>
&p,
SubsetInit
, C)
114
{
115
p.initialize();
116
return
0;
117
}
118
119
template
<
class
T,
class
C,
unsigned
int
D>
120
inline
int
121
for_each
(
typename
BareField<T,D>::iterator
&
/*p*/
,
SubsetInit
, C)
122
{
123
return
0;
124
}
125
126
template
<
class
C>
127
inline
int
128
for_each
(
Index::cursor
&,
SubsetInit
, C)
129
{
130
return
0;
131
}
132
133
template
<
class
T,
class
C>
134
inline
int
135
for_each
(
PETE_Scalar<T>
&,
SubsetInit
, C)
136
{
137
return
0;
138
}
139
140
142
//
143
// Set a subfield iterator to point to the next lfield
144
//
146
147
struct
SubsetNextLField
{
148
typedef
int
PETE_Return_t
;
149
};
150
151
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
152
inline
int
153
for_each
(
SubFieldIter<T,D,S>
&p,
SubsetNextLField
, C)
154
{
155
p.nextLField();
156
return
0;
157
}
158
159
template
<
class
T,
class
C,
unsigned
int
D>
160
inline
int
161
for_each
(
typename
BareField<T,D>::iterator
&,
SubsetNextLField
, C)
162
{
163
return
0;
164
}
165
166
template
<
class
C>
167
inline
int
168
for_each
(
Index::cursor
&,
SubsetNextLField
, C)
169
{
170
return
0;
171
}
172
173
template
<
class
T,
class
C>
174
inline
int
175
for_each
(
PETE_Scalar<T>
&,
SubsetNextLField
, C)
176
{
177
return
0;
178
}
179
180
182
//
183
// Do any of the terms in an expression have an ID equal to a given one?
184
//
186
187
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
188
inline
bool
189
for_each
(
SubFieldIter<T,D,S>
&p,
SameFieldID
s, C)
190
{
191
return
(
int
)p.getBareField().get_Id() == s.
fID
;
192
}
193
195
//
196
// Plugbase.
197
//
199
200
template
<
class
T,
unsigned
D,
class
S,
class
C>
201
inline
bool
202
for_each
(
SubFieldIter<T,D,S>
&p,
const
PlugBase<D>
& f, C)
203
{
204
return
p.plugBase(f.
Domain
);
205
}
206
208
//
209
// Check for compression.
210
//
212
213
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
214
inline
bool
215
for_each
(
SubFieldIter<T,D,S>
&p,
IsCompressed
, C)
216
{
217
return
p.IsCompressed();
218
}
219
221
//
222
// Evaluation functors.
223
// First, no arguments.
224
//
226
227
template
<
class
T,
class
S,
unsigned
int
D>
228
inline
T
&
229
for_each
(
SubFieldIter<T,D,S>
&p,
EvalFunctor_0
)
230
{
231
return
*p;
232
}
233
235
//
236
// Evaluation functors.
237
// One argument.
238
//
240
241
template
<
class
T,
class
S,
unsigned
int
D>
242
inline
T
&
243
for_each
(
SubFieldIter<T,D,S>
&p,
const
EvalFunctor_1
&
e
)
244
{
245
return
p.offset(
e
.I);
246
}
247
249
//
250
// Evaluation functors.
251
// Two arguments.
252
//
254
255
template
<
class
T,
class
S,
unsigned
int
D>
256
inline
T
&
257
for_each
(
SubFieldIter<T,D,S>
&p,
const
EvalFunctor_2
&
e
)
258
{
259
return
p.offset(
e
.I,
e
.J);
260
}
261
263
//
264
// Evaluation functors.
265
// Three arguments.
266
//
268
269
template
<
class
T,
class
S,
unsigned
int
D>
270
inline
T
&
271
for_each
(
SubFieldIter<T,D,S>
&p,
const
EvalFunctor_3
&
e
)
272
{
273
return
p.offset(
e
.I,
e
.J,
e
.K);
274
}
275
277
//
278
// Step in some dimension.
279
//
281
282
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
283
inline
int
284
for_each
(
SubFieldIter<T,D,S>
&p,
StepFunctor
s, C)
285
{
286
p.step(s.
D
);
287
return
0;
288
}
289
291
//
292
// Rewind in some dimension.
293
//
295
296
template
<
class
T,
class
S,
class
C,
unsigned
int
D>
297
inline
int
298
for_each
(
SubFieldIter<T,D,S>
&p,
RewindFunctor
s, C)
299
{
300
p.rewind(s.
D
);
301
return
0;
302
}
303
305
//
306
// Does an iterator reference something with unit stride?
307
// Don't worry about it for now.
308
//
310
311
template
<
class
T,
unsigned
int
D,
class
S,
class
C>
312
inline
bool
313
for_each
(
SubFieldIter<T,D,S>
&
/*p*/
,
HasUnitStride
, C)
314
{
315
return
false
;
316
}
317
319
//
320
// Ask each term to fill guard cells and compress itself
321
//
323
324
template
<
class
T,
unsigned
int
D,
class
S,
class
C,
class
T1>
325
inline
int
326
for_each
(
SubFieldIter<T,D,S>
&p,
const
FillGCIfNecessaryTag<D,T1>
&
/*f*/
, C)
327
{
328
//tjw3/3/99 p.FillGCIfNecessary(f.I, f.I);
329
p.FillGCIfNecessary();
330
return
0;
331
}
332
333
#endif
// SUB_FIELD_ASSIGN_DEFS_H
334
335
/***************************************************************************
336
* $RCSfile: SubFieldAssignDefs.h,v $ $Author: adelmann $
337
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
338
* IPPL_VERSION_ID: $Id: SubFieldAssignDefs.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
339
***************************************************************************/
AssignDefs.h
for_each
bool for_each(SubFieldIter< T, D, S > &p, DomainCompressed, C)
Definition:
SubFieldAssignDefs.h:33
Physics::e
constexpr double e
The value of.
Definition:
Physics.h:39
Attrib::Legacy::Distribution::T
@ T
Definition:
Distribution.h:189
BareFieldIterator
Definition:
BareFieldIterator.h:41
PlugBase
Definition:
AssignDefs.h:70
PlugBase::Domain
NDIndex< D > Domain
Definition:
AssignDefs.h:71
SameFieldID
Definition:
AssignTags.h:24
SameFieldID::fID
int fID
Definition:
AssignTags.h:25
IsCompressed
Definition:
AssignTags.h:32
EvalFunctor_1
Definition:
AssignTags.h:38
EvalFunctor_2
Definition:
AssignTags.h:49
EvalFunctor_3
Definition:
AssignTags.h:60
StepFunctor
Definition:
AssignTags.h:88
StepFunctor::D
unsigned D
Definition:
AssignTags.h:89
RewindFunctor
Definition:
AssignTags.h:95
RewindFunctor::D
unsigned D
Definition:
AssignTags.h:96
HasUnitStride
Definition:
AssignTags.h:107
FillGCIfNecessaryTag
Definition:
AssignTags.h:115
Index::cursor
Definition:
Index.h:312
PETE_Scalar
Definition:
PETE.h:143
EvalFunctor_0
Definition:
PETE.h:179
SubFieldIter
Definition:
SubFieldIter.h:251
DomainCompressed
Definition:
SubFieldAssignDefs.h:27
DomainCompressed::PETE_Return_t
bool PETE_Return_t
Definition:
SubFieldAssignDefs.h:28
SameSubsetType
Definition:
SubFieldAssignDefs.h:66
SameSubsetType::fID
int fID
Definition:
SubFieldAssignDefs.h:68
SameSubsetType::SameSubsetType
SameSubsetType(int id)
Definition:
SubFieldAssignDefs.h:69
SameSubsetType::PETE_Return_t
bool PETE_Return_t
Definition:
SubFieldAssignDefs.h:67
SubsetInit
Definition:
SubFieldAssignDefs.h:107
SubsetInit::PETE_Return_t
int PETE_Return_t
Definition:
SubFieldAssignDefs.h:108
SubsetNextLField
Definition:
SubFieldAssignDefs.h:147
SubsetNextLField::PETE_Return_t
int PETE_Return_t
Definition:
SubFieldAssignDefs.h:148
Generated on Wed Aug 25 2021 16:40:59 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.1