00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TSV_META_UNARY_H
00012 #define TSV_META_UNARY_H
00013
00015
00016
00017
00019
00020 template<class T1, class OP> struct TSV_MetaUnary {};
00021
00023
00024
00025
00027
00028 template<class T1, class OP, unsigned D>
00029 struct TSV_MetaUnary< Vektor<T1,D> , OP >
00030 {
00031 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00032 inline static Vektor<T0,D>
00033 apply(const Vektor<T1,D>& lhs) {
00034 Vektor<T0,D> ret;
00035 for (unsigned d=0; d<D; ++d)
00036 ret[d] = PETE_apply(OP(),lhs[d]);
00037 return ret;
00038 }
00039 };
00040
00042
00043
00044
00046
00047 template<class T1, class OP>
00048 struct TSV_MetaUnary< Vektor<T1,1> , OP >
00049 {
00050 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00051 inline static Vektor<T0,1>
00052 apply(const Vektor<T1,1>& lhs) {
00053 return Vektor<T0,1>( PETE_apply( OP(), lhs[0] ) );
00054 }
00055 };
00056
00058
00059
00060
00062
00063 template<class T1, class OP>
00064 struct TSV_MetaUnary< Vektor<T1,2> , OP >
00065 {
00066 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00067 inline static Vektor<T0,2>
00068 apply(const Vektor<T1,2>& lhs) {
00069 return Vektor<T0,2>( PETE_apply( OP(), lhs[0] ) ,
00070 PETE_apply( OP(), lhs[1] ) );
00071 }
00072 };
00073
00075
00076
00077
00079
00080 template<class T1, class OP>
00081 struct TSV_MetaUnary< Vektor<T1,3> , OP >
00082 {
00083 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00084 inline static Vektor<T0,3>
00085 apply(const Vektor<T1,3>& lhs) {
00086 return Vektor<T0,3>( PETE_apply( OP(), lhs[0] ) ,
00087 PETE_apply( OP(), lhs[1] ) ,
00088 PETE_apply( OP(), lhs[2] ) );
00089 }
00090 };
00091
00093
00094
00095
00097
00098 template<class T1, class OP, unsigned D>
00099 struct TSV_MetaUnary< Tenzor<T1,D> , OP >
00100 {
00101 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00102 inline static Tenzor<T0,D>
00103 apply(const Tenzor<T1,D>& lhs) {
00104 Tenzor<T0,D> ret;
00105 for (unsigned d=0; d<D*D; ++d)
00106 ret[d] = PETE_apply(OP(),lhs[d]);
00107 return ret;
00108 }
00109 };
00110
00112
00113
00114
00116
00117 template<class T1, class OP>
00118 struct TSV_MetaUnary< Tenzor<T1,1> , OP >
00119 {
00120 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00121 inline static Tenzor<T0,1>
00122 apply(const Tenzor<T1,1>& lhs) {
00123 return Tenzor<T0,1>( PETE_apply( OP(), lhs[0] ) );
00124 }
00125 };
00126
00128
00129
00130
00132
00133 template<class T1, class OP>
00134 struct TSV_MetaUnary< Tenzor<T1,2> , OP >
00135 {
00136 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00137 inline static Tenzor<T0,2>
00138 apply(const Tenzor<T1,2>& lhs) {
00139 return Tenzor<T0,2>( PETE_apply( OP(), lhs[0] ) ,
00140 PETE_apply( OP(), lhs[1] ) ,
00141 PETE_apply( OP(), lhs[2] ) ,
00142 PETE_apply( OP(), lhs[3] ) );
00143 }
00144 };
00145
00147
00148
00149
00151
00152 template<class T1, class OP>
00153 struct TSV_MetaUnary< Tenzor<T1,3> , OP >
00154 {
00155 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00156 inline static Tenzor<T0,3>
00157 apply(const Tenzor<T1,3>& lhs) {
00158 return Tenzor<T0,3>( PETE_apply( OP(), lhs[0] ) ,
00159 PETE_apply( OP(), lhs[1] ) ,
00160 PETE_apply( OP(), lhs[2] ) ,
00161 PETE_apply( OP(), lhs[3] ) ,
00162 PETE_apply( OP(), lhs[4] ) ,
00163 PETE_apply( OP(), lhs[5] ) ,
00164 PETE_apply( OP(), lhs[6] ) ,
00165 PETE_apply( OP(), lhs[7] ) ,
00166 PETE_apply( OP(), lhs[8] ) );
00167 }
00168 };
00169
00171
00172
00173
00175
00176 template<class T1, class OP, unsigned D>
00177 struct TSV_MetaUnary< SymTenzor<T1,D> , OP >
00178 {
00179 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00180 inline static SymTenzor<T0,D>
00181 apply(const SymTenzor<T1,D>& lhs) {
00182 SymTenzor<T0,D> ret;
00183 for (unsigned d=0; d<D*(D+1)/2; ++d)
00184 ret[d] = PETE_apply(OP(),lhs[d]);
00185 return ret;
00186 }
00187 };
00188
00190
00191
00192
00194
00195 template<class T1, class OP>
00196 struct TSV_MetaUnary< SymTenzor<T1,1> , OP >
00197 {
00198 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00199 inline static SymTenzor<T0,1>
00200 apply(const SymTenzor<T1,1>& lhs) {
00201 return SymTenzor<T0,1>( PETE_apply( OP(), lhs[0] ) );
00202 }
00203 };
00204
00206
00207
00208
00210
00211 template<class T1, class OP>
00212 struct TSV_MetaUnary< SymTenzor<T1,2> , OP >
00213 {
00214 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00215 inline static SymTenzor<T0,2>
00216 apply(const SymTenzor<T1,2>& lhs) {
00217 return SymTenzor<T0,2>( PETE_apply( OP(), lhs[0] ) ,
00218 PETE_apply( OP(), lhs[1] ) ,
00219 PETE_apply( OP(), lhs[2] ) );
00220 }
00221 };
00222
00224
00225
00226
00228
00229 template<class T1, class OP>
00230 struct TSV_MetaUnary< SymTenzor<T1,3> , OP >
00231 {
00232 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00233 inline static SymTenzor<T0,3>
00234 apply(const SymTenzor<T1,3>& lhs) {
00235 return SymTenzor<T0,3>( PETE_apply( OP(), lhs[0] ) ,
00236 PETE_apply( OP(), lhs[1] ) ,
00237 PETE_apply( OP(), lhs[2] ) ,
00238 PETE_apply( OP(), lhs[3] ) ,
00239 PETE_apply( OP(), lhs[4] ) ,
00240 PETE_apply( OP(), lhs[5] ) );
00241 }
00242 };
00243
00245
00246
00247
00249
00250 template<class T1, class OP, unsigned D>
00251 struct TSV_MetaUnary< AntiSymTenzor<T1,D> , OP >
00252 {
00253 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00254 inline static AntiSymTenzor<T0,D>
00255 apply(const AntiSymTenzor<T1,D>& lhs) {
00256 AntiSymTenzor<T0,D> ret;
00257 for (unsigned d=0; d<D*(D-1)/2; ++d)
00258 ret[d] = PETE_apply(OP(),lhs[d]);
00259 return ret;
00260 }
00261 };
00262
00264
00265
00266
00268
00269 template<class T1, class OP>
00270 struct TSV_MetaUnary< AntiSymTenzor<T1,1> , OP >
00271 {
00272 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00273 inline static AntiSymTenzor<T0,1>
00274 apply(const AntiSymTenzor<T1,1>& lhs) {
00275 return AntiSymTenzor<T0,1>( PETE_apply( OP(), lhs[0] ) );
00276 }
00277 };
00278
00280
00281
00282
00284
00285 template<class T1, class OP>
00286 struct TSV_MetaUnary< AntiSymTenzor<T1,2> , OP >
00287 {
00288 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00289 inline static AntiSymTenzor<T0,2>
00290 apply(const AntiSymTenzor<T1,2>& lhs) {
00291 return AntiSymTenzor<T0,2>( PETE_apply( OP(), lhs[0] ) );
00292 }
00293 };
00294
00296
00297
00298
00300
00301 template<class T1, class OP>
00302 struct TSV_MetaUnary< AntiSymTenzor<T1,3> , OP >
00303 {
00304 typedef typename PETEUnaryReturn<T1,OP>::type T0;
00305 inline static AntiSymTenzor<T0,3>
00306 apply(const AntiSymTenzor<T1,3>& lhs) {
00307 return AntiSymTenzor<T0,3>( PETE_apply( OP(), lhs[0] ) ,
00308 PETE_apply( OP(), lhs[1] ) ,
00309 PETE_apply( OP(), lhs[2] ) );
00310 }
00311 };
00312
00314
00315 #endif // TSV_META_UNARY_H
00316
00317
00318
00319
00320
00321
00322