GeometricFieldFunctions.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) 2018-2019 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 \*---------------------------------------------------------------------------*/
28 
30 
31 #define TEMPLATE \
32  template<class Type, template<class> class PatchField, class GeoMesh>
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
41 
42 template<class Type, template<class> class PatchField, class GeoMesh>
43 void component
44 (
46  <
48  PatchField,
49  GeoMesh
50  >& gcf,
52  const direction d
53 )
54 {
55  component(gcf.primitiveFieldRef(), gf.primitiveField(), d);
56  component(gcf.boundaryFieldRef(), gf.boundaryField(), d);
57  gcf.oriented() = gf.oriented();
58 }
59 
60 
61 template<class Type, template<class> class PatchField, class GeoMesh>
62 void T
63 (
66 )
67 {
68  T(gf.primitiveFieldRef(), gf1.primitiveField());
69  T(gf.boundaryFieldRef(), gf1.boundaryField());
70  gf.oriented() = gf1.oriented();
71 }
72 
73 
74 template
75 <
76  class Type,
77  template<class> class PatchField,
78  class GeoMesh,
79  direction r
80 >
81 void pow
82 (
83  GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
85 )
86 {
87  pow(gf.primitiveFieldRef(), gf1.primitiveField(), r);
88  pow(gf.boundaryFieldRef(), gf1.boundaryField(), r);
89  gf.oriented() = pow(gf1.oriented(), r);
90 }
91 
92 
93 template
94 <
95  class Type,
96  template<class> class PatchField,
97  class GeoMesh,
98  direction r
99 >
101 pow
102 (
105 )
106 {
107  typedef typename powProduct<Type, r>::type powProductType;
108 
109  auto tres =
111  (
112  IOobject
113  (
114  "pow(" + gf.name() + ',' + name(r) + ')',
115  gf.instance(),
116  gf.db(),
119  ),
120  gf.mesh(),
121  pow(gf.dimensions(), r)
122  );
123 
124  pow<Type, r, PatchField, GeoMesh>(tres.ref(), gf);
125 
126  return tres;
127 }
128 
129 
130 template
131 <
132  class Type,
133  template<class> class PatchField,
134  class GeoMesh,
135  direction r
136 >
138 pow
139 (
142 )
143 {
144  typedef typename powProduct<Type, r>::type powProductType;
145 
147 
148  auto tres =
150  (
151  IOobject
152  (
153  "pow(" + gf.name() + ',' + name(r) + ')',
154  gf.instance(),
155  gf.db(),
158  ),
159  gf.mesh(),
160  pow(gf.dimensions(), r)
161  );
162 
163  pow<Type, r, PatchField, GeoMesh>(tres.ref(), gf);
164 
165  tgf.clear();
166  return tres;
167 }
168 
169 
170 template<class Type, template<class> class PatchField, class GeoMesh>
171 void sqr
172 (
174  <typename outerProduct<Type, Type>::type, PatchField, GeoMesh>& gf,
176 )
177 {
178  sqr(gf.primitiveFieldRef(), gf1.primitiveField());
179  sqr(gf.boundaryFieldRef(), gf1.boundaryField());
180  gf.oriented() = sqr(gf1.oriented());
181 }
182 
183 
184 template<class Type, template<class> class PatchField, class GeoMesh>
185 tmp
186 <
187  GeometricField
188  <
190  PatchField,
191  GeoMesh
192  >
193 >
195 {
196  typedef typename outerProduct<Type, Type>::type outerProductType;
197 
198  auto tres =
200  (
201  IOobject
202  (
203  "sqr(" + gf.name() + ')',
204  gf.instance(),
205  gf.db(),
208  ),
209  gf.mesh(),
210  sqr(gf.dimensions())
211  );
212 
213  sqr(tres.ref(), gf);
214 
215  return tres;
216 }
217 
218 
219 template<class Type, template<class> class PatchField, class GeoMesh>
220 tmp
221 <
222  GeometricField
223  <
225  PatchField,
226  GeoMesh
227  >
228 >
230 {
231  typedef typename outerProduct<Type, Type>::type outerProductType;
232 
234 
235  auto tres =
237  (
238  IOobject
239  (
240  "sqr(" + gf.name() + ')',
241  gf.instance(),
242  gf.db(),
245  ),
246  gf.mesh(),
247  sqr(gf.dimensions())
248  );
249 
250  sqr(tres.ref(), gf);
251 
252  tgf.clear();
253 
254  return tres;
255 }
256 
257 
258 template<class Type, template<class> class PatchField, class GeoMesh>
259 void magSqr
260 (
261  GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>& gsf,
263 )
264 {
265  magSqr(gsf.primitiveFieldRef(), gf.primitiveField());
266  magSqr(gsf.boundaryFieldRef(), gf.boundaryField());
267  gsf.oriented() = magSqr(gf.oriented());
268 }
269 
270 
271 template<class Type, template<class> class PatchField, class GeoMesh>
273 magSqr
274 (
276 )
277 {
278  typedef typename typeOfMag<Type>::type magType;
279 
280  auto tres =
282  (
283  IOobject
284  (
285  "magSqr(" + gf.name() + ')',
286  gf.instance(),
287  gf.db(),
290  ),
291  gf.mesh(),
292  sqr(gf.dimensions())
293  );
294 
295  magSqr(tres.ref(), gf);
296 
297  return tres;
298 }
299 
300 template<class Type, template<class> class PatchField, class GeoMesh>
302 magSqr
303 (
305 )
306 {
307  auto tres = magSqr(tgf.cref());
308  tgf.clear();
309 
310  return tres;
311 }
312 
313 
314 template<class Type, template<class> class PatchField, class GeoMesh>
315 void mag
316 (
317  GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>& gsf,
319 )
320 {
321  mag(gsf.primitiveFieldRef(), gf.primitiveField());
322  mag(gsf.boundaryFieldRef(), gf.boundaryField());
323  gsf.oriented() = mag(gf.oriented());
324 }
325 
326 
327 template<class Type, template<class> class PatchField, class GeoMesh>
329 mag
330 (
332 )
333 {
334  typedef typename typeOfMag<Type>::type magType;
335 
336  auto tres =
338  (
339  IOobject
340  (
341  "mag(" + gf.name() + ')',
342  gf.instance(),
343  gf.db(),
346  ),
347  gf.mesh(),
348  gf.dimensions()
349  );
350 
351  mag(tres.ref(), gf);
352 
353  return tres;
354 }
355 
356 template<class Type, template<class> class PatchField, class GeoMesh>
358 mag
359 (
361 )
362 {
363  auto tres = mag(tgf.cref());
364  tgf.clear();
365 
366  return tres;
367 }
368 
369 
370 template<class Type, template<class> class PatchField, class GeoMesh>
371 void cmptAv
372 (
374  <
376  PatchField,
377  GeoMesh
378  >& gcf,
380 )
381 {
382  cmptAv(gcf.primitiveFieldRef(), gf.primitiveField());
383  cmptAv(gcf.boundaryFieldRef(), gf.boundaryField());
384  gcf.oriented() = cmptAv(gf.oriented());
385 }
386 
387 template<class Type, template<class> class PatchField, class GeoMesh>
388 tmp
389 <
390  GeometricField
391  <
393  PatchField,
394  GeoMesh
395  >
396 >
398 {
400  cmptType;
401 
402  auto tres =
404  (
405  IOobject
406  (
407  "cmptAv(" + gf.name() + ')',
408  gf.instance(),
409  gf.db(),
412  ),
413  gf.mesh(),
414  gf.dimensions()
415  );
416 
417  cmptAv(tres.ref(), gf);
418 
419  return tres;
420 }
421 
422 
423 template<class Type, template<class> class PatchField, class GeoMesh>
424 tmp
425 <
426  GeometricField
427  <
429  PatchField,
430  GeoMesh
431  >
432 >
434 {
436  cmptType;
437 
439 
440  auto tres =
442  (
443  IOobject
444  (
445  "cmptAv(" + gf.name() + ')',
446  gf.instance(),
447  gf.db(),
450  ),
451  gf.mesh(),
452  gf.dimensions()
453  );
454 
455  cmptAv(tres.ref(), gf);
456 
457  tgf.clear();
458 
459  return tres;
460 }
461 
462 
463 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, binaryOp) \
464  \
465 template<class Type, template<class> class PatchField, class GeoMesh> \
466 dimensioned<returnType> func \
467 ( \
468  const GeometricField<Type, PatchField, GeoMesh>& gf \
469 ) \
470 { \
471  return dimensioned<returnType> \
472  ( \
473  #func "(" + gf.name() + ')', \
474  gf.dimensions(), \
475  returnReduce \
476  ( \
477  Foam::func \
478  ( \
479  Foam::func(gf.primitiveField()), \
480  Foam::func(gf.boundaryField()) \
481  ), \
482  binaryOp<returnType>() \
483  ) \
484  ); \
485 } \
486  \
487 template<class Type, template<class> class PatchField, class GeoMesh> \
488 dimensioned<returnType> func \
489 ( \
490  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
491 ) \
492 { \
493  dimensioned<returnType> res = func(tgf1()); \
494  tgf1.clear(); \
495  return res; \
496 }
497 
502 
503 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
504 
505 
506 #define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc) \
507  \
508 template<class Type, template<class> class PatchField, class GeoMesh> \
509 dimensioned<returnType> func \
510 ( \
511  const GeometricField<Type, PatchField, GeoMesh>& gf \
512 ) \
513 { \
514  return dimensioned<returnType> \
515  ( \
516  #func "(" + gf.name() + ')', \
517  gf.dimensions(), \
518  gFunc(gf.primitiveField()) \
519  ); \
520 } \
521  \
522 template<class Type, template<class> class PatchField, class GeoMesh> \
523 dimensioned<returnType> func \
524 ( \
525  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
526 ) \
527 { \
528  dimensioned<returnType> res = func(tgf1()); \
529  tgf1.clear(); \
530  return res; \
531 }
532 
536 
537 #undef UNARY_REDUCTION_FUNCTION
538 
539 
540 BINARY_FUNCTION(Type, Type, Type, max)
541 BINARY_FUNCTION(Type, Type, Type, min)
542 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
543 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
544 
545 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
546 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
547 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
548 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
549 
550 
551 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
552 
553 UNARY_OPERATOR(Type, Type, -, negate, transform)
554 
555 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
556 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
557 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
558 
559 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
560 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
561 
562 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
563 
564 
565 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
566 
567 #define PRODUCT_OPERATOR(product, op, opFunc) \
568  \
569 template \
570 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
571 void opFunc \
572 ( \
573  GeometricField \
574  <typename product<Type1, Type2>::type, PatchField, GeoMesh>& gf, \
575  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
576  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
577 ) \
578 { \
579  Foam::opFunc \
580  ( \
581  gf.primitiveFieldRef(), \
582  gf1.primitiveField(), \
583  gf2.primitiveField() \
584  ); \
585  Foam::opFunc \
586  ( \
587  gf.boundaryFieldRef(), \
588  gf1.boundaryField(), \
589  gf2.boundaryField() \
590  ); \
591  \
592  gf.oriented() = gf1.oriented() op gf2.oriented(); \
593 } \
594  \
595 template \
596 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
597 tmp \
598 < \
599  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
600 > \
601 operator op \
602 ( \
603  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
604  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
605 ) \
606 { \
607  typedef typename product<Type1, Type2>::type productType; \
608  \
609  auto tres = \
610  tmp<GeometricField<productType, PatchField, GeoMesh>>::New \
611  ( \
612  IOobject \
613  ( \
614  '(' + gf1.name() + #op + gf2.name() + ')', \
615  gf1.instance(), \
616  gf1.db(), \
617  IOobject::NO_READ, \
618  IOobject::NO_WRITE \
619  ), \
620  gf1.mesh(), \
621  gf1.dimensions() op gf2.dimensions() \
622  ); \
623  \
624  Foam::opFunc(tres.ref(), gf1, gf2); \
625  \
626  return tres; \
627 } \
628  \
629  \
630 template \
631 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
632 tmp \
633 < \
634  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
635 > \
636 operator op \
637 ( \
638  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
639  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
640 ) \
641 { \
642  typedef typename product<Type1, Type2>::type productType; \
643  \
644  const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
645  \
646  auto tres = \
647  reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh>::New \
648  ( \
649  tgf2, \
650  '(' + gf1.name() + #op + gf2.name() + ')', \
651  gf1.dimensions() op gf2.dimensions() \
652  ); \
653  \
654  Foam::opFunc(tres.ref(), gf1, gf2); \
655  \
656  tgf2.clear(); \
657  \
658  return tres; \
659 } \
660  \
661 template \
662 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
663 tmp \
664 < \
665  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
666 > \
667 operator op \
668 ( \
669  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
670  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
671 ) \
672 { \
673  typedef typename product<Type1, Type2>::type productType; \
674  \
675  const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
676  \
677  auto tres = \
678  reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh>::New \
679  ( \
680  tgf1, \
681  '(' + gf1.name() + #op + gf2.name() + ')', \
682  gf1.dimensions() op gf2.dimensions() \
683  ); \
684  \
685  Foam::opFunc(tres.ref(), gf1, gf2); \
686  \
687  tgf1.clear(); \
688  \
689  return tres; \
690 } \
691  \
692 template \
693 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
694 tmp \
695 < \
696  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
697 > \
698 operator op \
699 ( \
700  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
701  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
702 ) \
703 { \
704  typedef typename product<Type1, Type2>::type productType; \
705  \
706  const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
707  const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
708  \
709  auto tres = \
710  reuseTmpTmpGeometricField \
711  <productType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
712  ( \
713  tgf1, \
714  tgf2, \
715  '(' + gf1.name() + #op + gf2.name() + ')', \
716  gf1.dimensions() op gf2.dimensions() \
717  ); \
718  \
719  Foam::opFunc(tres.ref(), gf1, gf2); \
720  \
721  tgf1.clear(); \
722  tgf2.clear(); \
723  \
724  return tres; \
725 } \
726  \
727 template \
728 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
729 void opFunc \
730 ( \
731  GeometricField \
732  <typename product<Type, Form>::type, PatchField, GeoMesh>& gf, \
733  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
734  const dimensioned<Form>& dvs \
735 ) \
736 { \
737  Foam::opFunc(gf.primitiveFieldRef(), gf1.primitiveField(), dvs.value()); \
738  Foam::opFunc(gf.boundaryFieldRef(), gf1.boundaryField(), dvs.value()); \
739  gf.oriented() = gf1.oriented(); \
740 } \
741  \
742 template \
743 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
744 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \
745 operator op \
746 ( \
747  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
748  const dimensioned<Form>& dvs \
749 ) \
750 { \
751  typedef typename product<Type, Form>::type productType; \
752  \
753  auto tres = \
754  tmp<GeometricField<productType, PatchField, GeoMesh>>::New \
755  ( \
756  IOobject \
757  ( \
758  '(' + gf1.name() + #op + dvs.name() + ')', \
759  gf1.instance(), \
760  gf1.db(), \
761  IOobject::NO_READ, \
762  IOobject::NO_WRITE \
763  ), \
764  gf1.mesh(), \
765  gf1.dimensions() op dvs.dimensions() \
766  ); \
767  \
768  Foam::opFunc(tres.ref(), gf1, dvs); \
769  \
770  return tres; \
771 } \
772  \
773 template \
774 < \
775  class Form, \
776  class Cmpt, \
777  direction nCmpt, \
778  class Type, template<class> class PatchField, \
779  class GeoMesh \
780 > \
781 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
782 operator op \
783 ( \
784  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
785  const VectorSpace<Form,Cmpt,nCmpt>& vs \
786 ) \
787 { \
788  return gf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
789 } \
790  \
791  \
792 template \
793 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
794 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \
795 operator op \
796 ( \
797  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1, \
798  const dimensioned<Form>& dvs \
799 ) \
800 { \
801  typedef typename product<Type, Form>::type productType; \
802  \
803  const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
804  \
805  auto tres = \
806  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
807  ( \
808  tgf1, \
809  '(' + gf1.name() + #op + dvs.name() + ')', \
810  gf1.dimensions() op dvs.dimensions() \
811  ); \
812  \
813  Foam::opFunc(tres.ref(), gf1, dvs); \
814  \
815  tgf1.clear(); \
816  \
817  return tres; \
818 } \
819  \
820 template \
821 < \
822  class Form, \
823  class Cmpt, \
824  direction nCmpt, \
825  class Type, template<class> class PatchField, \
826  class GeoMesh \
827 > \
828 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
829 operator op \
830 ( \
831  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1, \
832  const VectorSpace<Form,Cmpt,nCmpt>& vs \
833 ) \
834 { \
835  return tgf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
836 } \
837  \
838  \
839 template \
840 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
841 void opFunc \
842 ( \
843  GeometricField \
844  <typename product<Form, Type>::type, PatchField, GeoMesh>& gf, \
845  const dimensioned<Form>& dvs, \
846  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
847 ) \
848 { \
849  Foam::opFunc(gf.primitiveFieldRef(), dvs.value(), gf1.primitiveField()); \
850  Foam::opFunc(gf.boundaryFieldRef(), dvs.value(), gf1.boundaryField()); \
851  gf.oriented() = gf1.oriented(); \
852 } \
853  \
854 template \
855 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
856 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
857 operator op \
858 ( \
859  const dimensioned<Form>& dvs, \
860  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
861 ) \
862 { \
863  typedef typename product<Form, Type>::type productType; \
864  \
865  auto tres = \
866  tmp<GeometricField<productType, PatchField, GeoMesh>>::New \
867  ( \
868  IOobject \
869  ( \
870  '(' + dvs.name() + #op + gf1.name() + ')', \
871  gf1.instance(), \
872  gf1.db(), \
873  IOobject::NO_READ, \
874  IOobject::NO_WRITE \
875  ), \
876  gf1.mesh(), \
877  dvs.dimensions() op gf1.dimensions() \
878  ); \
879  \
880  Foam::opFunc(tres.ref(), dvs, gf1); \
881  \
882  return tres; \
883 } \
884  \
885 template \
886 < \
887  class Form, \
888  class Cmpt, \
889  direction nCmpt, \
890  class Type, template<class> class PatchField, \
891  class GeoMesh \
892 > \
893 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
894 operator op \
895 ( \
896  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
897  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
898 ) \
899 { \
900  return dimensioned<Form>(static_cast<const Form&>(vs)) op gf1; \
901 } \
902  \
903 template \
904 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
905 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
906 operator op \
907 ( \
908  const dimensioned<Form>& dvs, \
909  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
910 ) \
911 { \
912  typedef typename product<Form, Type>::type productType; \
913  \
914  const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
915  \
916  auto tres = \
917  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
918  ( \
919  tgf1, \
920  '(' + dvs.name() + #op + gf1.name() + ')', \
921  dvs.dimensions() op gf1.dimensions() \
922  ); \
923  \
924  Foam::opFunc(tres.ref(), dvs, gf1); \
925  \
926  tgf1.clear(); \
927  \
928  return tres; \
929 } \
930  \
931 template \
932 < \
933  class Form, \
934  class Cmpt, \
935  direction nCmpt, \
936  class Type, template<class> class PatchField, \
937  class GeoMesh \
938 > \
939 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
940 operator op \
941 ( \
942  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
943  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
944 ) \
945 { \
946  return dimensioned<Form>(static_cast<const Form&>(vs)) op tgf1; \
947 }
948 
951 
956 
957 #undef PRODUCT_OPERATOR
958 
959 
960 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
961 
962 } // End namespace Foam
963 
964 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
965 
966 #include "undefFieldFunctionsM.H"
967 
968 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
BINARY_TYPE_OPERATOR_SF
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:522
BINARY_OPERATOR
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:412
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::maxOp
Definition: ops.H:223
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
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::gSumMag
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:598
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:44
Foam::cmptMultiply
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:604
Foam::minOp
Definition: ops.H:224
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::GeometricField::primitiveField
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Definition: GeometricFieldI.H:53
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
Foam::crossProduct
Definition: products.H:129
undefFieldFunctionsM.H
Foam::sumMag
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:332
Foam::powProduct::type
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:170
Foam::gSum
Type gSum(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:594
BINARY_FUNCTION
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
Definition: DimensionedFieldFunctionsM.C:141
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
Foam::GeometricField::cmptType
Field< Type >::cmptType cmptType
Definition: GeometricField.H:290
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
GeometricFieldReuseFunctions.H
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)
UNARY_REDUCTION_FUNCTION
#define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc)
Definition: GeometricFieldFunctions.C:506
Foam::scalarProduct
Definition: products.H:153
Foam::typeOfSum
Definition: products.H:97
GeometricFieldFunctionsM.C
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::typeOfMag
The magnitude type for given argument.
Definition: products.H:88
Foam::negate
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
Foam::minMaxMagOp
Scalar combine the magitude of a value.
Definition: MinMaxOps.H:236
Foam::minMaxMag
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:330
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::GeoMesh
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:48
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
BINARY_TYPE_FUNCTION
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
Definition: DimensionedFieldFunctionsM.C:405
Foam::GeometricField::primitiveFieldRef
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Definition: GeometricField.C:766
PRODUCT_OPERATOR
#define PRODUCT_OPERATOR(product, op, opFunc)
Definition: GeometricFieldFunctions.C:567
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::cmptDivide
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::minMaxOp
Combine values and/or MinMax ranges.
Definition: MinMaxOps.H:114
UNARY_OPERATOR
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
Definition: DimensionedFieldFunctionsM.C:87
Foam::GeometricField::boundaryFieldRef
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Definition: GeometricField.C:783
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
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::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::minMax
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Definition: hashSets.C:61
BINARY_TYPE_OPERATOR_FS
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:599
Foam::multiply
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::IOobject::NO_READ
Definition: IOobject.H:188
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::typeOfMag::type
pTraits< typename pTraits< arg1 >::cmptType >::magType type
Definition: products.H:92
Foam::MinMax
A min/max value pair with additional methods. In addition to conveniently storing values,...
Definition: HashSet.H:76
Foam::outerProduct
Definition: products.H:106
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62
Foam::average
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:328
UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, binaryOp)
Definition: GeometricFieldFunctions.C:463
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