OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
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
17
18// forward declarations
19template<class T> class ParticleAttrib;
20template<class T, unsigned Dim> class ParticleAttribElem;
21template<class T> class ParticleAttribIterator;
22template <class T> class ParticleAttribConstIterator;
23
25//
26// Evaluation functor.
27//
29
30template<class T>
31inline T&
33{
34 return *p;
35}
36
37template<class T>
38inline const T&
40{
41 return *p;
42}
43
44#define DEFINE_EVALFUNCTOR_PAE(D) \
45 \
46template<class T> \
47inline typename AppTypeTraits<T>::Element_t& \
48for_each(ParticleAttribElemIterator<T,D>& p, EvalFunctor_0) \
49{ \
50 return *p; \
51}
52
59
60
62//
63// Count the elements in an expression.
64//
66
67template<class T, class C>
68inline int
70{
71 return p.size();
72}
73
74template<class T, class C>
75inline int
77{
78 return p.size();
79}
80
81#define DEFINE_COUNTFUNCTOR_PAE(D) \
82 \
83template<class T, class C> \
84inline int \
85for_each(const ParticleAttribElemIterator<T,D>& p, PETE_CountElems, C) \
86{ \
87 return p.getParticleAttribElem().size(); \
88}
89
96
97
99//
100// Increment the pointers in an expression.
101//
103
104template<class T, class C>
105inline int
107{
108 ++p;
109 return 0;
110}
111
112template<class T, class C>
113inline int
115{
116 ++p;
117 return 0;
118}
119
120#define DEFINE_INCFUNCTOR_PAE(D) \
121 \
122template<class T, class C> \
123inline int \
124for_each(ParticleAttribElemIterator<T,D>& p, PETE_Increment, C) \
125{ \
126 ++p; \
127 return 0; \
128}
129
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
#define DEFINE_COUNTFUNCTOR_PAE(D)
Definition: PAssignDefs.h:81
#define DEFINE_INCFUNCTOR_PAE(D)
Definition: PAssignDefs.h:120
T & for_each(ParticleAttribIterator< T > &p, EvalFunctor_0)
Definition: PAssignDefs.h:32
#define DEFINE_EVALFUNCTOR_PAE(D)
Definition: PAssignDefs.h:44