OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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 
22 
24 //
25 // Evaluation functor.
26 //
28 
29 template<class T>
30 inline T&
32 {
33  return *p;
34 }
35 
36 template<class T>
37 inline const T&
39 {
40  return *p;
41 }
42 
43 #define DEFINE_EVALFUNCTOR_PAE(D) \
44  \
45 template<class T> \
46 inline typename AppTypeTraits<T>::Element_t& \
47 for_each(ParticleAttribElemIterator<T,D>& p, EvalFunctor_0) \
48 { \
49  return *p; \
50 }
51 
58 
59 
61 //
62 // Count the elements in an expression.
63 //
65 
66 template<class T, class C>
67 inline int
69 {
70  return p.size();
71 }
72 
73 template<class T, class C>
74 inline int
76 {
77  return p.size();
78 }
79 
80 #define DEFINE_COUNTFUNCTOR_PAE(D) \
81  \
82 template<class T, class C> \
83 inline int \
84 for_each(const ParticleAttribElemIterator<T,D>& p, PETE_CountElems, C) \
85 { \
86  return p.getParticleAttribElem().size(); \
87 }
88 
95 
96 
98 //
99 // Increment the pointers in an expression.
100 //
102 
103 template<class T, class C>
104 inline int
106 {
107  ++p;
108  return 0;
109 }
110 
111 template<class T, class C>
112 inline int
114 {
115  ++p;
116  return 0;
117 }
118 
119 #define DEFINE_INCFUNCTOR_PAE(D) \
120  \
121 template<class T, class C> \
122 inline int \
123 for_each(ParticleAttribElemIterator<T,D>& p, PETE_Increment, C) \
124 { \
125  ++p; \
126  return 0; \
127 }
128 
135 
136 
137 
138 #endif // PASSIGN_DEFS_H
139 
140 /***************************************************************************
141  * $RCSfile: PAssignDefs.h,v $ $Author: adelmann $
142  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
143  * IPPL_VERSION_ID: $Id: PAssignDefs.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
144  ***************************************************************************/
145 
Definition: rbendmap.h:8
#define DEFINE_INCFUNCTOR_PAE(D)
Definition: PAssignDefs.h:119
#define DEFINE_COUNTFUNCTOR_PAE(D)
Definition: PAssignDefs.h:80
bool for_each(const BareFieldIterator< T, D > &p, SameFieldID s, C)
Definition: AssignDefs.h:30
#define DEFINE_EVALFUNCTOR_PAE(D)
Definition: PAssignDefs.h:43