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