00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <OpenFOAM/scalarFieldField.H>
00027
00028 #define TEMPLATE template<template<class> class Field, class Type>
00029 #include <OpenFOAM/FieldFieldFunctionsM.H>
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 template<template<class> class Field, class Type>
00039 void component
00040 (
00041 FieldField<Field, typename FieldField<Field, Type>::cmptType>& sf,
00042 const FieldField<Field, Type>& f,
00043 const direction d
00044 );
00045
00046 template<template<class> class Field, class Type>
00047 void T(FieldField<Field, Type>& f1, const FieldField<Field, Type>& f2);
00048
00049
00050 template<template<class> class Field, class Type, int r>
00051 void pow
00052 (
00053 FieldField<Field, typename powProduct<Type, r>::type>& f,
00054 const FieldField<Field, Type>& vf
00055 );
00056
00057 template<template<class> class Field, class Type, int r>
00058 tmp<FieldField<Field, typename powProduct<Type, r>::type> >
00059 pow
00060 (
00061 const FieldField<Field, Type>& f, typename powProduct<Type, r>::type
00062 = pTraits<typename powProduct<Type, r>::type>::zero
00063 );
00064
00065 template<template<class> class Field, class Type, int r>
00066 tmp<FieldField<Field, typename powProduct<Type, r>::type> >
00067 pow
00068 (
00069 const tmp<FieldField<Field, Type> >& tf, typename powProduct<Type, r>::type
00070 = pTraits<typename powProduct<Type, r>::type>::zero
00071 );
00072
00073
00074 template<template<class> class Field, class Type>
00075 void sqr
00076 (
00077 FieldField<Field, typename outerProduct<Type, Type>::type>& f,
00078 const FieldField<Field, Type>& vf
00079 );
00080
00081 template<template<class> class Field, class Type>
00082 tmp<FieldField<Field, typename outerProduct<Type, Type>::type> >
00083 sqr(const FieldField<Field, Type>& f);
00084
00085 template<template<class> class Field, class Type>
00086 tmp<FieldField<Field, typename outerProduct<Type, Type>::type> >
00087 sqr(const tmp<FieldField<Field, Type> >& tf);
00088
00089 template<template<class> class Field, class Type>
00090 void magSqr(FieldField<Field, scalar>& sf, const FieldField<Field, Type>& f);
00091
00092 template<template<class> class Field, class Type>
00093 tmp<FieldField<Field, scalar> > magSqr(const FieldField<Field, Type>& f);
00094
00095 template<template<class> class Field, class Type>
00096 tmp<FieldField<Field, scalar> > magSqr(const tmp<FieldField<Field, Type> >& tf);
00097
00098 template<template<class> class Field, class Type>
00099 void mag(FieldField<Field, scalar>& sf, const FieldField<Field, Type>& f);
00100
00101 template<template<class> class Field, class Type>
00102 tmp<FieldField<Field, scalar> > mag(const FieldField<Field, Type>& f);
00103
00104 template<template<class> class Field, class Type>
00105 tmp<FieldField<Field, scalar> > mag(const tmp<FieldField<Field, Type> >& tf);
00106
00107
00108 template<template<class> class Field, class Type>
00109 void cmptMax
00110 (
00111 FieldField<Field, typename FieldField<Field, Type>::cmptType>& cf,
00112 const FieldField<Field, Type>& f
00113 );
00114
00115 template<template<class> class Field, class Type>
00116 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType> > cmptMax
00117 (
00118 const FieldField<Field, Type>& f
00119 );
00120
00121 template<template<class> class Field, class Type>
00122 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType> > cmptMax
00123 (
00124 const tmp<FieldField<Field, Type> >& tf
00125 );
00126
00127
00128 template<template<class> class Field, class Type>
00129 void cmptMin
00130 (
00131 FieldField<Field, typename FieldField<Field, Type>::cmptType>& cf,
00132 const FieldField<Field, Type>& f
00133 );
00134
00135 template<template<class> class Field, class Type>
00136 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType> > cmptMin
00137 (
00138 const FieldField<Field, Type>& f
00139 );
00140
00141 template<template<class> class Field, class Type>
00142 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType> > cmptMin
00143 (
00144 const tmp<FieldField<Field, Type> >& tf
00145 );
00146
00147
00148 template<template<class> class Field, class Type>
00149 void cmptAv
00150 (
00151 FieldField<Field, typename FieldField<Field, Type>::cmptType>& cf,
00152 const FieldField<Field, Type>& f
00153 );
00154
00155 template<template<class> class Field, class Type>
00156 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType> > cmptAv
00157 (
00158 const FieldField<Field, Type>& f
00159 );
00160
00161 template<template<class> class Field, class Type>
00162 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType> > cmptAv
00163 (
00164 const tmp<FieldField<Field, Type> >& tf
00165 );
00166
00167
00168 template<template<class> class Field, class Type>
00169 void cmptMag
00170 (
00171 FieldField<Field, Type>& cf,
00172 const FieldField<Field, Type>& f
00173 );
00174
00175 template<template<class> class Field, class Type>
00176 tmp<FieldField<Field, Type> > cmptMag
00177 (
00178 const FieldField<Field, Type>& f
00179 );
00180
00181 template<template<class> class Field, class Type>
00182 tmp<FieldField<Field, Type> > cmptMag
00183 (
00184 const tmp<FieldField<Field, Type> >& tf
00185 );
00186
00187
00188 #define TMP_UNARY_FUNCTION(returnType, func) \
00189 \
00190 template<template<class> class Field, class Type> \
00191 returnType func(const tmp<FieldField<Field, Type> >& tf1);
00192
00193 template<template<class> class Field, class Type>
00194 Type max(const FieldField<Field, Type>& f);
00195
00196 TMP_UNARY_FUNCTION(Type, max)
00197
00198 template<template<class> class Field, class Type>
00199 Type min(const FieldField<Field, Type>& f);
00200
00201 TMP_UNARY_FUNCTION(Type, min)
00202
00203 template<template<class> class Field, class Type>
00204 Type sum(const FieldField<Field, Type>& f);
00205
00206 TMP_UNARY_FUNCTION(Type, sum)
00207
00208 template<template<class> class Field, class Type>
00209 scalar sumMag(const FieldField<Field, Type>& f);
00210
00211 TMP_UNARY_FUNCTION(scalar, sumMag)
00212
00213 template<template<class> class Field, class Type>
00214 Type average(const FieldField<Field, Type>& f);
00215
00216 TMP_UNARY_FUNCTION(Type, average)
00217
00218
00219 #define G_UNARY_FUNCTION(returnType, gFunc, func, rFunc) \
00220 \
00221 template<template<class> class Field, class Type> \
00222 returnType gFunc(const FieldField<Field, Type>& f); \
00223 TMP_UNARY_FUNCTION(returnType, gFunc)
00224
00225 G_UNARY_FUNCTION(Type, gMax, max, max)
00226 G_UNARY_FUNCTION(Type, gMin, min, min)
00227 G_UNARY_FUNCTION(Type, gSum, sum, sum)
00228 G_UNARY_FUNCTION(scalar, gSumMag, sumMag, sum)
00229
00230 #undef G_UNARY_FUNCTION
00231
00232
00233 template<template<class> class Field, class Type>
00234 Type gAverage(const FieldField<Field, Type>& f);
00235
00236 TMP_UNARY_FUNCTION(Type, gAverage)
00237
00238 #undef TMP_UNARY_FUNCTION
00239
00240
00241 BINARY_FUNCTION(Type, Type, Type, max)
00242 BINARY_FUNCTION(Type, Type, Type, min)
00243 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
00244 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
00245
00246 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
00247 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
00248 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
00249 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
00250
00251
00252
00253
00254 UNARY_OPERATOR(Type, Type, -, negate)
00255
00256 #ifndef __INTEL_COMPILER
00257 BINARY_OPERATOR(Type, Type, scalar, *, multiply)
00258 BINARY_OPERATOR(Type, scalar, Type, *, multiply)
00259 #endif
00260 BINARY_OPERATOR(Type, Type, scalar, /, divide)
00261
00262 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, multiply)
00263 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, multiply)
00264
00265 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide)
00266
00267
00268
00269
00270 #define PRODUCT_OPERATOR(product, op, opFunc) \
00271 \
00272 template<template<class> class Field, class Type1, class Type2> \
00273 void opFunc \
00274 ( \
00275 FieldField<Field, typename product<Type1, Type2>::type>& f, \
00276 const FieldField<Field, Type1>& f1, \
00277 const FieldField<Field, Type2>& f2 \
00278 ); \
00279 \
00280 template<template<class> class Field, class Type1, class Type2> \
00281 tmp<FieldField<Field, typename product<Type1, Type2>::type> > \
00282 operator op \
00283 ( \
00284 const FieldField<Field, Type1>& f1, \
00285 const FieldField<Field, Type2>& f2 \
00286 ); \
00287 \
00288 template<template<class> class Field, class Type1, class Type2> \
00289 tmp<FieldField<Field, typename product<Type1, Type2>::type> > \
00290 operator op \
00291 ( \
00292 const FieldField<Field, Type1>& f1, \
00293 const tmp<FieldField<Field, Type2> >& tf2 \
00294 ); \
00295 \
00296 template<template<class> class Field, class Type1, class Type2> \
00297 tmp<FieldField<Field, typename product<Type1, Type2>::type> > \
00298 operator op \
00299 ( \
00300 const tmp<FieldField<Field, Type1> >& tf1, \
00301 const FieldField<Field, Type2>& f2 \
00302 ); \
00303 \
00304 template<template<class> class Field, class Type1, class Type2> \
00305 tmp<FieldField<Field, typename product<Type1, Type2>::type> > \
00306 operator op \
00307 ( \
00308 const tmp<FieldField<Field, Type1> >& tf1, \
00309 const tmp<FieldField<Field, Type2> >& tf2 \
00310 ); \
00311 \
00312 template \
00313 <template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
00314 void opFunc \
00315 ( \
00316 FieldField<Field, typename product<Type, Form>::type>& f, \
00317 const FieldField<Field, Type>& f1, \
00318 const VectorSpace<Form,Cmpt,nCmpt>& vs \
00319 ); \
00320 \
00321 template \
00322 <template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
00323 tmp<FieldField<Field, typename product<Type, Form>::type> > \
00324 operator op \
00325 ( \
00326 const FieldField<Field, Type>& f1, \
00327 const VectorSpace<Form,Cmpt,nCmpt>& vs \
00328 ); \
00329 \
00330 template \
00331 <template<class> class Field, class Type, class Form, class Cmpt, int nCmpt> \
00332 tmp<FieldField<Field, typename product<Type, Form>::type> > \
00333 operator op \
00334 ( \
00335 const tmp<FieldField<Field, Type> >& tf1, \
00336 const VectorSpace<Form,Cmpt,nCmpt>& vs \
00337 ); \
00338 \
00339 template \
00340 <template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
00341 void opFunc \
00342 ( \
00343 FieldField<Field, typename product<Form, Type>::type>& f, \
00344 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
00345 const FieldField<Field, Type>& f1 \
00346 ); \
00347 \
00348 template \
00349 <template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
00350 tmp<FieldField<Field, typename product<Form, Type>::type> > \
00351 operator op \
00352 ( \
00353 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
00354 const FieldField<Field, Type>& f1 \
00355 ); \
00356 \
00357 template \
00358 <template<class> class Field, class Form, class Cmpt, int nCmpt, class Type> \
00359 tmp<FieldField<Field, typename product<Form, Type>::type> > \
00360 operator op \
00361 ( \
00362 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
00363 const tmp<FieldField<Field, Type> >& tf1 \
00364 );
00365
00366 PRODUCT_OPERATOR(typeOfSum, +, add)
00367 PRODUCT_OPERATOR(typeOfSum, -, subtract)
00368
00369 PRODUCT_OPERATOR(outerProduct, *, outer)
00370 PRODUCT_OPERATOR(crossProduct, ^, cross)
00371 PRODUCT_OPERATOR(innerProduct, &, dot)
00372 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
00373
00374 #undef PRODUCT_OPERATOR
00375
00376
00377
00378
00379 }
00380
00381
00382
00383 #include <OpenFOAM/undefFieldFunctionsM.H>
00384
00385