OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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
18#include "AppTypes/TSVMetaDot.h"
22
23// forward declarations
24template<class T, unsigned D> class Vektor;
25template<class T, unsigned D> class Tenzor;
26template<class T, unsigned D> class SymTenzor;
27template<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 \
44template < class T1 , unsigned D > \
45inline TSV<typename PETEBinaryReturn<T1,SCA,APP>::type,D> \
46OP(const TSV<T1,D>& lhs, SCA sca) \
47{ \
48 return TSV_MetaBinaryScalar< TSV<T1,D> , SCA , APP > :: apply(lhs,sca);\
49} \
50 \
51template < class T1 , unsigned D > \
52inline TSV<typename PETEBinaryReturn<T1,SCA,APP>::type,D> \
53OP(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 \
60template < class T1, class T2, unsigned D > \
61inline TSV<typename PETEBinaryReturn<T1,T2,APP>::type,D> \
62OP(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 \
67TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,short,OP,APP) \
68TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,int,OP,APP) \
69TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,unsigned int,OP,APP) \
70TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,long,OP,APP) \
71TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,float,OP,APP) \
72TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,double,OP,APP) \
73TSV_ELEMENTWISE_OPERATOR_WITH_SCALAR(TSV,std::complex<double>,OP,APP)
74
75#define TSV_ELEMENTWISE_OPERATOR2(TSV1,TSV2,OP,APP) \
76 \
77template < class T1, class T2, unsigned D > \
78inline typename PETEBinaryReturn<TSV1<T1,D>,TSV2<T2,D>,APP>::type \
79OP(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: Tenzor.h:35
Definition: Vektor.h:32