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 | Copyright (C) 2011-2016 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 
27 
28 #define TEMPLATE \
29  template<class Type, template<class> class PatchField, class GeoMesh>
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
38 
39 template<class Type, template<class> class PatchField, class GeoMesh>
40 void component
41 (
43  <
44  typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
45  PatchField,
46  GeoMesh
47  >& gcf,
49  const direction d
50 )
51 {
52  component(gcf.primitiveFieldRef(), gf.primitiveField(), d);
53  component(gcf.boundaryFieldRef(), gf.boundaryField(), d);
54 }
55 
56 
57 template<class Type, template<class> class PatchField, class GeoMesh>
58 void T
59 (
62 )
63 {
64  T(gf.primitiveFieldRef(), gf1.primitiveField());
65  T(gf.boundaryFieldRef(), gf1.boundaryField());
66 }
67 
68 
69 template
70 <
71  class Type,
72  template<class> class PatchField,
73  class GeoMesh,
74  direction r
75 >
76 void pow
77 (
78  GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
80 )
81 {
82  pow(gf.primitiveFieldRef(), gf1.primitiveField(), r);
83  pow(gf.boundaryFieldRef(), gf1.boundaryField(), r);
84 }
85 
86 template
87 <
88  class Type,
89  template<class> class PatchField,
90  class GeoMesh,
91  direction r
92 >
93 tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
94 pow
95 (
98 )
99 {
100  typedef typename powProduct<Type, r>::type powProductType;
101 
103  (
105  (
106  IOobject
107  (
108  "pow(" + gf.name() + ',' + name(r) + ')',
109  gf.instance(),
110  gf.db(),
113  ),
114  gf.mesh(),
115  pow(gf.dimensions(), r)
116  )
117  );
118 
119  pow<Type, r, PatchField, GeoMesh>(tPow.ref(), gf);
120 
121  return tPow;
122 }
123 
124 
125 template
126 <
127  class Type,
128  template<class> class PatchField,
129  class GeoMesh,
130  direction r
131 >
132 tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
133 pow
134 (
137 )
138 {
139  typedef typename powProduct<Type, r>::type powProductType;
140 
142 
144  (
146  (
147  IOobject
148  (
149  "pow(" + gf.name() + ',' + name(r) + ')',
150  gf.instance(),
151  gf.db(),
154  ),
155  gf.mesh(),
156  pow(gf.dimensions(), r)
157  )
158  );
159 
160  pow<Type, r, PatchField, GeoMesh>(tPow.ref(), gf);
161 
162  tgf.clear();
163 
164  return tPow;
165 }
166 
167 
168 template<class Type, template<class> class PatchField, class GeoMesh>
169 void sqr
170 (
172  <typename outerProduct<Type, Type>::type, PatchField, GeoMesh>& gf,
174 )
175 {
176  sqr(gf.primitiveFieldRef(), gf1.primitiveField());
177  sqr(gf.boundaryFieldRef(), gf1.boundaryField());
178 }
179 
180 template<class Type, template<class> class PatchField, class GeoMesh>
181 tmp
182 <
184  <
185  typename outerProduct<Type, Type>::type,
186  PatchField,
187  GeoMesh
188  >
189 >
191 {
192  typedef typename outerProduct<Type, Type>::type outerProductType;
193 
195  (
197  (
198  IOobject
199  (
200  "sqr(" + gf.name() + ')',
201  gf.instance(),
202  gf.db(),
205  ),
206  gf.mesh(),
207  sqr(gf.dimensions())
208  )
209  );
210 
211  sqr(tSqr.ref(), gf);
212 
213  return tSqr;
214 }
215 
216 template<class Type, template<class> class PatchField, class GeoMesh>
217 tmp
218 <
220  <
221  typename outerProduct<Type, Type>::type,
222  PatchField,
223  GeoMesh
224  >
225 >
227 {
228  typedef typename outerProduct<Type, Type>::type outerProductType;
229 
231 
233  (
235  (
236  IOobject
237  (
238  "sqr(" + gf.name() + ')',
239  gf.instance(),
240  gf.db(),
243  ),
244  gf.mesh(),
245  sqr(gf.dimensions())
246  )
247  );
248 
249  sqr(tSqr.ref(), gf);
250 
251  tgf.clear();
252 
253  return tSqr;
254 }
255 
256 
257 template<class Type, template<class> class PatchField, class GeoMesh>
258 void magSqr
259 (
262 )
263 {
266 }
267 
268 template<class Type, template<class> class PatchField, class GeoMesh>
270 (
272 )
273 {
275  (
277  (
278  IOobject
279  (
280  "magSqr(" + gf.name() + ')',
281  gf.instance(),
282  gf.db(),
285  ),
286  gf.mesh(),
287  sqr(gf.dimensions())
288  )
289  );
290 
291  magSqr(tMagSqr.ref(), gf);
292 
293  return tMagSqr;
294 }
295 
296 template<class Type, template<class> class PatchField, class GeoMesh>
298 (
300 )
301 {
303 
305  (
307  (
308  IOobject
309  (
310  "magSqr(" + gf.name() + ')',
311  gf.instance(),
312  gf.db(),
315  ),
316  gf.mesh(),
317  sqr(gf.dimensions())
318  )
319  );
320 
321  magSqr(tMagSqr.ref(), gf);
322 
323  tgf.clear();
324 
325  return tMagSqr;
326 }
327 
328 
329 template<class Type, template<class> class PatchField, class GeoMesh>
330 void mag
331 (
334 )
335 {
336  mag(gsf.primitiveFieldRef(), gf.primitiveField());
337  mag(gsf.boundaryFieldRef(), gf.boundaryField());
338 }
339 
340 template<class Type, template<class> class PatchField, class GeoMesh>
342 (
344 )
345 {
347  (
349  (
350  IOobject
351  (
352  "mag(" + gf.name() + ')',
353  gf.instance(),
354  gf.db(),
357  ),
358  gf.mesh(),
359  gf.dimensions()
360  )
361  );
362 
363  mag(tMag.ref(), gf);
364 
365  return tMag;
366 }
367 
368 template<class Type, template<class> class PatchField, class GeoMesh>
370 (
372 )
373 {
375 
377  (
379  (
380  IOobject
381  (
382  "mag(" + gf.name() + ')',
383  gf.instance(),
384  gf.db(),
387  ),
388  gf.mesh(),
389  gf.dimensions()
390  )
391  );
392 
393  mag(tMag.ref(), gf);
394 
395  tgf.clear();
396 
397  return tMag;
398 }
399 
400 
401 template<class Type, template<class> class PatchField, class GeoMesh>
402 void cmptAv
403 (
405  <
406  typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
407  PatchField,
408  GeoMesh
409  >& gcf,
411 )
412 {
413  cmptAv(gcf.primitiveFieldRef(), gf.primitiveField());
414  cmptAv(gcf.boundaryFieldRef(), gf.boundaryField());
415 }
416 
417 template<class Type, template<class> class PatchField, class GeoMesh>
418 tmp
419 <
421  <
422  typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
423  PatchField,
424  GeoMesh
425  >
426 >
428 {
429  typedef typename GeometricField<Type, PatchField, GeoMesh>::cmptType
430  cmptType;
431 
433  (
435  (
436  IOobject
437  (
438  "cmptAv(" + gf.name() + ')',
439  gf.instance(),
440  gf.db(),
443  ),
444  gf.mesh(),
445  gf.dimensions()
446  )
447  );
448 
449  cmptAv(CmptAv.ref(), gf);
450 
451  return CmptAv;
452 }
453 
454 template<class Type, template<class> class PatchField, class GeoMesh>
455 tmp
456 <
458  <
459  typename GeometricField<Type, PatchField, GeoMesh>::cmptType,
460  PatchField,
461  GeoMesh
462  >
463 >
465 {
466  typedef typename GeometricField<Type, PatchField, GeoMesh>::cmptType
467  cmptType;
468 
470 
472  (
474  (
475  IOobject
476  (
477  "cmptAv(" + gf.name() + ')',
478  gf.instance(),
479  gf.db(),
482  ),
483  gf.mesh(),
484  gf.dimensions()
485  )
486  );
487 
488  cmptAv(CmptAv.ref(), gf);
489 
490  tgf.clear();
491 
492  return CmptAv;
493 }
494 
495 
496 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc) \
497  \
498 template<class Type, template<class> class PatchField, class GeoMesh> \
499 dimensioned<returnType> func \
500 ( \
501  const GeometricField<Type, PatchField, GeoMesh>& gf \
502 ) \
503 { \
504  return dimensioned<Type> \
505  ( \
506  #func "(" + gf.name() + ')', \
507  gf.dimensions(), \
508  Foam::func(gFunc(gf.primitiveField()), gFunc(gf.boundaryField())) \
509  ); \
510 } \
511  \
512 template<class Type, template<class> class PatchField, class GeoMesh> \
513 dimensioned<returnType> func \
514 ( \
515  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
516 ) \
517 { \
518  dimensioned<returnType> res = func(tgf1()); \
519  tgf1.clear(); \
520  return res; \
521 }
522 
525 
526 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
527 
528 
529 #define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc) \
530  \
531 template<class Type, template<class> class PatchField, class GeoMesh> \
532 dimensioned<returnType> func \
533 ( \
534  const GeometricField<Type, PatchField, GeoMesh>& gf \
535 ) \
536 { \
537  return dimensioned<Type> \
538  ( \
539  #func "(" + gf.name() + ')', \
540  gf.dimensions(), \
541  gFunc(gf.primitiveField()) \
542  ); \
543 } \
544  \
545 template<class Type, template<class> class PatchField, class GeoMesh> \
546 dimensioned<returnType> func \
547 ( \
548  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
549 ) \
550 { \
551  dimensioned<returnType> res = func(tgf1()); \
552  tgf1.clear(); \
553  return res; \
554 }
555 
559 
560 #undef UNARY_REDUCTION_FUNCTION
561 
562 
563 BINARY_FUNCTION(Type, Type, Type, max)
564 BINARY_FUNCTION(Type, Type, Type, min)
565 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
566 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
567 
568 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
569 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
570 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
571 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
572 
573 
574 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
575 
576 UNARY_OPERATOR(Type, Type, -, negate, transform)
577 
578 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
579 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
580 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
581 
582 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
583 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
584 
585 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
586 
587 
588 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
589 
590 #define PRODUCT_OPERATOR(product, op, opFunc) \
591  \
592 template \
593 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
594 void opFunc \
595 ( \
596  GeometricField \
597  <typename product<Type1, Type2>::type, PatchField, GeoMesh>& gf, \
598  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
599  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
600 ) \
601 { \
602  Foam::opFunc \
603  ( \
604  gf.primitiveFieldRef(), \
605  gf1.primitiveField(), \
606  gf2.primitiveField() \
607  ); \
608  Foam::opFunc \
609  ( \
610  gf.boundaryFieldRef(), \
611  gf1.boundaryField(), \
612  gf2.boundaryField() \
613  ); \
614 } \
615  \
616 template \
617 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
618 tmp \
619 < \
620  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
621 > \
622 operator op \
623 ( \
624  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
625  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
626 ) \
627 { \
628  typedef typename product<Type1, Type2>::type productType; \
629  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes \
630  ( \
631  new GeometricField<productType, PatchField, GeoMesh> \
632  ( \
633  IOobject \
634  ( \
635  '(' + gf1.name() + #op + gf2.name() + ')', \
636  gf1.instance(), \
637  gf1.db(), \
638  IOobject::NO_READ, \
639  IOobject::NO_WRITE \
640  ), \
641  gf1.mesh(), \
642  gf1.dimensions() op gf2.dimensions() \
643  ) \
644  ); \
645  \
646  Foam::opFunc(tRes.ref(), gf1, gf2); \
647  \
648  return tRes; \
649 } \
650  \
651 template \
652 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
653 tmp \
654 < \
655  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
656 > \
657 operator op \
658 ( \
659  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
660  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
661 ) \
662 { \
663  typedef typename product<Type1, Type2>::type productType; \
664  \
665  const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
666  \
667  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \
668  reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh>::New \
669  ( \
670  tgf2, \
671  '(' + gf1.name() + #op + gf2.name() + ')', \
672  gf1.dimensions() op gf2.dimensions() \
673  ); \
674  \
675  Foam::opFunc(tRes.ref(), gf1, gf2); \
676  \
677  tgf2.clear(); \
678  \
679  return tRes; \
680 } \
681  \
682 template \
683 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
684 tmp \
685 < \
686  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
687 > \
688 operator op \
689 ( \
690  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
691  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
692 ) \
693 { \
694  typedef typename product<Type1, Type2>::type productType; \
695  \
696  const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
697  \
698  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \
699  reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh>::New \
700  ( \
701  tgf1, \
702  '(' + gf1.name() + #op + gf2.name() + ')', \
703  gf1.dimensions() op gf2.dimensions() \
704  ); \
705  \
706  Foam::opFunc(tRes.ref(), gf1, gf2); \
707  \
708  tgf1.clear(); \
709  \
710  return tRes; \
711 } \
712  \
713 template \
714 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
715 tmp \
716 < \
717  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
718 > \
719 operator op \
720 ( \
721  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
722  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
723 ) \
724 { \
725  typedef typename product<Type1, Type2>::type productType; \
726  \
727  const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
728  const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
729  \
730  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \
731  reuseTmpTmpGeometricField \
732  <productType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
733  ( \
734  tgf1, \
735  tgf2, \
736  '(' + gf1.name() + #op + gf2.name() + ')', \
737  gf1.dimensions() op gf2.dimensions() \
738  ); \
739  \
740  Foam::opFunc(tRes.ref(), gf1, gf2); \
741  \
742  tgf1.clear(); \
743  tgf2.clear(); \
744  \
745  return tRes; \
746 } \
747  \
748 template \
749 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
750 void opFunc \
751 ( \
752  GeometricField \
753  <typename product<Type, Form>::type, PatchField, GeoMesh>& gf, \
754  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
755  const dimensioned<Form>& dvs \
756 ) \
757 { \
758  Foam::opFunc(gf.primitiveFieldRef(), gf1.primitiveField(), dvs.value()); \
759  Foam::opFunc(gf.boundaryFieldRef(), gf1.boundaryField(), dvs.value()); \
760 } \
761  \
762 template \
763 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
764 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \
765 operator op \
766 ( \
767  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
768  const dimensioned<Form>& dvs \
769 ) \
770 { \
771  typedef typename product<Type, Form>::type productType; \
772  \
773  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes \
774  ( \
775  new GeometricField<productType, PatchField, GeoMesh> \
776  ( \
777  IOobject \
778  ( \
779  '(' + gf1.name() + #op + dvs.name() + ')', \
780  gf1.instance(), \
781  gf1.db(), \
782  IOobject::NO_READ, \
783  IOobject::NO_WRITE \
784  ), \
785  gf1.mesh(), \
786  gf1.dimensions() op dvs.dimensions() \
787  ) \
788  ); \
789  \
790  Foam::opFunc(tRes.ref(), gf1, dvs); \
791  \
792  return tRes; \
793 } \
794  \
795 template \
796 < \
797  class Form, \
798  class Cmpt, \
799  direction nCmpt, \
800  class Type, template<class> class PatchField, \
801  class GeoMesh \
802 > \
803 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
804 operator op \
805 ( \
806  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
807  const VectorSpace<Form,Cmpt,nCmpt>& vs \
808 ) \
809 { \
810  return gf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
811 } \
812  \
813  \
814 template \
815 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
816 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \
817 operator op \
818 ( \
819  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1, \
820  const dimensioned<Form>& dvs \
821 ) \
822 { \
823  typedef typename product<Type, Form>::type productType; \
824  \
825  const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
826  \
827  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \
828  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
829  ( \
830  tgf1, \
831  '(' + gf1.name() + #op + dvs.name() + ')', \
832  gf1.dimensions() op dvs.dimensions() \
833  ); \
834  \
835  Foam::opFunc(tRes.ref(), gf1, dvs); \
836  \
837  tgf1.clear(); \
838  \
839  return tRes; \
840 } \
841  \
842 template \
843 < \
844  class Form, \
845  class Cmpt, \
846  direction nCmpt, \
847  class Type, template<class> class PatchField, \
848  class GeoMesh \
849 > \
850 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
851 operator op \
852 ( \
853  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1, \
854  const VectorSpace<Form,Cmpt,nCmpt>& vs \
855 ) \
856 { \
857  return tgf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
858 } \
859  \
860  \
861 template \
862 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
863 void opFunc \
864 ( \
865  GeometricField \
866  <typename product<Form, Type>::type, PatchField, GeoMesh>& gf, \
867  const dimensioned<Form>& dvs, \
868  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
869 ) \
870 { \
871  Foam::opFunc(gf.primitiveFieldRef(), dvs.value(), gf1.primitiveField()); \
872  Foam::opFunc(gf.boundaryFieldRef(), dvs.value(), gf1.boundaryField()); \
873 } \
874  \
875 template \
876 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
877 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
878 operator op \
879 ( \
880  const dimensioned<Form>& dvs, \
881  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
882 ) \
883 { \
884  typedef typename product<Form, Type>::type productType; \
885  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes \
886  ( \
887  new GeometricField<productType, PatchField, GeoMesh> \
888  ( \
889  IOobject \
890  ( \
891  '(' + dvs.name() + #op + gf1.name() + ')', \
892  gf1.instance(), \
893  gf1.db(), \
894  IOobject::NO_READ, \
895  IOobject::NO_WRITE \
896  ), \
897  gf1.mesh(), \
898  dvs.dimensions() op gf1.dimensions() \
899  ) \
900  ); \
901  \
902  Foam::opFunc(tRes.ref(), dvs, gf1); \
903  \
904  return tRes; \
905 } \
906  \
907 template \
908 < \
909  class Form, \
910  class Cmpt, \
911  direction nCmpt, \
912  class Type, template<class> class PatchField, \
913  class GeoMesh \
914 > \
915 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
916 operator op \
917 ( \
918  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
919  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
920 ) \
921 { \
922  return dimensioned<Form>(static_cast<const Form&>(vs)) op gf1; \
923 } \
924  \
925 template \
926 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
927 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
928 operator op \
929 ( \
930  const dimensioned<Form>& dvs, \
931  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
932 ) \
933 { \
934  typedef typename product<Form, Type>::type productType; \
935  \
936  const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
937  \
938  tmp<GeometricField<productType, PatchField, GeoMesh>> tRes = \
939  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
940  ( \
941  tgf1, \
942  '(' + dvs.name() + #op + gf1.name() + ')', \
943  dvs.dimensions() op gf1.dimensions() \
944  ); \
945  \
946  Foam::opFunc(tRes.ref(), dvs, gf1); \
947  \
948  tgf1.clear(); \
949  \
950  return tRes; \
951 } \
952  \
953 template \
954 < \
955  class Form, \
956  class Cmpt, \
957  direction nCmpt, \
958  class Type, template<class> class PatchField, \
959  class GeoMesh \
960 > \
961 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
962 operator op \
963 ( \
964  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
965  const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf1 \
966 ) \
967 { \
968  return dimensioned<Form>(static_cast<const Form&>(vs)) op tgf1; \
969 }
970 
973 
978 
979 #undef PRODUCT_OPERATOR
980 
981 
982 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
983 
984 } // End namespace Foam
985 
986 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
987 
988 #include "undefFieldFunctionsM.H"
989 
990 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc)
scalar gSumMag(const FieldField< Field, Type > &f)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
uint8_t direction
Definition: direction.H:46
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:221
#define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Type gMin(const FieldField< Field, Type > &f)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Generic GeometricField class.
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
void clear() const
If object pointer points to valid object:
Definition: tmpI.H:230
#define PRODUCT_OPERATOR(product, op, opFunc)
Type gSum(const FieldField< Field, Type > &f)
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const dimensionSet & dimensions() const
Return dimensions.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type gMax(const FieldField< Field, Type > &f)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:136
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
Type gAverage(const FieldField< Field, Type > &f)
const Mesh & mesh() const
Return mesh.
dimensioned< scalar > mag(const dimensioned< Type > &)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
A class for managing temporary objects.
Definition: PtrList.H:54
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
const fileName & instance() const
Definition: IOobject.H:337
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
const word & name() const
Return name.
Definition: IOobject.H:260
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465