OPAL (Object Oriented Parallel Accelerator Library)
2022.1
OPAL
src
ippl
src
SubParticle
SubParticleAssign.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 SUB_PARTICLE_ASSIGN_H
12
#define SUB_PARTICLE_ASSIGN_H
13
14
// include files
15
#include "
Field/Assign.h
"
16
#include "
SubParticle/SubParticleAttrib.h
"
17
18
19
/***************************************************************************
20
Versions of the assign function used to assign values to a SubParticleAttrib
21
in an expression. SubParticleAssign uses information in SubParticleAssignDefs
22
for specific definitions of for_each operations used in assign.
23
24
This assignment is used to gather values from an expression at selected
25
points into a ParticleAttrib. The points used are stored in an SIndex
26
object, and only the local points are gathered. So, at the end, you will
27
have a ParticleAttrib on each processor with a length equal to the number
28
of points in the SIndex object. The syntax for this looks like
29
30
SIndex<Dim> S = (some expression)
31
ParticleAttrib<T> P;
32
BareField<T,Dim> A, B, C;
33
P[S] = A[S] * B[S] + C[S];
34
35
Or, you can use +=, -=, etc, which requires that the attribute already
36
be of the right length.
37
38
***************************************************************************/
39
40
42
// SubParticleAttrib op Expression
43
template
<
class
PA,
class
T,
unsigned
Dim,
class
RHS,
class
OP>
44
void
45
assign
(
SubParticleAttrib<PA,T,Dim>
a
, RHS b, OP op,
ExprTag<true>
);
46
47
49
// SubBareField op constant
50
template
<
class
PA,
class
T,
unsigned
Dim,
class
OP>
51
inline
void
52
assign
(
SubParticleAttrib<PA,T,Dim>
a
,
const
T
& b, OP op,
ExprTag<true>
) {
53
assign
(
a
,
PETE_Scalar<T>
(b), op,
ExprTag<true>
());
54
}
55
56
58
// SubParticleAttrib op constant
59
#define SUBPARTICLE_ASSIGNMENT_OPERATORS(FUNC,OP) \
60
\
61
template<class PA, class T, unsigned Dim> \
62
inline void \
63
FUNC(const SubParticleAttrib<PA,T,Dim>& lhs, const T& rhs) \
64
{ \
65
assign(lhs, PETE_Scalar<T>(rhs), OP(), ExprTag<true>()); \
66
}
67
68
69
SUBPARTICLE_ASSIGNMENT_OPERATORS
(
assign
,
OpAssign
)
70
SUBPARTICLE_ASSIGNMENT_OPERATORS
(operator<<,
OpAssign
)
71
SUBPARTICLE_ASSIGNMENT_OPERATORS
(operator+=,
OpAddAssign
)
72
SUBPARTICLE_ASSIGNMENT_OPERATORS
(operator-=,
OpSubtractAssign
)
73
SUBPARTICLE_ASSIGNMENT_OPERATORS
(operator*=,
OpMultipplyAssign
)
74
SUBPARTICLE_ASSIGNMENT_OPERATORS
(operator/=,
OpDivideAssign
)
75
SUBPARTICLE_ASSIGNMENT_OPERATORS
(
mineq
,
OpMinAssign
)
76
SUBPARTICLE_ASSIGNMENT_OPERATORS
(
maxeq
,
OpMaxAssign
)
77
78
#include "SubParticle/SubParticleAssign.hpp"
79
80
#endif
81
82
/***************************************************************************
83
* $RCSfile: SubParticleAssign.h,v $ $Author: adelmann $
84
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
85
* IPPL_VERSION_ID: $Id: SubParticleAssign.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
86
***************************************************************************/
SubParticleAttrib.h
SUBPARTICLE_ASSIGNMENT_OPERATORS
#define SUBPARTICLE_ASSIGNMENT_OPERATORS(FUNC, OP)
Definition:
SubParticleAssign.h:59
assign
void assign(SubParticleAttrib< PA, T, Dim > a, RHS b, OP op, ExprTag< true >)
Definition:
SubParticleAssign.hpp:54
maxeq
void maxeq(const SubParticleAttrib< PA, T, Dim > &lhs, const T &rhs)
Definition:
SubParticleAssign.h:76
mineq
void mineq(const SubParticleAttrib< PA, T, Dim > &lhs, const T &rhs)
Definition:
SubParticleAssign.h:75
Assign.h
a
std::complex< double > a
Definition:
IpplExpressions.h:56
Attrib::Legacy::Distribution::T
@ T
Definition:
Distribution.h:171
ExprTag
Definition:
Assign.h:48
OpMinAssign
Definition:
IpplTypeComputations.h:615
OpMaxAssign
Definition:
IpplTypeComputations.h:619
PETE_Scalar
Definition:
PETE.h:143
OpAssign
Definition:
TypeComputations.h:553
OpAddAssign
Definition:
TypeComputations.h:558
OpSubtractAssign
Definition:
TypeComputations.h:563
OpMultipplyAssign
Definition:
TypeComputations.h:568
OpDivideAssign
Definition:
TypeComputations.h:573
SubParticleAttrib
Definition:
SubParticleAttrib.h:150
Generated on Thu Oct 20 2022 17:40:08 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.3