OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
TSVMeta.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 TSV_META_H
12 #define TSV_META_H
13 
14 // include files
15 #include "AppTypes/TSVMetaAssign.h"
16 #include "AppTypes/TSVMetaUnary.h"
17 #include "AppTypes/TSVMetaBinary.h"
18 #include "AppTypes/TSVMetaDot.h"
19 #include "AppTypes/TSVMetaCross.h"
20 #include "AppTypes/TSVMetaDotDot.h"
22 
23 // forward declarations
24 template<class T, unsigned D> class Vektor;
25 template<class T, unsigned D> class Tenzor;
26 template<class T, unsigned D> class SymTenzor;
27 template<class T, unsigned D> class AntiSymTenzor;
28 
30 //
31 // Define the macro TSV_ELEMENTWISE_OPERATOR which will let
32 // Vektor, Tenzor and SymTenzor define their operators easily.
33 //
34 // The first argument of the macro is Vektor, Tenzor, SymTenzor,
35 // or AntiSymTenzor.
36 // The second is the name of the operator (like operator+).
37 // The third is the PETE tag class for that operation.
38 //
40 
41 
42 #define TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,SCA,OP,APP) \
43  \
44 template < class T1 , unsigned D > \
45 inline TSV<typename PETEBinaryReturn<T1,SCA,APP>::type,D> \
46 OP(const TSV<T1,D>& lhs, SCA sca) \
47 { \
48  return TSV_MetaBinaryScalar< TSV<T1,D> , SCA , APP > :: apply(lhs,sca);\
49 } \
50  \
51 template < class T1 , unsigned D > \
52 inline TSV<typename PETEBinaryReturn<T1,SCA,APP>::type,D> \
53 OP(SCA sca, const TSV<T1,D>& rhs) \
54 { \
55  return TSV_MetaBinaryScalar< SCA , TSV<T1,D> , APP > :: apply(sca,rhs);\
56 }
57 
58 #define TSV_ELEMENTWISE_OPERATOR(TSV,OP,APP) \
59  \
60 template < class T1, class T2, unsigned D > \
61 inline TSV<typename PETEBinaryReturn<T1,T2,APP>::type,D> \
62 OP(const TSV<T1,D> &lhs, const TSV<T2,D> &rhs) \
63 { \
64  return TSV_MetaBinary< TSV<T1,D> , TSV<T2,D> , APP > :: apply(lhs,rhs);\
65 } \
66  \
67 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,short,OP,APP) \
68 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,int,OP,APP) \
69 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,unsigned int,OP,APP) \
70 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,long,OP,APP) \
71 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,float,OP,APP) \
72 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,double,OP,APP) \
73 TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,dcomplex,OP,APP)
74 
75 #define TSV_ELEMENTWISE_OPERATOR2(TSV1,TSV2,OP,APP) \
76  \
77 template < class T1, class T2, unsigned D > \
78 inline typename PETEBinaryReturn<TSV1<T1,D>,TSV2<T2,D>,APP>::type \
79 OP(const TSV1<T1,D> &lhs, const TSV2<T2,D> &rhs) \
80 { \
81  return TSV_MetaBinary< TSV1<T1,D>, TSV2<T2,D>, APP >:: \
82  apply(lhs,rhs); \
83 }
84 
86 
87 #endif // TSV_META_H
88 
89 /***************************************************************************
90  * $RCSfile: TSVMeta.h,v $ $Author: adelmann $
91  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:24 $
92  * IPPL_VERSION_ID: $Id: TSVMeta.h,v 1.1.1.1 2003/01/23 07:40:24 adelmann Exp $
93  ***************************************************************************/
94 
Definition: TSVMeta.h:24