pointPatchFieldFunctions.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Note
28  Many functions are not required or supported on pointPatchFields
29  but are made available as dummy operations to ensure that various
30  FieldFieldFunctions will be definable.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #include "pointPatchField.H"
35 
36 namespace Foam
37 {
38 
39 /* * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * */
40 
41 template<class Type>
42 inline void component
43 (
45  const pointPatchField<Type>& f,
46  const direction d
47 )
48 {}
49 
50 
51 template<class Type>
52 inline void T
53 (
55  const pointPatchField<Type>& f2
56 )
57 {}
58 
59 
60 template<class Type, direction r>
61 inline void pow
62 (
64  const pointPatchField<Type>& vf
65 )
66 {}
67 
68 
69 template<class Type>
70 inline void sqr
71 (
73  const pointPatchField<Type>& vf
74 )
75 {}
76 
77 
78 template<class Type>
79 inline void magSqr
80 (
83 )
84 {}
85 
86 
87 template<class Type>
88 inline void mag
89 (
92 )
93 {}
94 
95 
96 template<class Type>
97 inline void cmptAv
98 (
100  const pointPatchField<Type>& f
101 )
102 {}
103 
104 
105 template<class Type>
106 inline void cmptMag
107 (
109  const pointPatchField<Type>& f
110 )
111 {}
112 
113 
114 #define BINARY_FUNCTION(func) \
115  \
116 template<class Type> \
117 inline void func \
118 ( \
119  pointPatchField<Type>& f, \
120  const pointPatchField<Type>& f1, \
121  const pointPatchField<Type>& f2 \
122 ) \
123 {} \
124  \
125 template<class Type> \
126 inline void func \
127 ( \
128  pointPatchField<Type>& f, \
129  const pointPatchField<Type>& f1, \
130  const Type& s \
131 ) \
132 {}
133 
138 
139 
140 // Returns Type max to ensure that it does not participate in reductions
141 template<class Type>
142 inline Type min(const pointPatchField<Type>&)
143 {
144  return pTraits<Type>::max;
145 }
146 
147 // Returns Type min to ensure that it does not participate in reductions
148 template<class Type>
149 inline Type max(const pointPatchField<Type>&)
150 {
151  return pTraits<Type>::min;
152 }
153 
154 
155 /* * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * */
156 
157 #define UNARY_OPERATOR(op, opFunc) \
158  \
159 template<class Type> \
160 inline void opFunc \
161 ( \
162  pointPatchField<Type>& f, \
163  const pointPatchField<Type>& f1 \
164 ) \
165 {}
166 
168 
169 #define BINARY_OPERATOR(Type1, Type2, op, opFunc) \
170  \
171 template<class Type> \
172 inline void opFunc \
173 ( \
174  pointPatchField<Type>& f, \
175  const pointPatchField<Type1>& f1, \
176  const pointPatchField<Type2>& f2 \
177 ) \
178 {}
179 
180 BINARY_OPERATOR(scalar, Type, *, multiply)
181 BINARY_OPERATOR(Type, scalar, *, multiply)
182 BINARY_OPERATOR(Type, scalar, /, divide)
183 
184 #define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc) \
185  \
186 template<class Type> \
187 inline void opFunc \
188 ( \
189  pointPatchField<Type>& f, \
190  const TYPE& s, \
191  const pointPatchField<Type>& f1 \
192 ) \
193 {}
194 
195 
196 #define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc) \
197  \
198 template<class Type> \
199 inline void opFunc \
200 ( \
201  pointPatchField<Type>& f, \
202  const pointPatchField<Type>& f1, \
203  const TYPE& s \
204 ) \
205 {}
206 
207 
211 
212 
213 #define PRODUCT_OPERATOR(product, op, opFunc) \
214  \
215 template \
216 < \
217  class Type1, \
218  class Type2 \
219 > \
220 inline void opFunc \
221 ( \
222  pointPatchField \
223  <typename product<Type1, Type2>::type>& f, \
224  const pointPatchField<Type1>& f1, \
225  const pointPatchField<Type2>& f2 \
226 ) \
227 {} \
228  \
229 template \
230 < \
231  class Type, \
232  class Form, \
233  class Cmpt, \
234  direction nCmpt \
235 > \
236 inline void opFunc \
237 ( \
238  pointPatchField \
239  <typename product<Type, Form>::type>& f, \
240  const pointPatchField<Type>& f1, \
241  const VectorSpace<Form,Cmpt,nCmpt>& vs \
242 ) \
243 {} \
244  \
245 template \
246 < \
247  class Form, \
248  class Cmpt, \
249  direction nCmpt, \
250  class Type \
251 > \
252 inline void opFunc \
253 ( \
254  pointPatchField \
255  <typename product<Form, Type>::type>& f, \
256  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
257  const pointPatchField<Type>& f1 \
258 ) \
259 {}
260 
263 
268 
269 #undef PRODUCT_OPERATOR
270 
271 
272 inline void hdual
273 (
276 )
277 {}
278 
279 inline void hdual
280 (
283 )
284 {}
285 
286 inline void diag
287 (
290 )
291 {}
292 
293 inline void tr
294 (
297 )
298 {}
299 
300 inline void dev
301 (
304 )
305 {}
306 
307 inline void dev2
308 (
311 )
312 {}
313 
314 inline void det
315 (
318 )
319 {}
320 
321 inline void inv
322 (
325 )
326 {}
327 
328 inline void symm
329 (
332 )
333 {}
334 
335 inline void twoSymm
336 (
339 )
340 {}
341 
342 inline void skew
343 (
346 )
347 {}
348 
349 
350 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351 
352 namespace FieldOps
353 {
354 
355 // Workarounds for missing functionality.
356 // See FieldOps.H, and GeometricFieldOps.H
357 
358 template<class Tout, class T1, class UnaryOp>
359 inline void assign
360 (
361  pointPatchField<Tout>& result,
362  const pointPatchField<T1>& a,
363  const UnaryOp& op
364 )
365 {}
366 
367 
368 template<class Tout, class T1, class T2, class BinaryOp>
369 inline void assign
370 (
371  pointPatchField<Tout>& result,
372  const pointPatchField<T1>& a,
373  const pointPatchField<T2>& b,
374  const BinaryOp& bop
375 )
376 {}
377 
378 template<class T, class BinaryOp>
379 inline void ternary
380 (
381  pointPatchField<T>& result,
382  const pointPatchField<T>& a,
383  const pointPatchField<T>& b,
384  const BinaryOp& bop
385 )
386 {}
387 
388 template<class T, class BoolType, class FlipOp>
389 inline void ternarySelect
390 (
391  pointPatchField<T>& result,
392  const pointPatchField<BoolType>& cond,
393  const pointPatchField<T>& a,
394  const pointPatchField<T>& b,
395  const FlipOp& flip
396 )
397 {}
398 
399 
400 } // End namespace FieldOps
401 
402 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
403 
404 } // End namespace Foam
405 
406 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
407 
408 #include "undefFieldFunctionsM.H"
409 
410 // ************************************************************************* //
Foam::FieldOps::ternary
void ternary(Field< T > &result, const Field< T > &a, const Field< T > &b, const BinaryOp &bop)
Definition: FieldOps.C:80
Foam::subtract
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:940
Foam::symm
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:84
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:44
BINARY_TYPE_OPERATOR_SF
#define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc)
Definition: pointPatchFieldFunctions.H:184
Foam::skew
dimensionedTensor skew(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:138
Foam::cmptMultiply
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::diag
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
Definition: pointPatchFieldFunctions.H:287
pointPatchField.H
Foam::innerProduct
Definition: products.H:141
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::dot
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:944
BINARY_FUNCTION
#define BINARY_FUNCTION(func)
Definition: pointPatchFieldFunctions.H:114
Foam::crossProduct
Definition: products.H:129
undefFieldFunctionsM.H
Foam::powProduct::type
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:170
Foam::FieldOps::ternarySelect
void ternarySelect(Field< T > &result, const BoolListType &cond, const Field< T > &a, const Field< T > &b, const FlipOp &flip)
Definition: FieldOps.C:106
Foam::dev2
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:117
Foam::pointPatchField
Abstract base class for point-mesh patch fields.
Definition: pointMVCWeight.H:60
UNARY_OPERATOR
#define UNARY_OPERATOR(op, opFunc)
Definition: pointPatchFieldFunctions.H:157
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::divide
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Foam::cmptMag
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:400
Foam::Field::cmptType
pTraits< Type >::cmptType cmptType
Component type.
Definition: Field.H:86
Foam::scalarProduct
Definition: products.H:153
Foam::typeOfSum
Definition: products.H:97
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Field
Generic templated field type.
Definition: Field.H:63
PRODUCT_OPERATOR
#define PRODUCT_OPERATOR(product, op, opFunc)
Definition: pointPatchFieldFunctions.H:213
BINARY_OPERATOR
#define BINARY_OPERATOR(Type1, Type2, op, opFunc)
Definition: pointPatchFieldFunctions.H:169
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::cmptAv
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:246
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::negate
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cmptDivide
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
f
labelList f(nPoints)
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::outer
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:942
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::FieldOps::assign
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
Definition: FieldOps.C:35
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:51
Foam::det
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:62
Foam::hdual
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
Definition: pointPatchFieldFunctions.H:273
Foam::multiply
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Foam::cross
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:943
Foam::twoSymm
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:95
Foam::outerProduct
Definition: products.H:106
BINARY_TYPE_OPERATOR_FS
#define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc)
Definition: pointPatchFieldFunctions.H:196
Foam::dev
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:106
Foam::dotdot
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:945