OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
SubFieldAssign.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * The IPPL Framework
4  *
5  ***************************************************************************/
6 
7 #ifndef SUB_FIELD_ASSIGN_H
8 #define SUB_FIELD_ASSIGN_H
9 
10 // include files
11 #include "Field/Assign.h"
12 
13 // forward declarations
14 template<class T, unsigned int Dim, class S> class SubBareField;
15 
16 
17 /***************************************************************************
18  Versions of the assign function used to assign values to a SubBareField
19  in an expression. SubFieldAssign uses information in SubFieldAssignDefs
20  for specific definitions of for_each operations used in assign.
21 
22  So far, only the assign function for the simple case where everything is
23  perfectly aligned is implemented ... to complete this, assign must handle
24  assigments between non-conforming layouts which requires general
25  communication. Also, support will have to be added for:
26  - Assigning single-element subfield's to scalars
27  - Slice operations between fields of unequal dimension
28  ***************************************************************************/
29 
30 
32 // SubBareField = Expression
33 template<class T1, unsigned Dim, class S, class RHS, class OP>
34 void
36 
37 
39 // SubBareField = constant
40 template<class T, unsigned D, class S, class OP>
41 inline void
42 assign(SubBareField<T,D,S> a, const T& b, OP op, ExprTag<true>) {
43  assign(a, PETE_Scalar<T>(b), op, ExprTag<true>());
44 }
45 
46 
48 
49 #define SUB_ASSIGNMENT_OPERATORS(FUNC,OP) \
50  \
51 template<class T, unsigned D, class S> \
52 inline void \
53 FUNC(const SubBareField<T,D,S>& lhs, const T& rhs) \
54 { \
55  assign(lhs,PETE_Scalar<T>(rhs), OP(),ExprTag<true>()); \
56 }
57 
58 
67 
68 #include "SubField/SubFieldAssign.hpp"
69 
70 #endif // SUB_FIELD_ASSIGN_H
Definition: Assign.h:47
void maxeq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition: Assign.h:183
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
void mineq(const PETE_Expr< LHS > &lhs, const PETE_Expr< RHS > &rhs)
Definition: Assign.h:182
#define SUB_ASSIGNMENT_OPERATORS(FUNC, OP)