OPAL (Object Oriented Parallel Accelerator Library)
2024.2
OPAL
ippl
src
Particle
PAssign.hpp
Go to the documentation of this file.
1
// -*- C++ -*-
2
/***************************************************************************
3
*
4
* The IPPL Framework
5
*
6
* This program was prepared by PSI.
7
* All rights in the program are reserved by PSI.
8
* Neither PSI nor the author(s)
9
* makes any warranty, express or implied, or assumes any liability or
10
* responsibility for the use of this software
11
*
12
* Visit www.amas.web.psi for more details
13
*
14
***************************************************************************/
15
16
// -*- C++ -*-
17
/***************************************************************************
18
*
19
* The IPPL Framework
20
*
21
*
22
* Visit http://people.web.psi.ch/adelmann/ for more details
23
*
24
***************************************************************************/
25
26
// include files
27
#include "
Particle/PAssign.h
"
28
#include "
Particle/PAssignDefs.h
"
29
#include "
Particle/ParticleAttrib.h
"
30
#include "
Particle/ParticleAttribElem.h
"
31
#include "
PETE/IpplExpressions.h
"
32
#include "
Utility/IpplStats.h
"
33
34
35
37
38
template
<
class
T,
unsigned
Dim,
class
RHS,
class
OP>
39
void
40
assign
(
const
ParticleAttribElem<T,Dim>
& ca, RHS b, OP op)
41
{
42
// Cast away Const-ness. Aarrgghh!!
43
ParticleAttribElem<T,Dim>
&
a
= (
ParticleAttribElem<T,Dim>
&) ca;
44
typename
RHS::Wrapped& bb = b.
PETE_unwrap
();
45
46
// Begin/End iterators for the ParticleAttribElem on the left hand side.
47
typename
ParticleAttribElem<T,Dim>::iterator
pa =
a
.begin(), aend =
a
.end();
48
for
( ; pa != aend ; ++pa) {
49
PETE_apply
( op, *pa,
for_each
(bb,
EvalFunctor_0
()) );
50
for_each
(bb,
PETE_Increment
(),
PETE_NullCombiner
());
51
}
52
53
INCIPPLSTAT
(incParticleExpressions);
54
}
55
56
template
<
class
T,
class
RHS,
class
OP>
57
void
58
assign
(
const
ParticleAttrib<T>
& ca, RHS b, OP op)
59
{
60
// Cast away Const-ness. Aarrgghh!!
61
ParticleAttrib<T>
&
a
= (
ParticleAttrib<T>
&) ca;
62
typename
RHS::Wrapped& bb = b.
PETE_unwrap
();
63
64
// Begin and end iterators for the ParticleAttrib on the left hand side.
65
typename
ParticleAttrib<T>::iterator
pa =
a
.begin(), aend =
a
.end();
66
for
( ; pa != aend ; ++pa) {
67
PETE_apply
( op, *pa,
for_each
(bb,
EvalFunctor_0
()) );
68
for_each
(bb,
PETE_Increment
(),
PETE_NullCombiner
());
69
}
70
71
INCIPPLSTAT
(incParticleExpressions);
72
}
73
75
76
/***************************************************************************
77
* $RCSfile: PAssign.cpp,v $ $Author: adelmann $
78
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:28 $
79
* IPPL_VERSION_ID: $Id: PAssign.cpp,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $
80
***************************************************************************/
IpplExpressions.h
a
std::complex< double > a
Definition
IpplExpressions.h:56
PETE_apply
void PETE_apply(const OpPeriodic< T > &, T &a, const T &b)
Definition
BCond.hpp:353
for_each
bool for_each(const BareFieldIterator< T, D > &p, SameFieldID s, C)
Definition
AssignDefs.h:30
ParticleAttrib.h
assign
void assign(const ParticleAttribElem< T, Dim > &ca, RHS b, OP op)
Definition
PAssign.hpp:40
PAssignDefs.h
PAssign.h
ParticleAttribElem.h
IpplStats.h
INCIPPLSTAT
#define INCIPPLSTAT(stat)
Definition
IpplStats.h:236
ParticleAttrib
Definition
ParticleAttrib.h:100
ParticleAttribIterator
Definition
ParticleAttrib.h:568
ParticleAttribElemIterator
Definition
ParticleAttribElem.h:177
ParticleAttribElem
Definition
ParticleAttribElem.h:67
PETE_Expr::PETE_unwrap
WrappedExpr & PETE_unwrap()
Definition
PETE.h:81
EvalFunctor_0
Definition
PETE.h:179
PETE_Increment
Definition
PETE.h:185
PETE_NullCombiner
Definition
PETE.h:457
Generated on Tue Apr 14 2026 07:18:44 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.8