OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
src
ippl
src
Particle
PAssignDefs.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 PASSIGN_DEFS_H
12
#define PASSIGN_DEFS_H
13
14
// include files
15
#include "
PETE/IpplExpressions.h
"
16
#include "
AppTypes/AppTypeTraits.h
"
17
18
// forward declarations
19
template
<
class
T>
class
ParticleAttrib
;
20
template
<
class
T,
unsigned
Dim>
class
ParticleAttribElem
;
21
template
<
class
T>
class
ParticleAttribIterator
;
22
template
<
class
T>
class
ParticleAttribConstIterator
;
23
25
//
26
// Evaluation functor.
27
//
29
30
template
<
class
T>
31
inline
T
&
32
for_each
(
ParticleAttribIterator<T>
& p,
EvalFunctor_0
)
33
{
34
return
*p;
35
}
36
37
template
<
class
T>
38
inline
const
T
&
39
for_each
(
ParticleAttribConstIterator<T>
& p,
EvalFunctor_0
)
40
{
41
return
*p;
42
}
43
44
#define DEFINE_EVALFUNCTOR_PAE(D) \
45
\
46
template<class T> \
47
inline typename AppTypeTraits<T>::Element_t& \
48
for_each(ParticleAttribElemIterator<T,D>& p, EvalFunctor_0) \
49
{ \
50
return *p; \
51
}
52
53
DEFINE_EVALFUNCTOR_PAE
(1)
54
DEFINE_EVALFUNCTOR_PAE
(2)
55
DEFINE_EVALFUNCTOR_PAE
(3)
56
DEFINE_EVALFUNCTOR_PAE
(4)
57
DEFINE_EVALFUNCTOR_PAE
(5)
58
DEFINE_EVALFUNCTOR_PAE
(6)
59
60
62
//
63
// Count the elements in an expression.
64
//
66
67
template<class
T
, class C>
68
inline
int
69
for_each
(const
ParticleAttribIterator
<
T
>& p,
PETE_CountElems
, C)
70
{
71
return
p.size();
72
}
73
74
template
<
class
T,
class
C>
75
inline
int
76
for_each
(
const
ParticleAttribConstIterator<T>
& p,
PETE_CountElems
, C)
77
{
78
return
p.
size
();
79
}
80
81
#define DEFINE_COUNTFUNCTOR_PAE(D) \
82
\
83
template<class T, class C> \
84
inline int \
85
for_each(const ParticleAttribElemIterator<T,D>& p, PETE_CountElems, C) \
86
{ \
87
return p.getParticleAttribElem().size(); \
88
}
89
90
DEFINE_COUNTFUNCTOR_PAE
(1)
91
DEFINE_COUNTFUNCTOR_PAE
(2)
92
DEFINE_COUNTFUNCTOR_PAE
(3)
93
DEFINE_COUNTFUNCTOR_PAE
(4)
94
DEFINE_COUNTFUNCTOR_PAE
(5)
95
DEFINE_COUNTFUNCTOR_PAE
(6)
96
97
99
//
100
// Increment the pointers in an expression.
101
//
103
104
template<class
T
, class C>
105
inline
int
106
for_each
(
ParticleAttribIterator
<
T
>& p,
PETE_Increment
, C)
107
{
108
++p;
109
return
0;
110
}
111
112
template
<
class
T,
class
C>
113
inline
int
114
for_each
(
ParticleAttribConstIterator<T>
& p,
PETE_Increment
, C)
115
{
116
++p;
117
return
0;
118
}
119
120
#define DEFINE_INCFUNCTOR_PAE(D) \
121
\
122
template<class T, class C> \
123
inline int \
124
for_each(ParticleAttribElemIterator<T,D>& p, PETE_Increment, C) \
125
{ \
126
++p; \
127
return 0; \
128
}
129
130
DEFINE_INCFUNCTOR_PAE
(1)
131
DEFINE_INCFUNCTOR_PAE
(2)
132
DEFINE_INCFUNCTOR_PAE
(3)
133
DEFINE_INCFUNCTOR_PAE
(4)
134
DEFINE_INCFUNCTOR_PAE
(5)
135
DEFINE_INCFUNCTOR_PAE
(6)
136
137
138
139
#endif
// PASSIGN_DEFS_H
140
141
/***************************************************************************
142
* $RCSfile: PAssignDefs.h,v $ $Author: adelmann $
143
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
144
* IPPL_VERSION_ID: $Id: PAssignDefs.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
145
***************************************************************************/
146
AppTypeTraits.h
for_each
T & for_each(ParticleAttribIterator< T > &p, EvalFunctor_0)
Definition:
PAssignDefs.h:32
DEFINE_COUNTFUNCTOR_PAE
#define DEFINE_COUNTFUNCTOR_PAE(D)
Definition:
PAssignDefs.h:81
DEFINE_INCFUNCTOR_PAE
#define DEFINE_INCFUNCTOR_PAE(D)
Definition:
PAssignDefs.h:120
DEFINE_EVALFUNCTOR_PAE
#define DEFINE_EVALFUNCTOR_PAE(D)
Definition:
PAssignDefs.h:44
IpplExpressions.h
Attrib::Legacy::Distribution::T
@ T
Definition:
Distribution.h:189
ParticleAttrib
Definition:
ParticleAttrib.h:100
ParticleAttribIterator
Definition:
ParticleAttrib.h:568
ParticleAttribConstIterator
Definition:
ParticleAttrib.h:691
ParticleAttribConstIterator::size
size_t size() const
Definition:
ParticleAttrib.h:804
ParticleAttribElem
Definition:
ParticleAttribElem.h:67
EvalFunctor_0
Definition:
PETE.h:179
PETE_Increment
Definition:
PETE.h:185
PETE_CountElems
Definition:
PETE.h:192
Generated on Wed Aug 25 2021 16:40:59 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.1