BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / OpenFOAM / fields / DimensionedFields / DimensionedField / DimensionedFieldFunctions.H
blobdf4efeb8ea991f5533b0440ec3d55e8270467215
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "DimensionedScalarField.H"
28 #define TEMPLATE template<class Type, class GeoMesh>
29 #include "DimensionedFieldFunctionsM.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace Foam
36 // * * * * * * * * * * * * * * * Global functions  * * * * * * * * * * * * * //
38 template<class Type, class GeoMesh, int r>
39 tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh> >
40 pow
42     const DimensionedField<Type, GeoMesh>& df,
43     typename powProduct<Type, r>::type
46 template<class Type, class GeoMesh, int r>
47 tmp<DimensionedField<typename powProduct<Type, r>::type, GeoMesh> >
48 pow
50     const tmp<DimensionedField<Type, GeoMesh> >& tdf,
51     typename powProduct<Type, r>::type
54 template<class Type, class GeoMesh>
55 tmp<DimensionedField<typename outerProduct<Type, Type>::type, GeoMesh> >
56 sqr(const DimensionedField<Type, GeoMesh>& df);
58 template<class Type, class GeoMesh>
59 tmp<DimensionedField<typename outerProduct<Type, Type>::type, GeoMesh> >
60 sqr(const tmp<DimensionedField<Type, GeoMesh> >& tdf);
62 template<class Type, class GeoMesh>
63 tmp<DimensionedField<scalar, GeoMesh> > magSqr
65     const DimensionedField<Type, GeoMesh>& df
68 template<class Type, class GeoMesh>
69 tmp<DimensionedField<scalar, GeoMesh> > magSqr
71     const tmp<DimensionedField<Type, GeoMesh> >& tdf
74 template<class Type, class GeoMesh>
75 tmp<DimensionedField<scalar, GeoMesh> > mag
77     const DimensionedField<Type, GeoMesh>& df
80 template<class Type, class GeoMesh>
81 tmp<DimensionedField<scalar, GeoMesh> > mag
83     const tmp<DimensionedField<Type, GeoMesh> >& tdf
86 template<class Type, class GeoMesh>
87 tmp
89     DimensionedField
90         <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>
92 cmptAv(const DimensionedField<Type, GeoMesh>& df);
94 template<class Type, class GeoMesh>
95 tmp
97     DimensionedField
98         <typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>
100 cmptAv(const tmp<DimensionedField<Type, GeoMesh> >& tdf);
103 #define UNARY_REDUCTION_FUNCTION(returnType, func, dfunc)                     \
104                                                                               \
105 template<class Type, class GeoMesh>                                           \
106 dimensioned<returnType> func                                                  \
107 (                                                                             \
108     const DimensionedField<Type, GeoMesh>& df                                 \
109 );                                                                            \
110 template<class Type, class GeoMesh>                                           \
111 dimensioned<returnType> func                                                  \
112 (                                                                             \
113     const tmp<DimensionedField<Type, GeoMesh> >& tdf1                         \
116 UNARY_REDUCTION_FUNCTION(Type, max, gMax)
117 UNARY_REDUCTION_FUNCTION(Type, min, gMin)
118 UNARY_REDUCTION_FUNCTION(Type, sum, gSum)
119 UNARY_REDUCTION_FUNCTION(scalar, sumMag, gSumMag)
120 UNARY_REDUCTION_FUNCTION(Type, average, gAverage)
122 #undef UNARY_REDUCTION_FUNCTION
125 BINARY_FUNCTION(Type, Type, Type, max)
126 BINARY_FUNCTION(Type, Type, Type, min)
127 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
128 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
130 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
131 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
132 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
133 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
136 // * * * * * * * * * * * * * * * Global operators  * * * * * * * * * * * * * //
138 UNARY_OPERATOR(Type, Type, -, negate, transform)
140 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
141 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
142 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
144 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
145 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
147 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 #define PRODUCT_OPERATOR(product, op, opFunc)                                 \
153                                                                               \
154 template<class Type1, class Type2, class GeoMesh>                             \
155 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
156 operator op                                                                   \
157 (                                                                             \
158     const DimensionedField<Type1, GeoMesh>& df1,                              \
159     const DimensionedField<Type2, GeoMesh>& df2                               \
160 );                                                                            \
161                                                                               \
162 template<class Type1, class Type2, class GeoMesh>                             \
163 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
164 operator op                                                                   \
165 (                                                                             \
166     const DimensionedField<Type1, GeoMesh>& df1,                              \
167     const tmp<DimensionedField<Type2, GeoMesh> >& tdf2                        \
168 );                                                                            \
169                                                                               \
170 template<class Type1, class Type2, class GeoMesh>                             \
171 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
172 operator op                                                                   \
173 (                                                                             \
174     const tmp<DimensionedField<Type1, GeoMesh> >& tdf1,                       \
175     const DimensionedField<Type2, GeoMesh>& df2                               \
176 );                                                                            \
177                                                                               \
178 template<class Type1, class Type2, class GeoMesh>                             \
179 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh> >         \
180 operator op                                                                   \
181 (                                                                             \
182     const tmp<DimensionedField<Type1, GeoMesh> >& tdf1,                       \
183     const tmp<DimensionedField<Type2, GeoMesh> >& tdf2                        \
184 );                                                                            \
185                                                                               \
186 template<class Form, class Type, class GeoMesh>                               \
187 tmp<DimensionedField<typename product<Type, Form>::type, GeoMesh> >           \
188 operator op                                                                   \
189 (                                                                             \
190     const DimensionedField<Type, GeoMesh>& df1,                               \
191     const dimensioned<Form>& dvs                                              \
192 );                                                                            \
193                                                                               \
194 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
195 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
196 operator op                                                                   \
197 (                                                                             \
198     const DimensionedField<Type, GeoMesh>& df1,                               \
199     const VectorSpace<Form,Cmpt,nCmpt>& vs                                    \
200 );                                                                            \
201                                                                               \
202 template<class Form, class Type, class GeoMesh>                               \
203 tmp<DimensionedField<typename product<Type, Form>::type, GeoMesh> >           \
204 operator op                                                                   \
205 (                                                                             \
206     const tmp<DimensionedField<Type, GeoMesh> >& tdf1,                        \
207     const dimensioned<Form>& dvs                                              \
208 );                                                                            \
209                                                                               \
210 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
211 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
212 operator op                                                                   \
213 (                                                                             \
214     const tmp<DimensionedField<Type, GeoMesh> >& tdf1,                        \
215     const VectorSpace<Form,Cmpt,nCmpt>& vs                                    \
216 );                                                                            \
217                                                                               \
218 template<class Form, class Type, class GeoMesh>                               \
219 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
220 operator op                                                                   \
221 (                                                                             \
222     const dimensioned<Form>& dvs,                                             \
223     const DimensionedField<Type, GeoMesh>& df1                                \
224 );                                                                            \
225                                                                               \
226 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
227 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
228 operator op                                                                   \
229 (                                                                             \
230     const VectorSpace<Form,Cmpt,nCmpt>& vs,                                   \
231     const DimensionedField<Type, GeoMesh>& df1                                \
232 );                                                                            \
233                                                                               \
234 template<class Form, class Type, class GeoMesh>                               \
235 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
236 operator op                                                                   \
237 (                                                                             \
238     const dimensioned<Form>& dvs,                                             \
239     const tmp<DimensionedField<Type, GeoMesh> >& tdf1                         \
240 );                                                                            \
241                                                                               \
242 template<class Form, class Cmpt, int nCmpt, class Type, class GeoMesh>        \
243 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh> >           \
244 operator op                                                                   \
245 (                                                                             \
246     const VectorSpace<Form,Cmpt,nCmpt>& vs,                                   \
247     const tmp<DimensionedField<Type, GeoMesh> >& tdf1                         \
250 PRODUCT_OPERATOR(typeOfSum, +, add)
251 PRODUCT_OPERATOR(typeOfSum, -, subtract)
253 PRODUCT_OPERATOR(outerProduct, *, outer)
254 PRODUCT_OPERATOR(crossProduct, ^, cross)
255 PRODUCT_OPERATOR(innerProduct, &, dot)
256 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
258 #undef PRODUCT_OPERATOR
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 } // End namespace Foam
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 #include "undefFieldFunctionsM.H"
269 // ************************************************************************* //