00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef PASSIGN_H
00012 #define PASSIGN_H
00013
00014
00015 #include "Particle/PAssignDefs.h"
00016 #include "PETE/IpplExpressions.h"
00017 #include "AppTypes/AppTypeTraits.h"
00018
00019
00021
00022
00023 template<class T, class RHS, class OP>
00024 void
00025 assign(const ParticleAttrib<T>& a, RHS b, OP op);
00026
00027
00028 template<class T, unsigned Dim, class RHS, class OP>
00029 void
00030 assign(const ParticleAttribElem<T,Dim>& a, RHS b, OP op);
00031
00032
00034
00035
00036
00037 template<class T, class OP>
00038 inline void
00039 assign(const ParticleAttrib<T>& a, const T& b, OP op)
00040 {
00041 assign(a, PETE_Scalar<T>(b), op);
00042 }
00043
00044
00045 template<class T, unsigned D, class OP>
00046 inline void
00047 assign(const ParticleAttribElem<T,D>& a,
00048 const typename AppTypeTraits<T>::Element_t& b, OP op)
00049 {
00050 assign(a, PETE_Scalar<typename AppTypeTraits<T>::Element_t>(b), op);
00051 }
00052
00053
00055
00056 #ifdef __MWERKS__
00057 #define ASSIGNMENT_OPERATORS_PTCL(FUNC,OP) \
00058 \
00059 template<class T, unsigned D, class RHS> \
00060 inline void \
00061 FUNC(const ParticleAttribElem<T,D>& lhs, const PETE_Expr<RHS>& rhs) \
00062 { \
00063 assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
00064 } \
00065 \
00066 template<class T, unsigned D> \
00067 inline void \
00068 FUNC(ParticleAttribElem<T,D>& lhs, \
00069 typename AppTypeTraits<T>::Element_t rhs) \
00070 { \
00071 assign(lhs,PETE_Scalar<typename AppTypeTraits<T>::Element_t>(rhs),OP()); \
00072 } \
00073 \
00074 template<class T, class RHS> \
00075 inline void \
00076 FUNC(const ParticleAttrib<T>& lhs, const PETE_Expr<RHS>& rhs) \
00077 { \
00078 assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
00079 } \
00080 \
00081 template<class T> \
00082 inline void \
00083 FUNC(const ParticleAttrib<T>& lhs, T rhs) \
00084 { \
00085 assign(lhs,PETE_Scalar<T>(rhs),OP()); \
00086 }
00087
00088
00089 #else
00090 #define ASSIGNMENT_OPERATORS_PTCL(FUNC,OP) \
00091 \
00092 template<class T, unsigned D, class RHS> \
00093 inline void \
00094 FUNC(const ParticleAttribElem<T,D>& lhs, const PETE_Expr<RHS>& rhs) \
00095 { \
00096 assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
00097 } \
00098 \
00099 template<class T, unsigned D> \
00100 inline void \
00101 FUNC(const ParticleAttribElem<T,D>& lhs, \
00102 typename AppTypeTraits<T>::Element_t rhs) \
00103 { \
00104 assign(lhs,PETE_Scalar<typename AppTypeTraits<T>::Element_t>(rhs),OP()); \
00105 } \
00106 \
00107 template<class T, class RHS> \
00108 inline void \
00109 FUNC(const ParticleAttrib<T>& lhs, const PETE_Expr<RHS>& rhs) \
00110 { \
00111 assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
00112 } \
00113 \
00114 template<class T> \
00115 inline void \
00116 FUNC(const ParticleAttrib<T>& lhs, T rhs) \
00117 { \
00118 assign(lhs,PETE_Scalar<T>(rhs),OP()); \
00119 }
00120 #endif // __MWERKS__
00121
00122 ASSIGNMENT_OPERATORS_PTCL(assign,OpAssign)
00123 ASSIGNMENT_OPERATORS_PTCL(operator<<,OpAssign)
00124 ASSIGNMENT_OPERATORS_PTCL(operator+=,OpAddAssign)
00125 ASSIGNMENT_OPERATORS_PTCL(operator-=,OpSubtractAssign)
00126 ASSIGNMENT_OPERATORS_PTCL(operator*=,OpMultipplyAssign)
00127 ASSIGNMENT_OPERATORS_PTCL(operator/=,OpDivideAssign)
00128 ASSIGNMENT_OPERATORS_PTCL(mineq,OpMinAssign)
00129 ASSIGNMENT_OPERATORS_PTCL(maxeq,OpMaxAssign)
00130
00131 #include "Particle/PAssign.cpp"
00132
00133 #endif // PASSIGN_H
00134
00135
00136
00137
00138
00139