1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "GeometricScalarField.H"
30 template<class Type, template<class> class PatchField, class GeoMesh>
31 #include "GeometricFieldFunctionsM.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
40 template<class Type, template<class> class PatchField, class GeoMesh>
45 typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
49 const GeometricField<Type, PatchField, GeoMesh>& gf,
53 template<class Type, template<class> class PatchField, class GeoMesh>
56 GeometricField<Type, PatchField, GeoMesh>& gf,
57 const GeometricField<Type, PatchField, GeoMesh>& gf1
60 template<class Type, template<class> class PatchField, class GeoMesh, int r>
63 GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
64 const GeometricField<Type, PatchField, GeoMesh>& gf1
67 template<class Type, template<class> class PatchField, class GeoMesh, int r>
71 <typename powProduct<Type, r>::type, PatchField, GeoMesh>
75 const GeometricField<Type, PatchField, GeoMesh>& gf,
76 typename powProduct<Type, r>::type
79 template<class Type, template<class> class PatchField, class GeoMesh, int r>
83 <typename powProduct<Type, r>::type, PatchField, GeoMesh>
87 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf,
88 typename powProduct<Type, r>::type
91 template<class Type, template<class> class PatchField, class GeoMesh>
95 <typename outerProduct<Type, Type>::type, PatchField, GeoMesh>& gf,
96 const GeometricField<Type, PatchField, GeoMesh>& gf1
99 template<class Type, template<class> class PatchField, class GeoMesh>
104 typename outerProduct<Type, Type>::type,
109 sqr(const GeometricField<Type, PatchField, GeoMesh>& gf);
111 template<class Type, template<class> class PatchField, class GeoMesh>
116 typename outerProduct<Type, Type>::type,
121 sqr(const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf);
123 template<class Type, template<class> class PatchField, class GeoMesh>
126 GeometricField<scalar, PatchField, GeoMesh>& gsf,
127 const GeometricField<Type, PatchField, GeoMesh>& gf
130 template<class Type, template<class> class PatchField, class GeoMesh>
131 tmp<GeometricField<scalar, PatchField, GeoMesh> > magSqr
133 const GeometricField<Type, PatchField, GeoMesh>& gf
136 template<class Type, template<class> class PatchField, class GeoMesh>
137 tmp<GeometricField<scalar, PatchField, GeoMesh> > magSqr
139 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf
142 template<class Type, template<class> class PatchField, class GeoMesh>
145 GeometricField<scalar, PatchField, GeoMesh>& gsf,
146 const GeometricField<Type, PatchField, GeoMesh>& gf
149 template<class Type, template<class> class PatchField, class GeoMesh>
150 tmp<GeometricField<scalar, PatchField, GeoMesh> > mag
152 const GeometricField<Type, PatchField, GeoMesh>& gf
155 template<class Type, template<class> class PatchField, class GeoMesh>
156 tmp<GeometricField<scalar, PatchField, GeoMesh> > mag
158 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf
161 template<class Type, template<class> class PatchField, class GeoMesh>
166 typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
170 const GeometricField<Type, PatchField, GeoMesh>& gf
173 template<class Type, template<class> class PatchField, class GeoMesh>
178 typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
183 cmptAv(const GeometricField<Type, PatchField, GeoMesh>& gf);
185 template<class Type, template<class> class PatchField, class GeoMesh>
190 typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
195 cmptAv(const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf);
198 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc) \
200 template<class Type, template<class> class PatchField, class GeoMesh> \
201 dimensioned<returnType> func \
203 const GeometricField<Type, PatchField, GeoMesh>& gf \
206 template<class Type, template<class> class PatchField, class GeoMesh> \
207 dimensioned<returnType> func \
209 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
212 UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, max, gMax)
213 UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(Type, min, gMin)
215 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
218 #define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc) \
220 template<class Type, template<class> class PatchField, class GeoMesh> \
221 dimensioned<returnType> func \
223 const GeometricField<Type, PatchField, GeoMesh>& gf \
226 template<class Type, template<class> class PatchField, class GeoMesh> \
227 dimensioned<returnType> func \
229 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
232 UNARY_REDUCTION_FUNCTION(Type, sum, gSum)
233 UNARY_REDUCTION_FUNCTION(scalar, sumMag, gSumMag)
234 UNARY_REDUCTION_FUNCTION(Type, average, gAverage)
236 #undef UNARY_REDUCTION_FUNCTION
239 BINARY_FUNCTION(Type, Type, Type, max)
240 BINARY_FUNCTION(Type, Type, Type, min)
241 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
242 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
244 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
245 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
246 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
247 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
250 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
252 UNARY_OPERATOR(Type, Type, -, negate, transform)
254 #ifndef __INTEL_COMPILER
255 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
256 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
258 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
260 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
261 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
263 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 #define PRODUCT_OPERATOR(product, op, opFunc) \
271 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
275 <typename product<Type1, Type2>::type, PatchField, GeoMesh>& gf, \
276 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
277 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
281 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
285 <typename product<Type1, Type2>::type, PatchField, GeoMesh> \
289 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
290 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
294 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
298 <typename product<Type1, Type2>::type, PatchField, GeoMesh> \
302 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
303 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
307 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
311 <typename product<Type1, Type2>::type, PatchField, GeoMesh> \
315 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
316 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
320 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
324 <typename product<Type1, Type2>::type, PatchField, GeoMesh> \
328 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
329 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
333 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
337 <typename product<Type, Form>::type, PatchField, GeoMesh>& gf, \
338 const GeometricField<Type, PatchField, GeoMesh>& gf1, \
339 const dimensioned<Form>& dvs \
343 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
347 <typename product<Type, Form>::type, PatchField, GeoMesh> \
351 const GeometricField<Type, PatchField, GeoMesh>& gf1, \
352 const dimensioned<Form>& dvs \
360 class Type, template<class> class PatchField, \
366 <typename product<Form, Type>::type, PatchField, GeoMesh> \
370 const GeometricField<Type, PatchField, GeoMesh>& gf1, \
371 const VectorSpace<Form,Cmpt,nCmpt>& vs \
375 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
379 <typename product<Type, Form>::type, PatchField, GeoMesh> \
383 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1, \
384 const dimensioned<Form>& dvs \
392 class Type, template<class> class PatchField, \
398 <typename product<Form, Type>::type, PatchField, GeoMesh> \
402 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1, \
403 const VectorSpace<Form,Cmpt,nCmpt>& vs \
407 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
411 <typename product<Form, Type>::type, PatchField, GeoMesh>& gf, \
412 const dimensioned<Form>& dvs, \
413 const GeometricField<Type, PatchField, GeoMesh>& gf1 \
417 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
421 <typename product<Form, Type>::type, PatchField, GeoMesh> \
425 const dimensioned<Form>& dvs, \
426 const GeometricField<Type, PatchField, GeoMesh>& gf1 \
434 class Type, template<class> class PatchField, \
440 <typename product<Form, Type>::type, PatchField, GeoMesh> \
444 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
445 const GeometricField<Type, PatchField, GeoMesh>& gf1 \
449 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
453 <typename product<Form, Type>::type, PatchField, GeoMesh> \
457 const dimensioned<Form>& dvs, \
458 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
466 class Type, template<class> class PatchField, \
472 <typename product<Form, Type>::type, PatchField, GeoMesh> \
476 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
477 const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
480 PRODUCT_OPERATOR(typeOfSum, +, add)
481 PRODUCT_OPERATOR(typeOfSum, -, subtract)
483 PRODUCT_OPERATOR(outerProduct, *, outer)
484 PRODUCT_OPERATOR(crossProduct, ^, cross)
485 PRODUCT_OPERATOR(innerProduct, &, dot)
486 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
488 #undef PRODUCT_OPERATOR
491 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
493 } // End namespace Foam
495 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
497 #include "undefFieldFunctionsM.H"
499 // ************************************************************************* //