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
00027 #include "scalarField.H"
00028
00029 #define TEMPLATE template<class Type>
00030 #include "FieldFunctionsM.H"
00031
00032
00033
00034 namespace Foam
00035 {
00036
00037
00038
00039 template<class Type>
00040 void component
00041 (
00042 Field<typename Field<Type>::cmptType>& res,
00043 const UList<Type>& f,
00044 const direction d
00045 );
00046
00047
00048 template<class Type>
00049 void T(Field<Type>& res, const UList<Type>& f);
00050
00051
00052 template<class Type, int r>
00053 void pow
00054 (
00055 Field<typename powProduct<Type, r>::type>& res,
00056 const UList<Type>& vf
00057 );
00058
00059
00060 template<class Type, int r>
00061 tmp<Field<typename powProduct<Type, r>::type> >
00062 pow
00063 (
00064 const UList<Type>& f,
00065 typename powProduct<Type, r>::type
00066 = pTraits<typename powProduct<Type, r>::type>::zero
00067 );
00068
00069 template<class Type, int r>
00070 tmp<Field<typename powProduct<Type, r>::type> >
00071 pow
00072 (
00073 const tmp<Field<Type> >& tf,
00074 typename powProduct<Type, r>::type
00075 = pTraits<typename powProduct<Type, r>::type>::zero
00076 );
00077
00078
00079 template<class Type>
00080 void sqr
00081 (
00082 Field<typename outerProduct<Type, Type>::type>& res,
00083 const UList<Type>& vf
00084 );
00085
00086 template<class Type>
00087 tmp<Field<typename outerProduct<Type, Type>::type> >
00088 sqr(const UList<Type>& f);
00089
00090 template<class Type>
00091 tmp<Field<typename outerProduct<Type, Type>::type> >
00092 sqr(const tmp<Field<Type> >& tf);
00093
00094
00095 template<class Type>
00096 void magSqr(Field<scalar>& res, const UList<Type>& f);
00097
00098 template<class Type>
00099 tmp<Field<scalar> > magSqr(const UList<Type>& f);
00100
00101 template<class Type>
00102 tmp<Field<scalar> > magSqr(const tmp<Field<Type> >& tf);
00103
00104
00105 template<class Type>
00106 void mag(Field<scalar>& res, const UList<Type>& f);
00107
00108 template<class Type>
00109 tmp<Field<scalar> > mag(const UList<Type>& f);
00110
00111 template<class Type>
00112 tmp<Field<scalar> > mag(const tmp<Field<Type> >& tf);
00113
00114
00115 template<class Type>
00116 void cmptMax(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f);
00117
00118 template<class Type>
00119 tmp<Field<typename Field<Type>::cmptType> > cmptMax(const UList<Type>& f);
00120
00121 template<class Type>
00122 tmp<Field<typename Field<Type>::cmptType> >
00123 cmptMax(const tmp<Field<Type> >& tf);
00124
00125
00126 template<class Type>
00127 void cmptMin(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f);
00128
00129 template<class Type>
00130 tmp<Field<typename Field<Type>::cmptType> > cmptMin(const UList<Type>& f);
00131
00132 template<class Type>
00133 tmp<Field<typename Field<Type>::cmptType> >
00134 cmptMin(const tmp<Field<Type> >& tf);
00135
00136
00137 template<class Type>
00138 void cmptAv(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f);
00139
00140 template<class Type>
00141 tmp<Field<typename Field<Type>::cmptType> > cmptAv(const UList<Type>& f);
00142
00143 template<class Type>
00144 tmp<Field<typename Field<Type>::cmptType> > cmptAv(const tmp<Field<Type> >& tf);
00145
00146
00147 template<class Type>
00148 void cmptMag(Field<Type>& res, const UList<Type>& f);
00149
00150 template<class Type>
00151 tmp<Field<Type> > cmptMag(const UList<Type>& f);
00152
00153 template<class Type>
00154 tmp<Field<Type> > cmptMag(const tmp<Field<Type> >& tf);
00155
00156 #define TMP_UNARY_FUNCTION(ReturnType, Func) \
00157 \
00158 template<class Type> \
00159 ReturnType Func(const tmp<Field<Type> >& tf1);
00160
00161 template<class Type>
00162 Type max(const UList<Type>& f);
00163
00164 TMP_UNARY_FUNCTION(Type, max)
00165
00166 template<class Type>
00167 Type min(const UList<Type>& f);
00168
00169 TMP_UNARY_FUNCTION(Type, min)
00170
00171 template<class Type>
00172 Type sum(const UList<Type>& f);
00173
00174 TMP_UNARY_FUNCTION(Type, sum)
00175
00176
00177 template<class Type>
00178 scalar sumProd(const UList<Type>& f1, const UList<Type>& f2);
00179
00180 template<class Type>
00181 scalar sumSqr(const UList<Type>& f);
00182
00183 TMP_UNARY_FUNCTION(scalar, sumSqr)
00184
00185 template<class Type>
00186 scalar sumMag(const UList<Type>& f);
00187
00188 TMP_UNARY_FUNCTION(scalar, sumMag)
00189
00190 template<class Type>
00191 Type average(const UList<Type>& f);
00192
00193 TMP_UNARY_FUNCTION(Type, average)
00194
00195
00196 #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \
00197 \
00198 template<class Type> \
00199 ReturnType gFunc(const UList<Type>& f); \
00200 TMP_UNARY_FUNCTION(ReturnType, gFunc)
00201
00202 G_UNARY_FUNCTION(Type, gMax, max, max)
00203 G_UNARY_FUNCTION(Type, gMin, min, min)
00204 G_UNARY_FUNCTION(Type, gSum, sum, sum)
00205 G_UNARY_FUNCTION(scalar, gSumSqr, sumSqr, sum)
00206 G_UNARY_FUNCTION(scalar, gSumMag, sumMag, sum)
00207
00208 #undef G_UNARY_FUNCTION
00209
00210 template<class Type>
00211 scalar gSumProd(const UList<Type>& f1, const UList<Type>& f2);
00212
00213 template<class Type>
00214 Type gAverage(const UList<Type>& f);
00215
00216 TMP_UNARY_FUNCTION(Type, gAverage)
00217
00218 #undef TMP_UNARY_FUNCTION
00219
00220
00221 BINARY_FUNCTION(Type, Type, Type, max)
00222 BINARY_FUNCTION(Type, Type, Type, min)
00223 BINARY_FUNCTION(Type, Type, Type, scale)
00224
00225 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
00226 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
00227 BINARY_TYPE_FUNCTION(Type, Type, Type, scale)
00228
00229
00230
00231
00232 UNARY_OPERATOR(Type, Type, -, negate)
00233
00234 BINARY_OPERATOR(Type, Type, scalar, *, multiply)
00235 BINARY_OPERATOR(Type, scalar, Type, *, multiply)
00236 BINARY_OPERATOR(Type, Type, scalar, /, divide)
00237
00238 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, multiply)
00239 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, multiply)
00240
00241 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide)
00242
00243
00244
00245
00246 #define PRODUCT_OPERATOR(product, Op, OpFunc) \
00247 \
00248 template<class Type1, class Type2> \
00249 void OpFunc \
00250 ( \
00251 Field<typename product<Type1, Type2>::type>& res, \
00252 const UList<Type1>& f1, \
00253 const UList<Type2>& f2 \
00254 ); \
00255 \
00256 template<class Type1, class Type2> \
00257 tmp<Field<typename product<Type1, Type2>::type> > \
00258 operator Op(const UList<Type1>& f1, const UList<Type2>& f2); \
00259 \
00260 template<class Type1, class Type2> \
00261 tmp<Field<typename product<Type1, Type2>::type> > \
00262 operator Op(const UList<Type1>& f1, const tmp<Field<Type2> >& tf2); \
00263 \
00264 template<class Type1, class Type2> \
00265 tmp<Field<typename product<Type1, Type2>::type> > \
00266 operator Op(const tmp<Field<Type1> >& tf1, const UList<Type2>& f2); \
00267 \
00268 template<class Type1, class Type2> \
00269 tmp<Field<typename product<Type1, Type2>::type> > \
00270 operator Op(const tmp<Field<Type1> >& tf1, const tmp<Field<Type2> >& tf2); \
00271 \
00272 template<class Type, class Form, class Cmpt, int nCmpt> \
00273 void OpFunc \
00274 ( \
00275 Field<typename product<Type, Form>::type>& res, \
00276 const UList<Type>& f1, \
00277 const VectorSpace<Form,Cmpt,nCmpt>& vs \
00278 ); \
00279 \
00280 template<class Type, class Form, class Cmpt, int nCmpt> \
00281 tmp<Field<typename product<Type, Form>::type> > \
00282 operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs); \
00283 \
00284 template<class Type, class Form, class Cmpt, int nCmpt> \
00285 tmp<Field<typename product<Type, Form>::type> > \
00286 operator Op(const tmp<Field<Type> >&tf1,const VectorSpace<Form,Cmpt,nCmpt>&vs);\
00287 \
00288 template<class Form, class Cmpt, int nCmpt, class Type> \
00289 void OpFunc \
00290 ( \
00291 Field<typename product<Form, Type>::type>& res, \
00292 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
00293 const UList<Type>& f1 \
00294 ); \
00295 \
00296 template<class Form, class Cmpt, int nCmpt, class Type> \
00297 tmp<Field<typename product<Form, Type>::type> > \
00298 operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1); \
00299 \
00300 template<class Form, class Cmpt, int nCmpt, class Type> \
00301 tmp<Field<typename product<Form, Type>::type> > \
00302 operator Op(const VectorSpace<Form,Cmpt,nCmpt>&vs,const tmp<Field<Type> >&tf1);
00303
00304 PRODUCT_OPERATOR(typeOfSum, +, add)
00305 PRODUCT_OPERATOR(typeOfSum, -, subtract)
00306
00307 PRODUCT_OPERATOR(outerProduct, *, outer)
00308 PRODUCT_OPERATOR(crossProduct, ^, cross)
00309 PRODUCT_OPERATOR(innerProduct, &, dot)
00310 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
00311
00312 #undef PRODUCT_OPERATOR
00313
00314
00315
00316
00317 }
00318
00319
00320
00321 #include "undefFieldFunctionsM.H"
00322
00323
Copyright © 2000-2007 OpenCFD Ltd