OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PAssign.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_H
12 #define PASSIGN_H
13 
14 // include files
15 #include "Particle/PAssignDefs.h"
16 #include "PETE/IpplExpressions.h"
17 #include "AppTypes/AppTypeTraits.h"
18 
19 
21 
22 // ParticleAttrib = Expression
23 template<class T, class RHS, class OP>
24 void
25 assign(const ParticleAttrib<T>& a, RHS b, OP op);
26 
27 // ParticleAttribElem = Expression
28 template<class T, unsigned Dim, class RHS, class OP>
29 void
30 assign(const ParticleAttribElem<T,Dim>& a, RHS b, OP op);
31 
32 
34 
35 
36 // ParticleAttrib = constant;
37 template<class T, class OP>
38 inline void
39 assign(const ParticleAttrib<T>& a, const T& b, OP op)
40 {
41  assign(a, PETE_Scalar<T>(b), op);
42 }
43 
44 // ParticleAttribElem = constant;
45 template<class T, unsigned D, class OP>
46 inline void
48  const typename AppTypeTraits<T>::Element_t& b, OP op)
49 {
50  assign(a, PETE_Scalar<typename AppTypeTraits<T>::Element_t>(b), op);
51 }
52 
53 
55 
56 #ifdef __MWERKS__
57 #define ASSIGNMENT_OPERATORS_PTCL(FUNC,OP) \
58  \
59 template<class T, unsigned D, class RHS> \
60 inline void \
61 FUNC(const ParticleAttribElem<T,D>& lhs, const PETE_Expr<RHS>& rhs) \
62 { \
63  assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
64 } \
65  \
66 template<class T, unsigned D> \
67 inline void \
68 FUNC(ParticleAttribElem<T,D>& lhs, \
69  typename AppTypeTraits<T>::Element_t rhs) \
70 { \
71  assign(lhs,PETE_Scalar<typename AppTypeTraits<T>::Element_t>(rhs),OP()); \
72 } \
73  \
74 template<class T, class RHS> \
75 inline void \
76 FUNC(const ParticleAttrib<T>& lhs, const PETE_Expr<RHS>& rhs) \
77 { \
78  assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
79 } \
80  \
81 template<class T> \
82 inline void \
83 FUNC(const ParticleAttrib<T>& lhs, T rhs) \
84 { \
85  assign(lhs,PETE_Scalar<T>(rhs),OP()); \
86 }
87 //TJW: Delete the middle third one up from here to get TestParticleDebug to
88 //TJW: compile. 12/4/98
89 #else
90 #define ASSIGNMENT_OPERATORS_PTCL(FUNC,OP) \
91  \
92 template<class T, unsigned D, class RHS> \
93 inline void \
94 FUNC(const ParticleAttribElem<T,D>& lhs, const PETE_Expr<RHS>& rhs) \
95 { \
96  assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
97 } \
98  \
99 template<class T, unsigned D> \
100 inline void \
101 FUNC(const ParticleAttribElem<T,D>& lhs, \
102  typename AppTypeTraits<T>::Element_t rhs) \
103 { \
104  assign(lhs,PETE_Scalar<typename AppTypeTraits<T>::Element_t>(rhs),OP()); \
105 } \
106  \
107 template<class T, class RHS> \
108 inline void \
109 FUNC(const ParticleAttrib<T>& lhs, const PETE_Expr<RHS>& rhs) \
110 { \
111  assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
112 } \
113  \
114 template<class T> \
115 inline void \
116 FUNC(const ParticleAttrib<T>& lhs, T rhs) \
117 { \
118  assign(lhs,PETE_Scalar<T>(rhs),OP()); \
119 }
120 #endif // __MWERKS__
121 
130 
131 #include "Particle/PAssign.hpp"
132 
133 #endif // PASSIGN_H
134 
135 /***************************************************************************
136  * $RCSfile: PAssign.h,v $ $Author: adelmann $
137  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
138  * IPPL_VERSION_ID: $Id: PAssign.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
139  ***************************************************************************/
void mineq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition: Assign.h:230
#define ASSIGNMENT_OPERATORS_PTCL(FUNC, OP)
Definition: PAssign.h:90
void maxeq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition: Assign.h:231
Definition: rbendmap.h:8
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
T::Element_t Element_t
Definition: AppTypeTraits.h:19