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 | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "PstreamReduceOps.H"
27 #include "FieldReuseFunctions.H"
28 
29 #define TEMPLATE template<class Type>
30 #include "FieldFunctionsM.C"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 /* * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * */
38 
39 template<class Type>
40 void component
41 (
42  Field<typename Field<Type>::cmptType>& res,
43  const UList<Type>& f,
44  const direction d
45 )
46 {
47  typedef typename Field<Type>::cmptType cmptType;
49  (
50  cmptType, res, =, Type, f, .component, const direction, d
51  )
52 }
53 
54 
55 template<class Type>
56 void T(Field<Type>& res, const UList<Type>& f)
57 {
58  TFOR_ALL_F_OP_F_FUNC(Type, res, =, Type, f, T)
59 }
60 
61 
62 template<class Type, int r>
63 void pow
64 (
65  Field<typename powProduct<Type, r>::type>& res,
66  const UList<Type>& vf
67 )
68 {
69  typedef typename powProduct<Type, r>::type powProductType;
71  (
72  powProductType, res, =, pow, Type, vf, powProductType,
74  )
75 }
76 
77 template<class Type, int r>
79 pow
80 (
81  const UList<Type>& f,
83 )
84 {
85  typedef typename powProduct<Type, r>::type powProductType;
87  (
89  );
90  pow<Type, r>(tRes(), f);
91  return tRes;
92 }
93 
94 template<class Type, int r>
96 pow
97 (
98  const tmp<Field<Type> >& tf,
100 )
101 {
102  typedef typename powProduct<Type, r>::type powProductType;
104  pow<Type, r>(tRes(), tf());
106  return tRes;
107 }
108 
109 
110 template<class Type>
111 void sqr
112 (
113  Field<typename outerProduct<Type, Type>::type>& res,
114  const UList<Type>& vf
115 )
116 {
117  typedef typename outerProduct<Type, Type>::type outerProductType;
118  TFOR_ALL_F_OP_FUNC_F(outerProductType, res, =, sqr, Type, vf)
119 }
120 
121 template<class Type>
123 sqr(const UList<Type>& f)
124 {
125  typedef typename outerProduct<Type, Type>::type outerProductType;
127  (
129  );
130  sqr(tRes(), f);
131  return tRes;
132 }
133 
134 template<class Type>
137 {
138  typedef typename outerProduct<Type, Type>::type outerProductType;
141  sqr(tRes(), tf());
143  return tRes;
144 }
145 
146 
147 template<class Type>
148 void magSqr(Field<scalar>& res, const UList<Type>& f)
149 {
150  TFOR_ALL_F_OP_FUNC_F(scalar, res, =, magSqr, Type, f)
151 }
152 
153 template<class Type>
155 {
156  tmp<Field<scalar> > tRes(new Field<scalar>(f.size()));
157  magSqr(tRes(), f);
158  return tRes;
159 }
160 
161 template<class Type>
163 {
165  magSqr(tRes(), tf());
167  return tRes;
168 }
169 
170 
171 template<class Type>
172 void mag(Field<scalar>& res, const UList<Type>& f)
173 {
174  TFOR_ALL_F_OP_FUNC_F(scalar, res, =, mag, Type, f)
175 }
176 
177 template<class Type>
179 {
180  tmp<Field<scalar> > tRes(new Field<scalar>(f.size()));
181  mag(tRes(), f);
182  return tRes;
183 }
184 
185 template<class Type>
187 {
189  mag(tRes(), tf());
191  return tRes;
192 }
193 
194 
195 template<class Type>
196 void cmptMax(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f)
197 {
198  typedef typename Field<Type>::cmptType cmptType;
199  TFOR_ALL_F_OP_FUNC_F(cmptType, res, =, cmptMax, Type, f)
200 }
201 
202 template<class Type>
204 {
205  typedef typename Field<Type>::cmptType cmptType;
206  tmp<Field<cmptType> > tRes(new Field<cmptType>(f.size()));
207  cmptMax(tRes(), f);
208  return tRes;
209 }
210 
211 template<class Type>
213 {
214  typedef typename Field<Type>::cmptType cmptType;
216  cmptMax(tRes(), tf());
218  return tRes;
219 }
220 
221 
222 template<class Type>
223 void cmptMin(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f)
224 {
225  typedef typename Field<Type>::cmptType cmptType;
226  TFOR_ALL_F_OP_FUNC_F(cmptType, res, =, cmptMin, Type, f)
227 }
228 
229 template<class Type>
231 {
232  typedef typename Field<Type>::cmptType cmptType;
233  tmp<Field<cmptType> > tRes(new Field<cmptType>(f.size()));
234  cmptMin(tRes(), f);
235  return tRes;
236 }
237 
238 template<class Type>
240 {
241  typedef typename Field<Type>::cmptType cmptType;
243  cmptMin(tRes(), tf());
245  return tRes;
246 }
247 
248 
249 template<class Type>
250 void cmptAv(Field<typename Field<Type>::cmptType>& res, const UList<Type>& f)
251 {
252  typedef typename Field<Type>::cmptType cmptType;
253  TFOR_ALL_F_OP_FUNC_F(cmptType, res, =, cmptAv, Type, f)
254 }
255 
256 template<class Type>
258 {
259  typedef typename Field<Type>::cmptType cmptType;
260  tmp<Field<cmptType> > tRes(new Field<cmptType>(f.size()));
261  cmptAv(tRes(), f);
262  return tRes;
263 }
264 
265 template<class Type>
267 {
268  typedef typename Field<Type>::cmptType cmptType;
270  cmptAv(tRes(), tf());
272  return tRes;
273 }
274 
275 
276 template<class Type>
277 void cmptMag(Field<Type>& res, const UList<Type>& f)
278 {
279  TFOR_ALL_F_OP_FUNC_F(Type, res, =, cmptMag, Type, f)
280 }
281 
282 template<class Type>
284 {
285  tmp<Field<Type> > tRes(new Field<Type>(f.size()));
286  cmptMag(tRes(), f);
287  return tRes;
288 }
289 
290 template<class Type>
292 {
294  cmptMag(tRes(), tf());
296  return tRes;
297 }
298 
299 
300 #define TMP_UNARY_FUNCTION(ReturnType, Func) \
301  \
302 template<class Type> \
303 ReturnType Func(const tmp<Field<Type> >& tf1) \
304 { \
305  ReturnType res = Func(tf1()); \
306  tf1.clear(); \
307  return res; \
308 }
309 
310 template<class Type>
311 Type max(const UList<Type>& f)
312 {
313  if (f.size())
314  {
315  Type Max(f[0]);
316  TFOR_ALL_S_OP_FUNC_F_S(Type, Max, =, max, Type, f, Type, Max)
317  return Max;
318  }
319  else
320  {
321  return pTraits<Type>::min;
322  }
323 }
324 
326 
327 template<class Type>
328 Type min(const UList<Type>& f)
329 {
330  if (f.size())
331  {
332  Type Min(f[0]);
333  TFOR_ALL_S_OP_FUNC_F_S(Type, Min, =, min, Type, f, Type, Min)
334  return Min;
335  }
336  else
337  {
338  return pTraits<Type>::max;
339  }
340 }
341 
343 
344 template<class Type>
345 Type sum(const UList<Type>& f)
346 {
347  if (f.size())
348  {
349  Type Sum = pTraits<Type>::zero;
350  TFOR_ALL_S_OP_F(Type, Sum, +=, Type, f)
351  return Sum;
352  }
353  else
354  {
355  return pTraits<Type>::zero;
356  }
357 }
358 
360 
361 template<class Type>
362 Type maxMagSqr(const UList<Type>& f)
363 {
364  if (f.size())
365  {
366  Type Max(f[0]);
368  (
369  Type,
370  Max,
371  =,
373  Type,
374  f,
375  Type,
376  Max
377  )
378  return Max;
379  }
380  else
381  {
382  return pTraits<Type>::zero;
383  }
384 }
385 
386 TMP_UNARY_FUNCTION(Type, maxMagSqr)
387 
388 template<class Type>
389 Type minMagSqr(const UList<Type>& f)
390 {
391  if (f.size())
392  {
393  Type Min(f[0]);
395  (
396  Type,
397  Min,
398  =,
400  Type,
401  f,
402  Type,
403  Min
404  )
405  return Min;
406  }
407  else
408  {
409  return pTraits<Type>::rootMax;
410  }
411 }
412 
413 TMP_UNARY_FUNCTION(Type, minMagSqr)
414 
415 template<class Type>
416 scalar sumProd(const UList<Type>& f1, const UList<Type>& f2)
417 {
418  if (f1.size() && (f1.size() == f2.size()))
419  {
420  scalar SumProd = 0.0;
421  TFOR_ALL_S_OP_F_OP_F(scalar, SumProd, +=, Type, f1, &&, Type, f2)
422  return SumProd;
423  }
424  else
425  {
426  return 0.0;
427  }
428 }
429 
430 
431 template<class Type>
432 Type sumCmptProd(const UList<Type>& f1, const UList<Type>& f2)
433 {
434  if (f1.size() && (f1.size() == f2.size()))
435  {
436  Type SumProd = pTraits<Type>::zero;
438  (
439  Type,
440  SumProd,
441  +=,
442  cmptMultiply,
443  Type,
444  f1,
445  Type,
446  f2
447  )
448  return SumProd;
449  }
450  else
451  {
452  return pTraits<Type>::zero;
453  }
454 }
455 
456 
457 template<class Type>
458 scalar sumSqr(const UList<Type>& f)
459 {
460  if (f.size())
461  {
462  scalar SumSqr = 0.0;
463  TFOR_ALL_S_OP_FUNC_F(scalar, SumSqr, +=, sqr, Type, f)
464  return SumSqr;
465  }
466  else
467  {
468  return 0.0;
469  }
470 }
471 
472 TMP_UNARY_FUNCTION(scalar, sumSqr)
473 
474 template<class Type>
475 scalar sumMag(const UList<Type>& f)
476 {
477  if (f.size())
478  {
479  scalar SumMag = 0.0;
480  TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, mag, Type, f)
481  return SumMag;
482  }
483  else
484  {
485  return 0.0;
486  }
487 }
488 
489 TMP_UNARY_FUNCTION(scalar, sumMag)
490 
491 
492 template<class Type>
493 Type sumCmptMag(const UList<Type>& f)
494 {
495  if (f.size())
496  {
497  Type SumMag = pTraits<Type>::zero;
498  TFOR_ALL_S_OP_FUNC_F(scalar, SumMag, +=, cmptMag, Type, f)
499  return SumMag;
500  }
501  else
502  {
503  return pTraits<Type>::zero;
504  }
505 }
506 
507 TMP_UNARY_FUNCTION(Type, sumCmptMag)
508 
509 template<class Type>
510 Type average(const UList<Type>& f)
511 {
512  if (f.size())
513  {
514  Type avrg = sum(f)/f.size();
515 
516  return avrg;
517  }
518  else
519  {
520  WarningIn("average(const UList<Type>&)")
521  << "empty field, returning zero" << endl;
522 
523  return pTraits<Type>::zero;
524  }
525 }
526 
528 
529 
530 #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \
531  \
532 template<class Type> \
533 ReturnType gFunc(const UList<Type>& f, const label comm) \
534 { \
535  ReturnType res = Func(f); \
536  reduce(res, rFunc##Op<Type>(), Pstream::msgType(), comm); \
537  return res; \
538 } \
539 TMP_UNARY_FUNCTION(ReturnType, gFunc)
540 
542 G_UNARY_FUNCTION(Type, gMin, min, min)
543 G_UNARY_FUNCTION(Type, gSum, sum, sum)
544 G_UNARY_FUNCTION(Type, gMaxMagSqr, maxMagSqr, maxMagSqr)
545 G_UNARY_FUNCTION(Type, gMinMagSqr, minMagSqr, minMagSqr)
546 G_UNARY_FUNCTION(scalar, gSumSqr, sumSqr, sum)
547 G_UNARY_FUNCTION(scalar, gSumMag, sumMag, sum)
548 G_UNARY_FUNCTION(Type, gSumCmptMag, sumCmptMag, sum)
549 
550 #undef G_UNARY_FUNCTION
551 
552 template<class Type>
553 scalar gSumProd
554 (
555  const UList<Type>& f1,
556  const UList<Type>& f2,
557  const label comm
558 )
559 {
560  scalar SumProd = sumProd(f1, f2);
561  reduce(SumProd, sumOp<scalar>(), Pstream::msgType(), comm);
562  return SumProd;
563 }
564 
565 template<class Type>
566 Type gSumCmptProd
567 (
568  const UList<Type>& f1,
569  const UList<Type>& f2,
570  const label comm
571 )
572 {
573  Type SumProd = sumCmptProd(f1, f2);
574  reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm);
575  return SumProd;
576 }
577 
578 template<class Type>
579 Type gAverage
580 (
581  const UList<Type>& f,
582  const label comm
583 )
584 {
585  label n = f.size();
586  Type s = sum(f);
587  sumReduce(s, n, Pstream::msgType(), comm);
588 
589  if (n > 0)
590  {
591  Type avrg = s/n;
592 
593  return avrg;
594  }
595  else
596  {
597  WarningIn("gAverage(const UList<Type>&)")
598  << "empty field, returning zero." << endl;
599 
600  return pTraits<Type>::zero;
601  }
602 }
603 
605 
606 #undef TMP_UNARY_FUNCTION
607 
608 
609 BINARY_FUNCTION(Type, Type, Type, max)
610 BINARY_FUNCTION(Type, Type, Type, min)
611 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
612 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
613 
614 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
615 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
616 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
617 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
618 
619 
620 /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
621 
622 UNARY_OPERATOR(Type, Type, -, negate)
623 
624 BINARY_OPERATOR(Type, Type, scalar, *, multiply)
625 BINARY_OPERATOR(Type, scalar, Type, *, multiply)
626 BINARY_OPERATOR(Type, Type, scalar, /, divide)
627 
628 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, multiply)
629 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, multiply)
630 
631 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide)
632 
633 
634 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
635 
636 #define PRODUCT_OPERATOR(product, Op, OpFunc) \
637  \
638 template<class Type1, class Type2> \
639 void OpFunc \
640 ( \
641  Field<typename product<Type1, Type2>::type>& res, \
642  const UList<Type1>& f1, \
643  const UList<Type2>& f2 \
644 ) \
645 { \
646  typedef typename product<Type1, Type2>::type productType; \
647  TFOR_ALL_F_OP_F_OP_F(productType, res, =, Type1, f1, Op, Type2, f2) \
648 } \
649  \
650 template<class Type1, class Type2> \
651 tmp<Field<typename product<Type1, Type2>::type> > \
652 operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \
653 { \
654  typedef typename product<Type1, Type2>::type productType; \
655  tmp<Field<productType> > tRes(new Field<productType>(f1.size())); \
656  OpFunc(tRes(), f1, f2); \
657  return tRes; \
658 } \
659  \
660 template<class Type1, class Type2> \
661 tmp<Field<typename product<Type1, Type2>::type> > \
662 operator Op(const UList<Type1>& f1, const tmp<Field<Type2> >& tf2) \
663 { \
664  typedef typename product<Type1, Type2>::type productType; \
665  tmp<Field<productType> > tRes = reuseTmp<productType, Type2>::New(tf2); \
666  OpFunc(tRes(), f1, tf2()); \
667  reuseTmp<productType, Type2>::clear(tf2); \
668  return tRes; \
669 } \
670  \
671 template<class Type1, class Type2> \
672 tmp<Field<typename product<Type1, Type2>::type> > \
673 operator Op(const tmp<Field<Type1> >& tf1, const UList<Type2>& f2) \
674 { \
675  typedef typename product<Type1, Type2>::type productType; \
676  tmp<Field<productType> > tRes = reuseTmp<productType, Type1>::New(tf1); \
677  OpFunc(tRes(), tf1(), f2); \
678  reuseTmp<productType, Type1>::clear(tf1); \
679  return tRes; \
680 } \
681  \
682 template<class Type1, class Type2> \
683 tmp<Field<typename product<Type1, Type2>::type> > \
684 operator Op(const tmp<Field<Type1> >& tf1, const tmp<Field<Type2> >& tf2) \
685 { \
686  typedef typename product<Type1, Type2>::type productType; \
687  tmp<Field<productType> > tRes = \
688  reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \
689  OpFunc(tRes(), tf1(), tf2()); \
690  reuseTmpTmp<productType, Type1, Type1, Type2>::clear(tf1, tf2); \
691  return tRes; \
692 } \
693  \
694 template<class Type, class Form, class Cmpt, int nCmpt> \
695 void OpFunc \
696 ( \
697  Field<typename product<Type, Form>::type>& res, \
698  const UList<Type>& f1, \
699  const VectorSpace<Form,Cmpt,nCmpt>& vs \
700 ) \
701 { \
702  typedef typename product<Type, Form>::type productType; \
703  TFOR_ALL_F_OP_F_OP_S \
704  (productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs))\
705 } \
706  \
707 template<class Type, class Form, class Cmpt, int nCmpt> \
708 tmp<Field<typename product<Type, Form>::type> > \
709 operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
710 { \
711  typedef typename product<Type, Form>::type productType; \
712  tmp<Field<productType> > tRes(new Field<productType>(f1.size())); \
713  OpFunc(tRes(), f1, static_cast<const Form&>(vs)); \
714  return tRes; \
715 } \
716  \
717 template<class Type, class Form, class Cmpt, int nCmpt> \
718 tmp<Field<typename product<Type, Form>::type> > \
719 operator Op \
720 ( \
721  const tmp<Field<Type> >& tf1, \
722  const VectorSpace<Form,Cmpt,nCmpt>& vs \
723 ) \
724 { \
725  typedef typename product<Type, Form>::type productType; \
726  tmp<Field<productType> > tRes = reuseTmp<productType, Type>::New(tf1); \
727  OpFunc(tRes(), tf1(), static_cast<const Form&>(vs)); \
728  reuseTmp<productType, Type>::clear(tf1); \
729  return tRes; \
730 } \
731  \
732 template<class Form, class Cmpt, int nCmpt, class Type> \
733 void OpFunc \
734 ( \
735  Field<typename product<Form, Type>::type>& res, \
736  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
737  const UList<Type>& f1 \
738 ) \
739 { \
740  typedef typename product<Form, Type>::type productType; \
741  TFOR_ALL_F_OP_S_OP_F \
742  (productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \
743 } \
744  \
745 template<class Form, class Cmpt, int nCmpt, class Type> \
746 tmp<Field<typename product<Form, Type>::type> > \
747 operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
748 { \
749  typedef typename product<Form, Type>::type productType; \
750  tmp<Field<productType> > tRes(new Field<productType>(f1.size())); \
751  OpFunc(tRes(), static_cast<const Form&>(vs), f1); \
752  return tRes; \
753 } \
754  \
755 template<class Form, class Cmpt, int nCmpt, class Type> \
756 tmp<Field<typename product<Form, Type>::type> > \
757 operator Op \
758 ( \
759  const VectorSpace<Form,Cmpt,nCmpt>& vs, const tmp<Field<Type> >& tf1 \
760 ) \
761 { \
762  typedef typename product<Form, Type>::type productType; \
763  tmp<Field<productType> > tRes = reuseTmp<productType, Type>::New(tf1); \
764  OpFunc(tRes(), static_cast<const Form&>(vs), tf1()); \
765  reuseTmp<productType, Type>::clear(tf1); \
766  return tRes; \
767 }
768 
771 
776 
777 #undef PRODUCT_OPERATOR
778 
779 
780 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
781 
782 } // End namespace Foam
783 
784 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
785 
786 #include "undefFieldFunctionsM.H"
787 
788 // ************************************************************************* //
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
Definition: FieldM.H:249
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
unsigned char direction
Definition: direction.H:43
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().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 ))
dimensioned< scalar > mag(const dimensioned< Type > &)
labelList f(nPoints)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
#define TFOR_ALL_S_OP_F(typeS, s, OP, typeF, f)
Definition: FieldM.H:372
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc)
Namespace for OpenFOAM.
scalar sumSqr(const UList< Type > &f)
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
Definition: FieldM.H:399
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
Definition: FieldM.H:172
#define TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
Definition: FieldM.H:385
typeOfRank< typename pTraits< arg1 >::cmptType, int(pTraits< arg1 >::rank)+int(pTraits< arg2 >::rank) >::type type
Definition: products.H:72
label n
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
#define TFOR_ALL_S_OP_FUNC_F_S(typeS1, s1, OP, FUNC, typeF, f, typeS2, s2)
Definition: FieldM.H:206
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
static tmp< Field< TypeR > > New(const tmp< Field< Type1 > > &tf1)
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
Definition: FieldM.H:136
#define WarningIn(functionName)
Report a warning using Foam::Warning.
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
#define TFOR_ALL_F_OP_FUNC_F(typeF1, f1, OP, FUNC, typeF2, f2)
Definition: FieldM.H:121
pTraits< Type >::cmptType cmptType
Component type.
Definition: Field.H:86
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define PRODUCT_OPERATOR(product, Op, OpFunc)
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:451
label size() const
Return the number of elements in the UList.
Definition: UListI.H:299
#define TMP_UNARY_FUNCTION(ReturnType, Func)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Pre-declare SubField and related Field type.
Definition: Field.H:57
const tensorField & tf
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
scalar gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
Traits class for primitives.
Definition: pTraits.H:50
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Type gAverage(const FieldField< Field, Type > &f)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
static void clear(const tmp< Field< Type1 > > &tf1)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Type sumCmptProd(const UList< Type > &f1, const UList< Type > &f2)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dotdot(FieldField< Field1, typename scalarProduct< 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)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
scalar sumProd(const UList< Type > &f1, const UList< Type > &f2)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void sumReduce(T &Value, label &Count, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Type gMax(const FieldField< Field, Type > &f)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
A class for managing temporary objects.
Definition: PtrList.H:118
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *int(pTraits< arg1 >::rank) >::type type
Definition: products.H:118
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
#define TFOR_ALL_F_OP_FUNC_F_S(typeF1, f1, OP, FUNC, typeF2, f2, typeS, s)
Definition: FieldM.H:189