OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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
18
19
21
22// ParticleAttrib = Expression
23template<class T, class RHS, class OP>
24void
25assign(const ParticleAttrib<T>& a, RHS b, OP op);
26
27// ParticleAttribElem = Expression
28template<class T, unsigned Dim, class RHS, class OP>
29void
30assign(const ParticleAttribElem<T,Dim>& a, RHS b, OP op);
31
32
34
35
36// ParticleAttrib = constant;
37template<class T, class OP>
38inline void
39assign(const ParticleAttrib<T>& a, const T& b, OP op)
40{
41 assign(a, PETE_Scalar<T>(b), op);
42}
43
44// ParticleAttribElem = constant;
45template<class T, unsigned D, class OP>
46inline void
48 const typename AppTypeTraits<T>::Element_t& b, OP op)
49{
51}
52
53
55
56#define ASSIGNMENT_OPERATORS_PTCL(FUNC,OP) \
57 \
58template<class T, unsigned D, class RHS> \
59inline void \
60FUNC(const ParticleAttribElem<T,D>& lhs, const PETE_Expr<RHS>& rhs) \
61{ \
62 assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
63} \
64 \
65template<class T, unsigned D> \
66inline void \
67FUNC(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 \
73template<class T, class RHS> \
74inline void \
75FUNC(const ParticleAttrib<T>& lhs, const PETE_Expr<RHS>& rhs) \
76{ \
77 assign(lhs,rhs.PETE_unwrap().MakeExpression(),OP()); \
78} \
79 \
80template<class T> \
81inline void \
82FUNC(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 ***************************************************************************/
std::complex< double > a
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
T::Element_t Element_t
Definition: AppTypeTraits.h:19