OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
src
ippl
src
Index
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
33
assign
(
SIndex<Dim>
&, RHS, OP,
const
NDIndex<Dim>
&,
SIExprTag<IsExpr>
);
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
72
SI_ASSIGNMENT_FUNCTIONS
(
assign
,
OpAssign
)
73
SI_ASSIGNMENT_OPERATORS
(operator<<,
OpAssign
)
74
SI_ASSIGNMENT_OPERATORS
(operator|=,
OpBitwiseOrAssign
)
75
SI_ASSIGNMENT_OPERATORS
(operator&=,
OpBitwiseAndAssign
)
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
***************************************************************************/
assign
void assign(SIndex< Dim > &, RHS, OP, const NDIndex< Dim > &, SIExprTag< IsExpr >)
SI_ASSIGNMENT_FUNCTIONS
#define SI_ASSIGNMENT_FUNCTIONS(FUNC, OP)
Definition:
SIndexAssign.h:39
SI_ASSIGNMENT_OPERATORS
#define SI_ASSIGNMENT_OPERATORS(FUNC, OP)
Definition:
SIndexAssign.h:58
IpplExpressions.h
NDIndex
Definition:
NDIndex.h:74
SIndex
Definition:
SIndex.h:64
SIExprTag
Definition:
SIndexAssign.h:25
OpAssign
Definition:
TypeComputations.h:553
OpBitwiseAndAssign
Definition:
TypeComputations.h:588
OpBitwiseOrAssign
Definition:
TypeComputations.h:593
Generated on Wed Aug 25 2021 16:40:58 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.1