OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
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 {
51 }
52 
53 
55 
56 #define ASSIGNMENT_OPERATORS_PTCL(FUNC,OP) \
57  \
58 template<class T, unsigned D, class RHS> \
59 inline void \
60 FUNC(const ParticleAttribElem<T,D>& lhs, const PETE_Expr<RHS>& rhs) \
61 { \
62  assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
63 } \
64  \
65 template<class T, unsigned D> \
66 inline void \
67 FUNC(const ParticleAttribElem<T,D>& lhs, \
68  typename AppTypeTraits<T>::Element_t rhs) \
69 { \
70  assign(lhs,PETE_Scalar<typename AppTypeTraits<T>::Element_t>(rhs),OP()); \
71 } \
72  \
73 template<class T, class RHS> \
74 inline void \
75 FUNC(const ParticleAttrib<T>& lhs, const PETE_Expr<RHS>& rhs) \
76 { \
77  assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
78 } \
79  \
80 template<class T> \
81 inline void \
82 FUNC(const ParticleAttrib<T>& lhs, T rhs) \
83 { \
84  assign(lhs,PETE_Scalar<T>(rhs),OP()); \
85 }
86 
95 
96 #include "Particle/PAssign.hpp"
97 
98 #endif // PASSIGN_H
99 
100 /***************************************************************************
101  * $RCSfile: PAssign.h,v $ $Author: adelmann $
102  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
103  * IPPL_VERSION_ID: $Id: PAssign.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
104  ***************************************************************************/
void maxeq(const ParticleAttribElem< T, D > &lhs, const PETE_Expr< RHS > &rhs)
Definition: PAssign.h:94
#define ASSIGNMENT_OPERATORS_PTCL(FUNC, OP)
Definition: PAssign.h:56
void assign(const ParticleAttrib< T > &a, RHS b, OP op)
Definition: PAssign.hpp:58
void mineq(const ParticleAttribElem< T, D > &lhs, const PETE_Expr< RHS > &rhs)
Definition: PAssign.h:93
std::complex< double > a
T::Element_t Element_t
Definition: AppTypeTraits.h:19