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 (
54  pointPatchField<Type>& f1,
56 )
57 {}
58 
59 
60 template<class Type, direction r>
61 inline void pow
62 (
63  Field<typename powProduct<Type, r>::type>& f,
65 )
66 {}
67 
68 
69 template<class Type>
70 inline void sqr
71 (
72  Field<typename outerProduct<Type, Type>::type>& f,
74 )
75 {}
76 
77 
78 template<class Type>
79 inline void magSqr
80 (
81  pointPatchField<scalar>& sf,
83 )
84 {}
85 
86 
87 template<class Type>
88 inline void mag
89 (
90  pointPatchField<scalar>& sf,
92 )
93 {}
94 
95 
96 template<class Type>
97 inline void cmptAv
98 (
99  pointPatchField<typename Field<Type>::cmptType>& cf,
101 )
102 {}
103 
104 
105 template<class Type>
106 inline void cmptMag
107 (
108  pointPatchField<Type>& cf,
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 {}
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 {}
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 (
344  pointPatchField<tensor>&,
345  const pointPatchField<tensor>&
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,
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,
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 // ************************************************************************* //
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
uint8_t direction
Definition: direction.H:46
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
#define BINARY_FUNCTION(func)
dimensionedTensor skew(const dimensionedTensor &dt)
void ternarySelect(Field< T > &result, const BoolListType &cond, const Field< T > &a, const Field< T > &b, const FlipOp &flip)
Emulate a ternary operation, selecting values from a or b depending on the conditional.
Definition: FieldOps.C:99
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
pTraits< Type >::cmptType cmptType
Component type.
Definition: Field.H:123
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
#define BINARY_OPERATOR(Type1, Type2, op, opFunc)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:118
dimensionedScalar det(const dimensionedSphericalTensor &dt)
#define PRODUCT_OPERATOR(product, op, opFunc)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
#define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Abstract base class for point-mesh patch fields.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
#define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
void negate(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
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:28
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
labelList f(nPoints)
#define UNARY_OPERATOR(op, opFunc)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:176
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void ternary(Field< T > &result, const Field< T > &a, const Field< T > &b, const BinaryOp &bop)
Emulate a ternary operation, selecting values from a or b depending on the binary predicate...
Definition: FieldOps.C:73
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Type min(const pointPatchField< Type > &)
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Namespace for OpenFOAM.