OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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
20
21// forward declarations
22template<unsigned Dim> class SIndex;
23
24// helper class used to determine if things are expressions or not
25template<bool IsExpr> class SIExprTag { };
26
27
29
30// SIndex = Expression
31template<unsigned Dim, class RHS, class OP, bool IsExpr>
32void
34
35
37
38// a macro for creating different assignment operators for SIndex objects
39#define SI_ASSIGNMENT_FUNCTIONS(FUNC,OP) \
40 \
41template<unsigned Dim, class RHS> \
42inline void \
43FUNC(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 \
49template<unsigned Dim, class RHS> \
50inline void \
51FUNC(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 \
60template<unsigned Dim, class RHS> \
61inline void \
62FUNC(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 ***************************************************************************/
void assign(SIndex< Dim > &, RHS, OP, const NDIndex< Dim > &, SIExprTag< IsExpr >)
#define SI_ASSIGNMENT_FUNCTIONS(FUNC, OP)
Definition: SIndexAssign.h:39
#define SI_ASSIGNMENT_OPERATORS(FUNC, OP)
Definition: SIndexAssign.h:58
Definition: SIndex.h:64