OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
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"
32#include "Utility/IpplStats.h"
33
34
35
37
38template<class T, unsigned Dim, class RHS, class OP>
39void
40assign(const ParticleAttribElem<T,Dim>& ca, RHS b, OP op)
41{
42 // Cast away Const-ness. Aarrgghh!!
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()) );
51 }
52
53 INCIPPLSTAT(incParticleExpressions);
54}
55
56template<class T, class RHS, class OP>
57void
58assign(const ParticleAttrib<T>& ca, RHS b, OP op)
59{
60 // Cast away Const-ness. Aarrgghh!!
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()) );
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 ***************************************************************************/
bool for_each(const BareFieldIterator< T, D > &p, SameFieldID s, C)
Definition: AssignDefs.h:30
void PETE_apply(const OpPeriodic< T > &, T &a, const T &b)
Definition: BCond.hpp:353
std::complex< double > a
void assign(const ParticleAttribElem< T, Dim > &ca, RHS b, OP op)
Definition: PAssign.hpp:40
#define INCIPPLSTAT(stat)
Definition: IpplStats.h:236
WrappedExpr & PETE_unwrap()
Definition: PETE.h:81