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 Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2);
00182
00183 template<class Type>
00184 scalar sumSqr(const UList<Type>& f);
00185
00186 TMP_UNARY_FUNCTION(scalar, sumSqr)
00187
00188 template<class Type>
00189 scalar sumMag(const UList<Type>& f);
00190
00191 TMP_UNARY_FUNCTION(scalar, sumMag)
00192
00193 template<class Type>
00194 Type sumCmptMag(const UList<Type>& f);
00195
00196 TMP_UNARY_FUNCTION(Type, sumCmptMag)
00197
00198 template<class Type>
00199 Type average(const UList<Type>& f);
00200
00201 TMP_UNARY_FUNCTION(Type, average)
00202
00203
00204 #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \
00205 \
00206 template<class Type> \
00207 ReturnType gFunc(const UList<Type>& f); \
00208 TMP_UNARY_FUNCTION(ReturnType, gFunc)
00209
00210 G_UNARY_FUNCTION(Type, gMax, max, max)
00211 G_UNARY_FUNCTION(Type, gMin, min, min)
00212 G_UNARY_FUNCTION(Type, gSum, sum, sum)
00213 G_UNARY_FUNCTION(scalar, gSumSqr, sumSqr, sum)
00214 G_UNARY_FUNCTION(scalar, gSumMag, sumMag, sum)
00215 G_UNARY_FUNCTION(Type, gSumCmptMag, sumCmptMag, sum)
00216
00217 #undef G_UNARY_FUNCTION
00218
00219 template<class Type>
00220 scalar gSumProd(const UList<Type>& f1, const UList<Type>& f2);
00221
00222 template<class Type>
00223 Type gSumCmptProd(const UList<Type>& f1, const UList<Type>& f2);
00224
00225 template<class Type>
00226 Type gAverage(const UList<Type>& f);
00227
00228 TMP_UNARY_FUNCTION(Type, gAverage)
00229
00230 #undef TMP_UNARY_FUNCTION
00231
00232
00233 BINARY_FUNCTION(Type, Type, Type, max)
00234 BINARY_FUNCTION(Type, Type, Type, min)
00235 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
00236 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
00237
00238 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
00239 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
00240 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
00241 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
00242
00243
00244
00245
00246 UNARY_OPERATOR(Type, Type, -, negate)
00247
00248 BINARY_OPERATOR(Type, Type, scalar, *, multiply)
00249 BINARY_OPERATOR(Type, scalar, Type, *, multiply)
00250 BINARY_OPERATOR(Type, Type, scalar, /, divide)
00251
00252 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, multiply)
00253 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, multiply)
00254
00255 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide)
00256
00257
00258
00259
00260 #define PRODUCT_OPERATOR(product, Op, OpFunc) \
00261 \
00262 template<class Type1, class Type2> \
00263 void OpFunc \
00264 ( \
00265 Field<typename product<Type1, Type2>::type>& res, \
00266 const UList<Type1>& f1, \
00267 const UList<Type2>& f2 \
00268 ); \
00269 \
00270 template<class Type1, class Type2> \
00271 tmp<Field<typename product<Type1, Type2>::type> > \
00272 operator Op(const UList<Type1>& f1, const UList<Type2>& f2); \
00273 \
00274 template<class Type1, class Type2> \
00275 tmp<Field<typename product<Type1, Type2>::type> > \
00276 operator Op(const UList<Type1>& f1, const tmp<Field<Type2> >& tf2); \
00277 \
00278 template<class Type1, class Type2> \
00279 tmp<Field<typename product<Type1, Type2>::type> > \
00280 operator Op(const tmp<Field<Type1> >& tf1, const UList<Type2>& f2); \
00281 \
00282 template<class Type1, class Type2> \
00283 tmp<Field<typename product<Type1, Type2>::type> > \
00284 operator Op(const tmp<Field<Type1> >& tf1, const tmp<Field<Type2> >& tf2); \
00285 \
00286 template<class Type, class Form, class Cmpt, int nCmpt> \
00287 void OpFunc \
00288 ( \
00289 Field<typename product<Type, Form>::type>& res, \
00290 const UList<Type>& f1, \
00291 const VectorSpace<Form,Cmpt,nCmpt>& vs \
00292 ); \
00293 \
00294 template<class Type, class Form, class Cmpt, int nCmpt> \
00295 tmp<Field<typename product<Type, Form>::type> > \
00296 operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs); \
00297 \
00298 template<class Type, class Form, class Cmpt, int nCmpt> \
00299 tmp<Field<typename product<Type, Form>::type> > \
00300 operator Op(const tmp<Field<Type> >&tf1,const VectorSpace<Form,Cmpt,nCmpt>&vs);\
00301 \
00302 template<class Form, class Cmpt, int nCmpt, class Type> \
00303 void OpFunc \
00304 ( \
00305 Field<typename product<Form, Type>::type>& res, \
00306 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
00307 const UList<Type>& f1 \
00308 ); \
00309 \
00310 template<class Form, class Cmpt, int nCmpt, class Type> \
00311 tmp<Field<typename product<Form, Type>::type> > \
00312 operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1); \
00313 \
00314 template<class Form, class Cmpt, int nCmpt, class Type> \
00315 tmp<Field<typename product<Form, Type>::type> > \
00316 operator Op(const VectorSpace<Form,Cmpt,nCmpt>&vs,const tmp<Field<Type> >&tf1);
00317
00318 PRODUCT_OPERATOR(typeOfSum, +, add)
00319 PRODUCT_OPERATOR(typeOfSum, -, subtract)
00320
00321 PRODUCT_OPERATOR(outerProduct, *, outer)
00322 PRODUCT_OPERATOR(crossProduct, ^, cross)
00323 PRODUCT_OPERATOR(innerProduct, &, dot)
00324 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
00325
00326 #undef PRODUCT_OPERATOR
00327
00328
00329
00330
00331 }
00332
00333
00334
00335 #include "undefFieldFunctionsM.H"
00336
00337