fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / fields / DimensionedFields / DimensionedField / DimensionedFieldFunctions.H
blob682dfe6b2a40e6ee16f7b9339648a5a71edc53d0
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "DimensionedScalarField.H"
29 #define TEMPLATE template<class Type, class GeoMesh>
30 #include "DimensionedFieldFunctionsM.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * * Global functions  * * * * * * * * * * * * * //
39 template<class Type, class GeoMesh, int r>
40 tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh> >
41 pow
43     const DimensionedField<Type, GeoMesh>& df,
44     typename powProduct<Type, r>::type
47 template<class Type, class GeoMesh, int r>
48 tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh> >
49 pow
51     const tmp<DimensionedField<Type, GeoMesh> >& tdf,
52     typename powProduct<Type, r>::type
55 template<class Type, class GeoMesh>
56 tmp<DimensionedField<typename outerProduct<Type, Type>::type, GeoMesh> >
57 sqr(const DimensionedField<Type, GeoMesh>& df);
59 template<class Type, class GeoMesh>
60 tmp<DimensionedField<typename outerProduct<Type, Type>::type, GeoMesh> >
61 sqr(const tmp<DimensionedField<Type, GeoMesh> >& tdf);
63 template<class Type, class GeoMesh>
64 tmp<DimensionedField<scalar, GeoMesh> > magSqr
66     const DimensionedField<Type, GeoMesh>& df
69 template<class Type, class GeoMesh>
70 tmp<DimensionedField<scalar, GeoMesh> > magSqr
72     const tmp<DimensionedField<Type, GeoMesh> >& tdf
75 template<class Type, class GeoMesh>
76 tmp<DimensionedField<scalar, GeoMesh> > mag
78     const DimensionedField<Type, GeoMesh>& df
81 template<class Type, class GeoMesh>
82 tmp<DimensionedField<scalar, GeoMesh> > mag
84     const tmp<DimensionedField<Type, GeoMesh> >& tdf
87 template<class Type, class GeoMesh>
88 tmp
90     DimensionedField
91         <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>
93 cmptAv(const DimensionedField<Type, GeoMesh>& df);
95 template<class Type, class GeoMesh>
96 tmp
98     DimensionedField
99         <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>
101 cmptAv(const tmp<DimensionedField<Type, GeoMesh> >& tdf);
104 #define UNARY_REDUCTION_FUNCTION(returnType, func, dfunc)                     \
105                                                                               \
106 template<class Type, class GeoMesh>                                           \
107 dimensioned<returnType> func                                                  \
108 (                                                                             \
109     const DimensionedField<Type, GeoMesh>& df                                 \
110 );                                                                            \
111 template<class Type, class GeoMesh>                                           \
112 dimensioned<returnType> func                                                  \
113 (                                                                             \
114     const tmp<DimensionedField<Type, GeoMesh> >& tdf1                         \
117 UNARY_REDUCTION_FUNCTION(Type, max, gMax)
118 UNARY_REDUCTION_FUNCTION(Type, min, gMin)
119 UNARY_REDUCTION_FUNCTION(Type, sum, gSum)
120 UNARY_REDUCTION_FUNCTION(scalar, sumMag, gSumMag)
121 UNARY_REDUCTION_FUNCTION(Type, average, gAverage)
123 #undef UNARY_REDUCTION_FUNCTION
126 BINARY_FUNCTION(Type, Type, Type, max)
127 BINARY_FUNCTION(Type, Type, Type, min)
128 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
129 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
131 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
132 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
133 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
134 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
137 // * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * //
139 UNARY_OPERATOR(Type, Type, -, negate, transform)
141 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
142 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
143 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
145 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
146 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
148 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 #define PRODUCT_OPERATOR(product, op, opFunc)                                 \
154                                                                               \
155 template<class Type1, class Type2, class GeoMesh>                             \
156 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
157 operator op                                                                   \
158 (                                                                             \
159     const DimensionedField<Type1, GeoMesh>& df1,                              \
160     const DimensionedField<Type2, GeoMesh>& df2                               \
161 );                                                                            \
162                                                                               \
163 template<class Type1, class Type2, class GeoMesh>                             \
164 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
165 operator op                                                                   \
166 (                                                                             \
167     const DimensionedField<Type1, GeoMesh>& df1,                              \
168     const tmp<DimensionedField<Type2, GeoMesh> >& tdf2                        \
169 );                                                                            \
170                                                                               \
171 template<class Type1, class Type2, class GeoMesh>                             \
172 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
173 operator op                                                                   \
174 (                                                                             \
175     const tmp<DimensionedField<Type1, GeoMesh> >& tdf1,                       \
176     const DimensionedField<Type2, GeoMesh>& df2                               \
177 );                                                                            \
178                                                                               \
179 template<class Type1, class Type2, class GeoMesh>                             \
180 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
181 operator op                                                                   \
182 (                                                                             \
183     const tmp<DimensionedField<Type1, GeoMesh> >& tdf1,                       \
184     const tmp<DimensionedField<Type2, GeoMesh> >& tdf2                        \
185 );                                                                            \
186                                                                               \
187 template<class Form, class Type, class GeoMesh>                               \
188 tmp<DimensionedField<typename product<Type, Form>::type, GeoMesh> >           \
189 operator op                                                                   \
190 (                                                                             \
191     const DimensionedField<Type, GeoMesh>& df1,                               \
192     const dimensioned<Form>& dvs                                              \
193 );                                                                            \
194                                                                               \
195 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
196 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
197 operator op                                                                   \
198 (                                                                             \
199     const DimensionedField<Type, GeoMesh>& df1,                               \
200     const VectorSpace<Form,Cmpt,nCmpt>& vs                                    \
201 );                                                                            \
202                                                                               \
203 template<class Form, class Type, class GeoMesh>                               \
204 tmp<DimensionedField<typename product<Type, Form>::type, GeoMesh> >           \
205 operator op                                                                   \
206 (                                                                             \
207     const tmp<DimensionedField<Type, GeoMesh> >& tdf1,                        \
208     const dimensioned<Form>& dvs                                              \
209 );                                                                            \
210                                                                               \
211 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
212 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
213 operator op                                                                   \
214 (                                                                             \
215     const tmp<DimensionedField<Type, GeoMesh> >& tdf1,                        \
216     const VectorSpace<Form,Cmpt,nCmpt>& vs                                    \
217 );                                                                            \
218                                                                               \
219 template<class Form, class Type, class GeoMesh>                               \
220 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
221 operator op                                                                   \
222 (                                                                             \
223     const dimensioned<Form>& dvs,                                             \
224     const DimensionedField<Type, GeoMesh>& df1                                \
225 );                                                                            \
226                                                                               \
227 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
228 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
229 operator op                                                                   \
230 (                                                                             \
231     const VectorSpace<Form,Cmpt,nCmpt>& vs,                                   \
232     const DimensionedField<Type, GeoMesh>& df1                                \
233 );                                                                            \
234                                                                               \
235 template<class Form, class Type, class GeoMesh>                               \
236 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
237 operator op                                                                   \
238 (                                                                             \
239     const dimensioned<Form>& dvs,                                             \
240     const tmp<DimensionedField<Type, GeoMesh> >& tdf1                         \
241 );                                                                            \
242                                                                               \
243 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
244 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
245 operator op                                                                   \
246 (                                                                             \
247     const VectorSpace<Form,Cmpt,nCmpt>& vs,                                   \
248     const tmp<DimensionedField<Type, GeoMesh> >& tdf1                         \
251 PRODUCT_OPERATOR(typeOfSum, +, add)
252 PRODUCT_OPERATOR(typeOfSum, -, subtract)
254 PRODUCT_OPERATOR(outerProduct, *, outer)
255 PRODUCT_OPERATOR(crossProduct, ^, cross)
256 PRODUCT_OPERATOR(innerProduct, &, dot)
257 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
259 #undef PRODUCT_OPERATOR
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 } // End namespace Foam
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 #include "undefFieldFunctionsM.H"
270 // ************************************************************************* //