OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
Definition:
SubParticleAttrib.h:58
ExprTag
Definition:
Assign.h:47
maxeq
void maxeq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition:
Assign.h:183
SubParticleAttrib.h
OpMultipplyAssign
Definition:
TypeComputations.h:567
assign
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
PETE_Scalar
Definition:
PETE.h:142
OpMaxAssign
Definition:
IpplTypeComputations.h:619
OpMinAssign
Definition:
IpplTypeComputations.h:615
OpAddAssign
Definition:
TypeComputations.h:557
Attrib::Legacy::Distribution::T
Definition:
Distribution.h:171
mineq
void mineq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition:
Assign.h:182
OpSubtractAssign
Definition:
TypeComputations.h:562
OpDivideAssign
Definition:
TypeComputations.h:572
OpAssign
Definition:
TypeComputations.h:552
Assign.h
SUBPARTICLE_ASSIGNMENT_OPERATORS
#define SUBPARTICLE_ASSIGNMENT_OPERATORS(FUNC, OP)
Definition:
SubParticleAssign.h:59
Generated on Tue Jul 2 2024 15:05:15 for OPAL (Object Oriented Parallel Accelerator Library) by
1.8.5