OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
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
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&
33 {
34  return *p;
35 }
36 
37 template<class T>
38 inline const T&
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 
59 
60 
62 //
63 // Count the elements in an expression.
64 //
66 
67 template<class T, class C>
68 inline int
70 {
71  return p.size();
72 }
73 
74 template<class T, class C>
75 inline int
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 
96 
97 
99 //
100 // Increment the pointers in an expression.
101 //
103 
104 template<class T, class C>
105 inline int
107 {
108  ++p;
109  return 0;
110 }
111 
112 template<class T, class C>
113 inline int
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 
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 
T & for_each(ParticleAttribIterator< T > &p, EvalFunctor_0)
Definition: PAssignDefs.h:32
#define DEFINE_COUNTFUNCTOR_PAE(D)
Definition: PAssignDefs.h:81
#define DEFINE_INCFUNCTOR_PAE(D)
Definition: PAssignDefs.h:120
#define DEFINE_EVALFUNCTOR_PAE(D)
Definition: PAssignDefs.h:44