OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
SIndexAssign.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 SINDEX_ASSIGN_H
12 #define SINDEX_ASSIGN_H
13 
14 /***************************************************************************
15  Special versions of assign which take SIndex objects on the left-hand side
16  ***************************************************************************/
17 
18 // include files
19 #include "PETE/IpplExpressions.h"
20 
21 // forward declarations
22 template<unsigned Dim> class SIndex;
23 
24 // helper class used to determine if things are expressions or not
25 template<bool IsExpr> class SIExprTag { };
26 
27 
29 
30 // SIndex = Expression
31 template<unsigned Dim, class RHS, class OP, bool IsExpr>
32 void
34 
35 
37 
38 // a macro for creating different assignment operators for SIndex objects
39 #define SI_ASSIGNMENT_FUNCTIONS(FUNC,OP) \
40  \
41 template<unsigned Dim, class RHS> \
42 inline void \
43 FUNC(SIndex<Dim>& lhs, const PETE_Expr<RHS>& rhs) \
44 { \
45  assign(lhs, rhs.PETE_unwrap().MakeExpression(), OP(), \
46  lhs.getFieldLayout().getDomain(), SIExprTag<false>()); \
47 } \
48  \
49 template<unsigned Dim, class RHS> \
50 inline void \
51 FUNC(SIndex<Dim>& lhs, const PETE_Expr<RHS>& rhs, \
52  const NDIndex<Dim>& domain) \
53 { \
54  assign(lhs, rhs.PETE_unwrap().MakeExpression(), OP(), \
55  domain, SIExprTag<true>()); \
56 }
57 
58 #define SI_ASSIGNMENT_OPERATORS(FUNC,OP) \
59  \
60 template<unsigned Dim, class RHS> \
61 inline void \
62 FUNC(SIndex<Dim>& lhs, const PETE_Expr<RHS>& rhs) \
63 { \
64  assign(lhs, rhs.PETE_unwrap().MakeExpression(), OP(), \
65  lhs.getFieldLayout().getDomain(), SIExprTag<false>()); \
66 }
67 
68 
69 
70 // use the macro to create a number of different assign functions which
71 // will in turn call the general SIndex = expression version of assign
76 
77 #include "Index/SIndexAssign.hpp"
78 
79 #endif // SINDEX_ASSIGN_H
80 
81 /***************************************************************************
82  * $RCSfile: SIndexAssign.h,v $ $Author: adelmann $
83  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:27 $
84  * IPPL_VERSION_ID: $Id: SIndexAssign.h,v 1.1.1.1 2003/01/23 07:40:27 adelmann Exp $
85  ***************************************************************************/
Definition: SIndex.h:28
#define SI_ASSIGNMENT_FUNCTIONS(FUNC, OP)
Definition: SIndexAssign.h:39
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
#define SI_ASSIGNMENT_OPERATORS(FUNC, OP)
Definition: SIndexAssign.h:58