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-------------------------------------------------------------------------------
11License
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
27Note
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
36namespace Foam
37{
38
39/* * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * */
40
41template<class Type>
42inline void component
43(
46 const direction d
47)
48{}
49
50
51template<class Type>
52inline void T
53(
55 const pointPatchField<Type>& f2
56)
57{}
58
59
60template<class Type, direction r>
61inline void pow
62(
64 const pointPatchField<Type>& vf
65)
66{}
67
68
69template<class Type>
70inline void sqr
71(
73 const pointPatchField<Type>& vf
74)
75{}
76
77
78template<class Type>
79inline void magSqr
80(
83)
84{}
85
86
87template<class Type>
88inline void mag
89(
92)
93{}
94
95
96template<class Type>
97inline void cmptAv
98(
101)
102{}
103
104
105template<class Type>
106inline void cmptMag
107(
110)
111{}
112
113
114#define BINARY_FUNCTION(func) \
115 \
116template<class Type> \
117inline void func \
118( \
119 pointPatchField<Type>& f, \
120 const pointPatchField<Type>& f1, \
121 const pointPatchField<Type>& f2 \
122) \
123{} \
124 \
125template<class Type> \
126inline 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
141template<class Type>
142inline 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
148template<class Type>
149inline 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 \
159template<class Type> \
160inline 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 \
171template<class Type> \
172inline void opFunc \
173( \
174 pointPatchField<Type>& f, \
175 const pointPatchField<Type1>& f1, \
176 const pointPatchField<Type2>& f2 \
177) \
178{}
179
180BINARY_OPERATOR(scalar, Type, *, multiply)
181BINARY_OPERATOR(Type, scalar, *, multiply)
182BINARY_OPERATOR(Type, scalar, /, divide)
183
184#define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc) \
185 \
186template<class Type> \
187inline 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 \
198template<class Type> \
199inline 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 \
215template \
216< \
217 class Type1, \
218 class Type2 \
219> \
220inline 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 \
229template \
230< \
231 class Type, \
232 class Form, \
233 class Cmpt, \
234 direction nCmpt \
235> \
236inline 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 \
245template \
246< \
247 class Form, \
248 class Cmpt, \
249 direction nCmpt, \
250 class Type \
251> \
252inline 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
272inline void hdual
273(
276)
277{}
278
279inline void hdual
280(
283)
284{}
285
286inline void diag
287(
290)
291{}
292
293inline void tr
294(
297)
298{}
299
300inline void dev
301(
304)
305{}
306
307inline void dev2
308(
311)
312{}
313
314inline void det
315(
318)
319{}
320
321inline void inv
322(
325)
326{}
327
328inline void symm
329(
332)
333{}
334
335inline void twoSymm
336(
339)
340{}
341
342inline void skew
343(
346)
347{}
348
349
350// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351
352namespace FieldOps
353{
354
355// Workarounds for missing functionality.
356// See FieldOps.H, and GeometricFieldOps.H
357
358template<class Tout, class T1, class UnaryOp>
359inline void assign
360(
361 pointPatchField<Tout>& result,
362 const pointPatchField<T1>& a,
363 const UnaryOp& op
364)
365{}
366
367
368template<class Tout, class T1, class T2, class BinaryOp>
369inline void assign
370(
371 pointPatchField<Tout>& result,
372 const pointPatchField<T1>& a,
373 const pointPatchField<T2>& b,
374 const BinaryOp& bop
375)
376{}
377
378template<class T, class BinaryOp>
379inline void ternary
380(
381 pointPatchField<T>& result,
382 const pointPatchField<T>& a,
383 const pointPatchField<T>& b,
384 const BinaryOp& bop
385)
386{}
387
388template<class T, class BoolType, class FlipOp>
389inline 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// ************************************************************************* //
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Generic templated field type.
Definition: Field.H:82
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
Abstract base class for point-mesh patch fields.
type
Volume classification types.
Definition: volumeType.H:66
const volScalarField & T
#define PRODUCT_OPERATOR(product, op, opFunc)
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:36
void ternarySelect(Field< T > &result, const BoolListType &cond, const Field< T > &a, const Field< T > &b, const FlipOp &flip)
Definition: FieldOps.C:107
void ternary(Field< T > &result, const Field< T > &a, const Field< T > &b, const BinaryOp &bop)
Definition: FieldOps.C:81
Namespace for OpenFOAM.
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
uint8_t direction
Definition: direction.H:56
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh > > cmptAv(const DimensionedField< Type, GeoMesh > &df)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedTensor skew(const dimensionedTensor &dt)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
labelList f(nPoints)
volScalarField & b
Definition: createFields.H:27