OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
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"
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
46 
47 
49 // SubBareField op constant
50 template<class PA, class T, unsigned Dim, class OP>
51 inline void
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 
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  ***************************************************************************/
void mineq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition: Assign.h:230
Definition: Assign.h:47
void maxeq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition: Assign.h:231
Definition: rbendmap.h:8
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
#define SUBPARTICLE_ASSIGNMENT_OPERATORS(FUNC, OP)