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 \*---------------------------------------------------------------------------*/
30 /* * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * */
35 pointPatchField<typename Field<Type>::cmptType>& sf,
36 const pointPatchField<Type>& f,
45 pointPatchField<Type>& f1,
46 const pointPatchField<Type>& f2
51 template<class Type, int r>
54 Field<typename powProduct<Type, r>::type>& f,
55 const pointPatchField<Type>& vf
63 Field<typename outerProduct<Type, Type>::type>& f,
64 const pointPatchField<Type>& vf
72 pointPatchField<scalar>& sf,
73 const pointPatchField<Type>& f
81 pointPatchField<scalar>& sf,
82 const pointPatchField<Type>& f
90 pointPatchField<typename Field<Type>::cmptType>& cf,
91 const pointPatchField<Type>& f
99 pointPatchField<Type>& cf,
100 const pointPatchField<Type>& f
105 #define BINARY_FUNCTION(func) \
107 template<class Type> \
110 pointPatchField<Type>& f, \
111 const pointPatchField<Type>& f1, \
112 const pointPatchField<Type>& f2 \
116 template<class Type> \
119 pointPatchField<Type>& f, \
120 const pointPatchField<Type>& f1, \
127 BINARY_FUNCTION(cmptMultiply)
128 BINARY_FUNCTION(cmptDivide)
130 #undef BINARY_FUNCTION
133 /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
135 #define UNARY_OPERATOR(op, opFunc) \
137 template<class Type> \
140 pointPatchField<Type>& f, \
141 const pointPatchField<Type>& f1 \
145 UNARY_OPERATOR(-, negate)
147 #undef UNARY_OPERATOR
150 #define BINARY_OPERATOR_FF(Type1, Type2, op, opFunc) \
152 template<class Type> \
155 pointPatchField<Type>& f, \
156 const pointPatchField<Type1>& f1, \
157 const pointPatchField<Type2>& f2 \
161 #define BINARY_OPERATOR_R(Type1, Type2, op, opFunc) \
162 BINARY_OPERATOR_FF(Type1, Type2, op, opFunc)
164 BINARY_OPERATOR_R(Type, Type, +, add)
165 BINARY_OPERATOR_R(Type, Type, -, subtract)
166 BINARY_OPERATOR_FF(scalar, Type, *, multiply)
167 BINARY_OPERATOR_FF(Type, scalar, /, divide)
169 #undef BINARY_OPERATOR_R
170 #undef BINARY_OPERATOR_FF
171 #undef BINARY_OPERATOR_FTR
172 #undef BINARY_OPERATOR_TF
173 #undef BINARY_OPERATOR_TTR
174 #undef BINARY_OPERATOR_FT
175 #undef BINARY_OPERATOR_TRF
176 #undef BINARY_OPERATOR_TRT
179 #define BINARY_TYPE_OPERATOR_TF(TYPE, op, opFunc) \
181 template<class Type> \
184 pointPatchField<Type>& f, \
186 const pointPatchField<Type>& f1 \
191 #define BINARY_TYPE_OPERATOR_FT(TYPE, op, opFunc) \
193 template<class Type> \
196 pointPatchField<Type>& f, \
197 const pointPatchField<Type>& f1, \
203 #define BINARY_TYPE_OPERATOR(TYPE, op, opFunc) \
204 BINARY_TYPE_OPERATOR_TF(TYPE, op, opFunc) \
205 BINARY_TYPE_OPERATOR_FT(TYPE, op, opFunc)
207 BINARY_TYPE_OPERATOR(Type, +, add)
208 BINARY_TYPE_OPERATOR(Type, -, subtract)
210 BINARY_TYPE_OPERATOR(scalar, *, multiply)
211 BINARY_TYPE_OPERATOR_FT(scalar, /, divide)
213 #undef BINARY_TYPE_OPERATOR
214 #undef BINARY_TYPE_OPERATOR_TF
215 #undef BINARY_TYPE_OPERATOR_FT
218 #define PRODUCT_OPERATOR(product, op, opFunc) \
228 <typename product<Type1, Type2>::type>& f, \
229 const pointPatchField<Type1>& f1, \
230 const pointPatchField<Type2>& f2 \
244 <typename product<Type, Form>::type>& f, \
245 const pointPatchField<Type>& f1, \
246 const VectorSpace<Form,Cmpt,nCmpt>& vs \
260 <typename product<Form, Type>::type>& f, \
261 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
262 const pointPatchField<Type>& f1 \
266 PRODUCT_OPERATOR(outerProduct, *, outer)
267 PRODUCT_OPERATOR(crossProduct, ^, cross)
268 PRODUCT_OPERATOR(innerProduct, &, dot)
269 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
271 #undef PRODUCT_OPERATOR
276 pointPatchField<vector>&,
277 const pointPatchField<tensor>&
283 pointPatchField<tensor>&,
284 const pointPatchField<vector>&
290 pointPatchField<vector>&,
291 const pointPatchField<tensor>&
297 pointPatchField<scalar>&,
298 const pointPatchField<tensor>&
304 pointPatchField<tensor>&,
305 const pointPatchField<tensor>&
311 pointPatchField<tensor>&,
312 const pointPatchField<tensor>&
318 pointPatchField<scalar>&,
319 const pointPatchField<tensor>&
325 pointPatchField<tensor>&,
326 const pointPatchField<tensor>&
332 pointPatchField<tensor>&,
333 const pointPatchField<tensor>&
339 pointPatchField<tensor>&,
340 const pointPatchField<tensor>&
346 pointPatchField<tensor>&,
347 const pointPatchField<tensor>&
351 inline void eigenValues
353 pointPatchField<vector>&,
354 const pointPatchField<tensor>&
358 inline void eigenVectors
360 pointPatchField<tensor>&,
361 const pointPatchField<tensor>&
366 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
368 } // End namespace Foam
370 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //