FieldFunctions.C
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 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
27\*---------------------------------------------------------------------------*/
28
29#include "PstreamReduceOps.H"
30#include "FieldReuseFunctions.H"
31
32#define TEMPLATE template<class Type>
33#include "FieldFunctionsM.C"
34
35// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
37namespace Foam
38{
39
40/* * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * */
41
42template<class Type>
44(
45 Field<typename Field<Type>::cmptType>& res,
46 const UList<Type>& f,
47 const direction d
48)
49{
50 typedef typename Field<Type>::cmptType cmptType;
52 (
53 cmptType, res, =, Type, f, .component, const direction, d
54 )
55}
56
57
58template<class Type>
59void T(Field<Type>& res, const UList<Type>& f)
60{
61 TFOR_ALL_F_OP_F_FUNC(Type, res, =, Type, f, T)
62}
63
64
65template<class Type, direction r>
66void pow
67(
68 Field<typename powProduct<Type, r>::type>& res,
69 const UList<Type>& vf
70)
71{
72 typedef typename powProduct<Type, r>::type powProductType;
74 (
75 powProductType, res, =, pow, Type, vf, powProductType,
77 )
78}
79
80template<class Type, direction r>
81tmp<Field<typename powProduct<Type, r>::type>>
83(
84 const UList<Type>& f,
86)
87{
88 typedef typename powProduct<Type, r>::type powProductType;
89 auto tres
90 (
92 );
93 pow<Type, r>(tres.ref(), f);
94 return tres;
95}
96
97template<class Type, direction r>
98tmp<Field<typename powProduct<Type, r>::type>>
100(
101 const tmp<Field<Type>>& tf,
103)
104{
105 typedef typename powProduct<Type, r>::type powProductType;
107 pow<Type, r>(tres.ref(), tf());
108 tf.clear();
109 return tres;
110}
111
112
113template<class Type>
114void sqr
115(
117 const UList<Type>& vf
118)
119{
120 typedef typename outerProduct<Type, Type>::type outerProductType;
121 TFOR_ALL_F_OP_FUNC_F(outerProductType, res, =, sqr, Type, vf)
122}
123
124template<class Type>
125tmp<Field<typename outerProduct<Type, Type>::type>>
127{
128 typedef typename outerProduct<Type, Type>::type outerProductType;
129 auto tres
130 (
132 );
133 sqr(tres.ref(), f);
134 return tres;
135}
136
137template<class Type>
138tmp<Field<typename outerProduct<Type, Type>::type>>
139sqr(const tmp<Field<Type>>& tf)
140{
141 typedef typename outerProduct<Type, Type>::type outerProductType;
143 sqr(tres.ref(), tf());
144 tf.clear();
145 return tres;
146}
147
148
149template<class Type>
151(
152 Field<typename typeOfMag<Type>::type>& res,
153 const UList<Type>& f
154)
155{
156 typedef typename typeOfMag<Type>::type magType;
157
158 TFOR_ALL_F_OP_FUNC_F(magType, res, =, magSqr, Type, f)
159}
160
161template<class Type>
162tmp<Field<typename typeOfMag<Type>::type>>
164{
165 typedef typename typeOfMag<Type>::type magType;
166
167 auto tres = tmp<Field<magType>>::New(f.size());
168 magSqr(tres.ref(), f);
169 return tres;
170}
171
172template<class Type>
173tmp<Field<typename typeOfMag<Type>::type>>
175{
176 typedef typename typeOfMag<Type>::type magType;
177
178 auto tres = reuseTmp<magType, Type>::New(tf);
179 magSqr(tres.ref(), tf());
180 tf.clear();
181 return tres;
182}
183
184
185template<class Type>
186void mag
187(
188 Field<typename typeOfMag<Type>::type>& res,
189 const UList<Type>& f
190)
191{
192 typedef typename typeOfMag<Type>::type magType;
193
194 TFOR_ALL_F_OP_FUNC_F(magType, res, =, mag, Type, f)
195}
196
197template<class Type>
198tmp<Field<typename typeOfMag<Type>::type>>
200{
201 typedef typename typeOfMag<Type>::type magType;
202
203 auto tres = tmp<Field<magType>>::New(f.size());
204 mag(tres.ref(), f);
205 return tres;
206}
207
208template<class Type>
209tmp<Field<typename typeOfMag<Type>::type>>
210mag(const tmp<Field<Type>>& tf)
211{
212 typedef typename typeOfMag<Type>::type magType;
213
214 auto tres = reuseTmp<magType, Type>::New(tf);
215 mag(tres.ref(), tf());
216 tf.clear();
217 return tres;
218}
219
220
221template<class Type>
222void cmptMax(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f)
223{
224 typedef typename Field<Type>::cmptType cmptType;
225 TFOR_ALL_F_OP_FUNC_F(cmptType, res, =, cmptMax, Type, f)
226}
227
228template<class Type>
230{
231 typedef typename Field<Type>::cmptType cmptType;
232 auto tres = tmp<Field<cmptType>>::New(f.size());
233 cmptMax(tres.ref(), f);
234 return tres;
235}
236
237template<class Type>
239{
240 typedef typename Field<Type>::cmptType cmptType;
241 auto tres = reuseTmp<cmptType, Type>::New(tf);
242 cmptMax(tres.ref(), tf());
243 tf.clear();
244 return tres;
245}
246
247
248template<class Type>
249void cmptMin(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f)
250{
251 typedef typename Field<Type>::cmptType cmptType;
252 TFOR_ALL_F_OP_FUNC_F(cmptType, res, =, cmptMin, Type, f)
253}
254
255template<class Type>
257{
258 typedef typename Field<Type>::cmptType cmptType;
259 auto tres = tmp<Field<cmptType>>::New(f.size());
260 cmptMin(tres.ref(), f);
261 return tres;
262}
263
264template<class Type>
266{
267 typedef typename Field<Type>::cmptType cmptType;
268 auto tres = reuseTmp<cmptType, Type>::New(tf);
269 cmptMin(tres.ref(), tf());
270 tf.clear();
271 return tres;
272}
273
274
275template<class Type>
276void cmptAv(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f)
277{
278 typedef typename Field<Type>::cmptType cmptType;
279 TFOR_ALL_F_OP_FUNC_F(cmptType, res, =, cmptAv, Type, f)
280}
281
282template<class Type>
284{
285 typedef typename Field<Type>::cmptType cmptType;
286 auto tres = tmp<Field<cmptType>>::New(f.size());
287 cmptAv(tres.ref(), f);
288 return tres;
289}
290
291template<class Type>
293{
294 typedef typename Field<Type>::cmptType cmptType;
295 auto tres = reuseTmp<cmptType, Type>::New(tf);
296 cmptAv(tres.ref(), tf());
297 tf.clear();
298 return tres;
299}
300
301
302template<class Type>
304{
305 TFOR_ALL_F_OP_FUNC_F(Type, res, =, cmptMag, Type, f)
306}
307
308template<class Type>
310{
311 auto tres = tmp<Field<Type>>::New(f.size());
312 cmptMag(tres.ref(), f);
313 return tres;
314}
315
316template<class Type>
318{
319 auto tres = New(tf);
320 cmptMag(tres.ref(), tf());
321 tf.clear();
322 return tres;
323}
324
325
326template<class Type>
328{
329 TFOR_ALL_F_OP_FUNC_F(Type, res, =, cmptMagSqr, Type, f)
330}
331
332template<class Type>
334{
335 auto tres = tmp<Field<Type>>::New(f.size());
336 cmptMagSqr(tres.ref(), f);
337 return tres;
338}
339
340template<class Type>
342{
343 auto tres = New(tf);
344 cmptMagSqr(tres.ref(), tf());
345 tf.clear();
346 return tres;
347}
348
349
350#define TMP_UNARY_FUNCTION(ReturnType, Func) \
351 \
352template<class Type> \
353ReturnType Func(const tmp<Field<Type>>& tf1) \
354{ \
355 ReturnType res = Func(tf1()); \
356 tf1.clear(); \
357 return res; \
358}
359
360template<class Type>
361Type max(const UList<Type>& f)
362{
363 if (f.size())
364 {
365 Type Max(f[0]);
366 TFOR_ALL_S_OP_FUNC_F_S(Type, Max, =, max, Type, f, Type, Max)
367 return Max;
368 }
369
370 return pTraits<Type>::min;
371}
372
374
375template<class Type>
376Type min(const UList<Type>& f)
377{
378 if (f.size())
379 {
380 Type Min(f[0]);
381 TFOR_ALL_S_OP_FUNC_F_S(Type, Min, =, min, Type, f, Type, Min)
382 return Min;
383 }
384
385 return pTraits<Type>::max;
386}
387
389
390template<class Type>
391Type sum(const UList<Type>& f)
392{
393 typedef typename Foam::typeOfSolve<Type>::type solveType;
394
395 solveType Sum = Zero;
396
397 if (f.size())
398 {
399 TFOR_ALL_S_OP_FUNC_F(solveType, Sum, +=, solveType, Type, f)
400 }
401
402 return Type(Sum);
403}
404
406
407
408// From MinMaxOps.H:
409// - Foam::minMax(const UList<Type>&)
410// - Foam::minMaxMag(const UList<Type>&)
411
414
415
416template<class Type>
417Type maxMagSqr(const UList<Type>& f)
418{
419 if (f.size())
420 {
421 Type Max(f[0]);
423 (
424 Type,
425 Max,
426 =,
428 Type,
429 f,
430 Type,
431 Max
432 )
433 return Max;
434 }
435
436 return Zero;
437}
438
440
441template<class Type>
443{
444 if (f.size())
445 {
446 Type Min(f[0]);
448 (
449 Type,
450 Min,
451 =,
453 Type,
454 f,
455 Type,
456 Min
457 )
458 return Min;
459 }
460
462}
463
465
466template<class Type>
468sumProd(const UList<Type>& f1, const UList<Type>& f2)
469{
470 typedef typename scalarProduct<Type, Type>::type prodType;
471
472 prodType result = Zero;
473 if (f1.size() && (f1.size() == f2.size()))
474 {
475 TFOR_ALL_S_OP_F_OP_F(prodType, result, +=, Type, f1, &&, Type, f2)
476 }
477 return result;
478}
479
480
481template<class Type>
482Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
483{
484 Type SumProd = Zero;
485 if (f1.size() && (f1.size() == f2.size()))
486 {
488 (
489 Type,
490 SumProd,
491 +=,
493 Type,
494 f1,
495 Type,
496 f2
497 )
498 }
499 return SumProd;
500}
501
502
503template<class Type>
506{
507 typedef typename outerProduct1<Type>::type prodType;
508 prodType result = Zero;
509 if (f.size())
510 {
511 TFOR_ALL_S_OP_FUNC_F(prodType, result, +=, sqr, Type, f)
512 }
513 return result;
514}
515
516template<class Type>
519{
520 typedef typename outerProduct1<Type>::type prodType;
521 prodType result = sumSqr(tf());
522 tf.clear();
523 return result;
524}
525
526
527template<class Type>
530{
531 typedef typename typeOfMag<Type>::type magType;
532 magType result = Zero;
533 if (f.size())
534 {
535 TFOR_ALL_S_OP_FUNC_F(magType, result, +=, mag, Type, f)
536 }
537 return result;
538}
539
541
542
543template<class Type>
545{
546 Type result = Zero;
547 if (f.size())
548 {
549 TFOR_ALL_S_OP_FUNC_F(Type, result, +=, cmptMag, Type, f)
550 }
551 return result;
552}
553
555
556template<class Type>
558{
559 if (f.size())
560 {
561 Type avrg = sum(f)/f.size();
562
563 return avrg;
564 }
565
567 << "empty field, returning zero" << endl;
568
569 return Zero;
570}
571
573
574
575// With reduction on ReturnType
576#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \
577 \
578template<class Type> \
579ReturnType gFunc(const UList<Type>& f, const label comm) \
580{ \
581 ReturnType res = Func(f); \
582 reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \
583 return res; \
584} \
585TMP_UNARY_FUNCTION(ReturnType, gFunc)
586
593
596
599
600#undef G_UNARY_FUNCTION
601
602
603template<class Type>
605(
606 const UList<Type>& f1,
607 const UList<Type>& f2,
608 const label comm
609)
610{
611 typedef typename scalarProduct<Type, Type>::type prodType;
612
613 prodType result = sumProd(f1, f2);
614 reduce(result, sumOp<prodType>(), Pstream::msgType(), comm);
615 return result;
616}
617
618template<class Type>
620(
621 const UList<Type>& f1,
622 const UList<Type>& f2,
623 const label comm
624)
625{
626 Type SumProd = sumCmptProd(f1, f2);
627 reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm);
628 return SumProd;
629}
630
631template<class Type>
633(
634 const UList<Type>& f,
635 const label comm
636)
637{
638 label n = f.size();
639 Type s = sum(f);
640 sumReduce(s, n, Pstream::msgType(), comm);
641
642 if (n > 0)
643 {
644 Type avrg = s/n;
645
646 return avrg;
647 }
648
650 << "empty field, returning zero." << endl;
651
652 return Zero;
653}
654
656
657#undef TMP_UNARY_FUNCTION
658
659
660BINARY_FUNCTION(Type, Type, Type, max)
661BINARY_FUNCTION(Type, Type, Type, min)
663BINARY_FUNCTION(Type, Type, Type, cmptDivide)
664
665BINARY_TYPE_FUNCTION(Type, Type, Type, max)
666BINARY_TYPE_FUNCTION(Type, Type, Type, min)
669
671
672
673/* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
674
675UNARY_OPERATOR(Type, Type, -, negate)
676
677BINARY_OPERATOR(Type, Type, scalar, *, multiply)
678BINARY_OPERATOR(Type, scalar, Type, *, multiply)
679BINARY_OPERATOR(Type, Type, scalar, /, divide)
680
681BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, multiply)
682BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, multiply)
683
684BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide)
685
686
687// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
688
689#define PRODUCT_OPERATOR(product, Op, OpFunc) \
690 \
691template<class Type1, class Type2> \
692void OpFunc \
693( \
694 Field<typename product<Type1, Type2>::type>& res, \
695 const UList<Type1>& f1, \
696 const UList<Type2>& f2 \
697) \
698{ \
699 typedef typename product<Type1, Type2>::type productType; \
700 TFOR_ALL_F_OP_F_OP_F(productType, res, =, Type1, f1, Op, Type2, f2) \
701} \
702 \
703template<class Type1, class Type2> \
704tmp<Field<typename product<Type1, Type2>::type>> \
705operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \
706{ \
707 typedef typename product<Type1, Type2>::type productType; \
708 auto tres = tmp<Field<productType>>::New(f1.size()); \
709 OpFunc(tres.ref(), f1, f2); \
710 return tres; \
711} \
712 \
713template<class Type1, class Type2> \
714tmp<Field<typename product<Type1, Type2>::type>> \
715operator Op(const UList<Type1>& f1, const tmp<Field<Type2>>& tf2) \
716{ \
717 typedef typename product<Type1, Type2>::type productType; \
718 auto tres = reuseTmp<productType, Type2>::New(tf2); \
719 OpFunc(tres.ref(), f1, tf2()); \
720 tf2.clear(); \
721 return tres; \
722} \
723 \
724template<class Type1, class Type2> \
725tmp<Field<typename product<Type1, Type2>::type>> \
726operator Op(const tmp<Field<Type1>>& tf1, const UList<Type2>& f2) \
727{ \
728 typedef typename product<Type1, Type2>::type productType; \
729 auto tres = reuseTmp<productType, Type1>::New(tf1); \
730 OpFunc(tres.ref(), tf1(), f2); \
731 tf1.clear(); \
732 return tres; \
733} \
734 \
735template<class Type1, class Type2> \
736tmp<Field<typename product<Type1, Type2>::type>> \
737operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \
738{ \
739 typedef typename product<Type1, Type2>::type productType; \
740 auto tres = reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \
741 OpFunc(tres.ref(), tf1(), tf2()); \
742 tf1.clear(); \
743 tf2.clear(); \
744 return tres; \
745} \
746 \
747template<class Type, class Form, class Cmpt, direction nCmpt> \
748void OpFunc \
749( \
750 Field<typename product<Type, Form>::type>& res, \
751 const UList<Type>& f1, \
752 const VectorSpace<Form,Cmpt,nCmpt>& vs \
753) \
754{ \
755 typedef typename product<Type, Form>::type productType; \
756 TFOR_ALL_F_OP_F_OP_S \
757 (productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs)) \
758} \
759 \
760template<class Type, class Form, class Cmpt, direction nCmpt> \
761tmp<Field<typename product<Type, Form>::type>> \
762operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
763{ \
764 typedef typename product<Type, Form>::type productType; \
765 auto tres = tmp<Field<productType>>::New(f1.size()); \
766 OpFunc(tres.ref(), f1, static_cast<const Form&>(vs)); \
767 return tres; \
768} \
769 \
770template<class Type, class Form, class Cmpt, direction nCmpt> \
771tmp<Field<typename product<Type, Form>::type>> \
772operator Op \
773( \
774 const tmp<Field<Type>>& tf1, \
775 const VectorSpace<Form,Cmpt,nCmpt>& vs \
776) \
777{ \
778 typedef typename product<Type, Form>::type productType; \
779 auto tres = reuseTmp<productType, Type>::New(tf1); \
780 OpFunc(tres.ref(), tf1(), static_cast<const Form&>(vs)); \
781 tf1.clear(); \
782 return tres; \
783} \
784 \
785template<class Form, class Cmpt, direction nCmpt, class Type> \
786void OpFunc \
787( \
788 Field<typename product<Form, Type>::type>& res, \
789 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
790 const UList<Type>& f1 \
791) \
792{ \
793 typedef typename product<Form, Type>::type productType; \
794 TFOR_ALL_F_OP_S_OP_F \
795 (productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \
796} \
797 \
798template<class Form, class Cmpt, direction nCmpt, class Type> \
799tmp<Field<typename product<Form, Type>::type>> \
800operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
801{ \
802 typedef typename product<Form, Type>::type productType; \
803 auto tres = tmp<Field<productType>>::New(f1.size()); \
804 OpFunc(tres.ref(), static_cast<const Form&>(vs), f1); \
805 return tres; \
806} \
807 \
808template<class Form, class Cmpt, direction nCmpt, class Type> \
809tmp<Field<typename product<Form, Type>::type>> \
810operator Op \
811( \
812 const VectorSpace<Form,Cmpt,nCmpt>& vs, const tmp<Field<Type>>& tf1 \
813) \
814{ \
815 typedef typename product<Form, Type>::type productType; \
816 auto tres = reuseTmp<productType, Type>::New(tf1); \
817 OpFunc(tres.ref(), static_cast<const Form&>(vs), tf1()); \
818 tf1.clear(); \
819 return tres; \
820}
821
824
829
830#undef PRODUCT_OPERATOR
831
832
833// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
834
835} // End namespace Foam
836
837// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
838
839#include "undefFieldFunctionsM.H"
840
841// ************************************************************************* //
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
#define BINARY_TYPE_FUNCTION_FS(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)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
#define G_UNARY_FUNCTION(ReturnType, gFunc, func, rFunc)
#define TMP_UNARY_FUNCTION(returnType, func)
#define TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
Definition: FieldM.H:389
#define TFOR_ALL_F_OP_FUNC_F_S(typeF1, f1, OP, FUNC, typeF2, f2, typeS, s)
Definition: FieldM.H:187
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
Definition: FieldM.H:132
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
Definition: FieldM.H:251
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
Definition: FieldM.H:404
#define TFOR_ALL_S_OP_FUNC_F_S(typeS1, s1, OP, FUNC, typeF, f, typeS2, s2)
Definition: FieldM.H:205
#define TFOR_ALL_F_OP_FUNC_F(typeF1, f1, OP, FUNC, typeF2, f2)
Definition: FieldM.H:116
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
Definition: FieldM.H:169
Inter-processor communication reduction functions.
label n
Generic templated field type.
Definition: Field.H:82
A min/max value pair with additional methods. In addition to conveniently storing values,...
Definition: MinMax.H:128
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
static int & msgType() noexcept
Message tag of standard messages.
Definition: UPstream.H:556
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
Outer-product of identical types.
Definition: products.H:123
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
A class for managing temporary objects.
Definition: tmp.H:65
The magnitude type for given argument.
Definition: products.H:89
pTraits< typenamepTraits< arg1 >::cmptType >::magType type
Definition: products.H:92
type
Volume classification types.
Definition: volumeType.H:66
const volScalarField & T
#define PRODUCT_OPERATOR(product, op, opFunc)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for OpenFOAM.
scalarProduct< Type, Type >::type gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
dimensionSet clip(const dimensionSet &ds1, const dimensionSet &ds2)
Definition: dimensionSet.C:278
Type gSum(const FieldField< Field, Type > &f)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Type sumCmptProd(const UList< Type > &f1, const UList< Type > &f2)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Type maxMagSqr(const UList< Type > &f)
void cmptMagSqr(Field< Type > &res, const UList< Type > &f)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Type gMaxMagSqr(const UList< Type > &f, const label comm)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Definition: hashSets.C:61
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &df)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
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 reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
complex sumProd(const UList< complex > &f1, const UList< complex > &f2)
Sum product.
Definition: complexField.C:191
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
void sumReduce(T &value, label &count, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
outerProduct1< Type >::type sumSqr(const UList< Type > &f)
Type gAverage(const FieldField< Field, Type > &f)
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type minMagSqr(const UList< Type > &f)
Type gMin(const FieldField< Field, Type > &f)
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)
outerProduct1< Type >::type gSumSqr(const UList< Type > &f, const label comm)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh > > cmptAv(const DimensionedField< Type, GeoMesh > &df)
Type gMinMagSqr(const UList< Type > &f, const label comm)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
Type gSumCmptMag(const UList< Type > &f, const label comm)
Type gMax(const FieldField< Field, Type > &f)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Type sumCmptMag(const UList< Type > &f)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
labelList f(nPoints)
A non-counting (dummy) refCount.
Definition: refCount.H:59