GeometricFieldFunctions.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 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 \
30  < \
31  class Type, \
32  class GeoMesh, \
33  template<class> class PrimitiveField \
34  >
35 #define TEMPLATE2 \
36  template \
37  < \
38  class Type, \
39  class GeoMesh, \
40  template<class> class PrimitiveField1, \
41  template<class> class PrimitiveField2 \
42  >
43 #define TEMPLATE3 \
44  template \
45  < \
46  class Type, \
47  class GeoMesh, \
48  template<class> class PrimitiveField1, \
49  template<class> class PrimitiveField2, \
50  template<class> class PrimitiveField3 \
51  >
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
60 
63 (
65  <
67  GeoMesh,
68  PrimitiveField1
69  >& gcf,
71  const direction d
72 )
73 {
74  component(gcf.primitiveFieldRef(), gf.primitiveField(), d);
75  component(gcf.boundaryFieldRef(), gf.boundaryField(), d);
76 }
77 
78 
80 void T
81 (
84 )
85 {
86  T(gf.primitiveFieldRef(), gf1.primitiveField());
87  T(gf.boundaryFieldRef(), gf1.boundaryField());
88 }
89 
90 
91 template
92 <
93  class Type,
94  class GeoMesh,
95  template<class> class PrimitiveField1,
96  template<class> class PrimitiveField2,
97  direction r
98 >
99 void pow
100 (
102  <
103  typename powProduct<Type, r>::type,
104  GeoMesh,
105  PrimitiveField1
106  >& gf,
108 )
109 {
110  pow(gf.primitiveFieldRef(), gf1.primitiveField(), r);
111  pow(gf.boundaryFieldRef(), gf1.boundaryField(), r);
112 }
113 
114 
115 template
116 <
117  class Type,
118  class GeoMesh,
119  template<class> class PrimitiveField,
120  direction r
121 >
122 tmp<GeometricField<typename powProduct<Type, r>::type, GeoMesh, Field>>
124 (
127 )
128 {
129  typedef typename powProduct<Type, r>::type powProductType;
130 
132  (
134  (
135  "pow(" + gf.name() + ',' + name(r) + ')',
136  gf.mesh(),
137  pow(gf.dimensions(), r)
138  )
139  );
140 
141  pow<Type, GeoMesh, Field, PrimitiveField, r>(tPow.ref(), gf);
142 
143  return tPow;
144 }
145 
146 
147 template
148 <
149  class Type,
150  class GeoMesh,
151  template<class> class PrimitiveField,
152  direction r
153 >
154 tmp<GeometricField<typename powProduct<Type, r>::type, GeoMesh, Field>>
156 (
159 )
160 {
161  typedef typename powProduct<Type, r>::type powProductType;
162 
164 
166  (
168  (
169  "pow(" + gf.name() + ',' + name(r) + ')',
170  gf.mesh(),
171  pow(gf.dimensions(), r)
172  )
173  );
174 
175  pow<Type, GeoMesh, Field, PrimitiveField, r>
176  (
177  tPow.ref(),
178  gf
179  );
180 
181  tgf.clear();
182 
183  return tPow;
184 }
185 
186 
187 TEMPLATE2
188 void sqr
189 (
191  <
193  GeoMesh,
194  PrimitiveField1
195  >& gf,
197 )
198 {
199  sqr(gf.primitiveFieldRef(), gf1.primitiveField());
200  sqr(gf.boundaryFieldRef(), gf1.boundaryField());
201 }
202 
203 
204 TEMPLATE
205 tmp<GeometricField<typename outerProduct<Type, Type>::type, GeoMesh, Field>>
207 {
208  typedef typename outerProduct<Type, Type>::type outerProductType;
209 
211  (
213  (
214  "sqr(" + gf.name() + ')',
215  gf.mesh(),
216  sqr(gf.dimensions())
217  )
218  );
219 
220  sqr(tSqr.ref(), gf);
221 
222  return tSqr;
223 }
224 
225 
226 TEMPLATE
227 tmp<GeometricField<typename outerProduct<Type, Type>::type, GeoMesh, Field>>
229 {
230  typedef typename outerProduct<Type, Type>::type outerProductType;
231 
233 
235  (
237  (
238  "sqr(" + gf.name() + ')',
239  gf.mesh(),
240  sqr(gf.dimensions())
241  )
242  );
243 
244  sqr(tSqr.ref(), gf);
245 
246  tgf.clear();
247 
248  return tSqr;
249 }
250 
251 
252 TEMPLATE2
253 void magSqr
254 (
257 )
258 {
261 }
262 
263 
264 TEMPLATE
266 (
268 )
269 {
271  (
273  (
274  "magSqr(" + gf.name() + ')',
275  gf.mesh(),
276  sqr(gf.dimensions())
277  )
278  );
279 
280  magSqr(tMagSqr.ref(), gf);
281 
282  return tMagSqr;
283 }
284 
285 
286 TEMPLATE
288 (
290 )
291 {
293 
295  (
297  (
298  "magSqr(" + gf.name() + ')',
299  gf.mesh(),
300  sqr(gf.dimensions())
301  )
302  );
303 
304  magSqr(tMagSqr.ref(), gf);
305 
306  tgf.clear();
307 
308  return tMagSqr;
309 }
310 
311 
312 TEMPLATE2
313 void mag
314 (
317 )
318 {
319  mag(gsf.primitiveFieldRef(), gf.primitiveField());
320  mag(gsf.boundaryFieldRef(), gf.boundaryField());
321 }
322 
323 
324 TEMPLATE
326 (
328 )
329 {
331  (
333  (
334  "mag(" + gf.name() + ')',
335  gf.mesh(),
336  gf.dimensions()
337  )
338  );
339 
340  mag(tMag.ref(), gf);
341 
342  return tMag;
343 }
344 
345 
346 TEMPLATE
348 (
350 )
351 {
353 
355  (
357  (
358  "mag(" + gf.name() + ')',
359  gf.mesh(),
360  gf.dimensions()
361  )
362  );
363 
364  mag(tMag.ref(), gf);
365 
366  tgf.clear();
367 
368  return tMag;
369 }
370 
371 
372 TEMPLATE2
373 void cmptAv
374 (
376  <
378  GeoMesh,
379  PrimitiveField1
380  >& gcf,
382 )
383 {
384  cmptAv(gcf.primitiveFieldRef(), gf.primitiveField());
385  cmptAv(gcf.boundaryFieldRef(), gf.boundaryField());
386 }
387 
388 
389 TEMPLATE
390 tmp
391 <
392  GeometricField
393  <
395  GeoMesh,
396  Field
397  >
398 >
400 {
401  typedef typename
403 
405  (
407  (
408  "cmptAv(" + gf.name() + ')',
409  gf.mesh(),
410  gf.dimensions()
411  )
412  );
413 
414  cmptAv(CmptAv.ref(), gf);
415 
416  return CmptAv;
417 }
418 
419 
420 TEMPLATE
421 tmp
422 <
423  GeometricField
424  <
426  GeoMesh,
427  Field
428  >
429 >
431 {
432  typedef typename
434 
436 
438  (
440  (
441  "cmptAv(" + gf.name() + ')',
442  gf.mesh(),
443  gf.dimensions()
444  )
445  );
446 
447  cmptAv(CmptAv.ref(), gf);
448 
449  tgf.clear();
450 
451  return CmptAv;
452 }
453 
455 
456 
457 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc) \
458  \
459 TEMPLATE \
460 dimensioned<returnType> func \
461 ( \
462  const GeometricField<Type, GeoMesh, PrimitiveField>& gf \
463 ) \
464 { \
465  return dimensioned<Type> \
466  ( \
467  #func "(" + gf.name() + ')', \
468  gf.dimensions(), \
469  Foam::func(gFunc(gf.primitiveField()), gFunc(gf.boundaryField())) \
470  ); \
471 } \
472  \
473 TEMPLATE \
474 dimensioned<returnType> func \
475 ( \
476  const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf1 \
477 ) \
478 { \
479  dimensioned<returnType> res = func(tgf1()); \
480  tgf1.clear(); \
481  return res; \
482 }
483 
486 
487 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
488 
489 
490 #define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc) \
491  \
492 TEMPLATE \
493 dimensioned<returnType> func \
494 ( \
495  const GeometricField<Type, GeoMesh, PrimitiveField>& gf \
496 ) \
497 { \
498  return dimensioned<Type> \
499  ( \
500  #func "(" + gf.name() + ')', \
501  gf.dimensions(), \
502  gFunc(gf.primitiveField()) \
503  ); \
504 } \
505  \
506 TEMPLATE \
507 dimensioned<returnType> func \
508 ( \
509  const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf1 \
510 ) \
511 { \
512  dimensioned<returnType> res = func(tgf1()); \
513  tgf1.clear(); \
514  return res; \
515 }
516 
520 
521 #undef UNARY_REDUCTION_FUNCTION
522 
523 
524 BINARY_FUNCTION(Type, Type, Type, max)
525 BINARY_FUNCTION(Type, Type, Type, min)
526 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
527 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
528 
529 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
530 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
533 
534 
535 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
536 
538 
539 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
540 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
541 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
542 
543 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
544 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
545 
546 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
547 
548 
549 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
550 
551 #define PRODUCT_OPERATOR(product, op, opFunc) \
552  \
553 template \
554 < \
555  class Type1, \
556  class Type2, \
557  class GeoMesh, \
558  template<class> class PrimitiveField1, \
559  template<class> class PrimitiveField2, \
560  template<class> class PrimitiveField3 \
561 > \
562 void opFunc \
563 ( \
564  GeometricField \
565  < \
566  typename product<Type1, Type2>::type, \
567  GeoMesh, \
568  PrimitiveField1 \
569  >& gf, \
570  const GeometricField<Type1, GeoMesh, PrimitiveField2>& gf1, \
571  const GeometricField<Type2, GeoMesh, PrimitiveField3>& gf2 \
572 ) \
573 { \
574  Foam::opFunc \
575  ( \
576  gf.primitiveFieldRef(), \
577  gf1.primitiveField(), \
578  gf2.primitiveField() \
579  ); \
580  Foam::opFunc \
581  ( \
582  gf.boundaryFieldRef(), \
583  gf1.boundaryField(), \
584  gf2.boundaryField() \
585  ); \
586 } \
587  \
588 template \
589 < \
590  class Type1, \
591  class Type2, \
592  class GeoMesh, \
593  template<class> class PrimitiveField1, \
594  template<class> class PrimitiveField2 \
595 > \
596 tmp<GeometricField<typename product<Type1, Type2>::type, GeoMesh, Field>> \
597 operator op \
598 ( \
599  const GeometricField<Type1, GeoMesh, PrimitiveField1>& gf1, \
600  const GeometricField<Type2, GeoMesh, PrimitiveField2>& gf2 \
601 ) \
602 { \
603  typedef typename product<Type1, Type2>::type productType; \
604  \
605  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
606  ( \
607  GeometricField<productType, GeoMesh, Field>::New \
608  ( \
609  '(' + gf1.name() + #op + gf2.name() + ')', \
610  gf1.mesh(), \
611  gf1.dimensions() op gf2.dimensions() \
612  ) \
613  ); \
614  \
615  Foam::opFunc(tRes.ref(), gf1, gf2); \
616  \
617  return tRes; \
618 } \
619  \
620 template \
621 < \
622  class Type1, \
623  class Type2, \
624  class GeoMesh, \
625  template<class> class PrimitiveField1, \
626  template<class> class PrimitiveField2 \
627 > \
628 tmp<GeometricField<typename product<Type1, Type2>::type, GeoMesh, Field>> \
629 operator op \
630 ( \
631  const GeometricField<Type1, GeoMesh, PrimitiveField1>& gf1, \
632  const tmp<GeometricField<Type2, GeoMesh, PrimitiveField2>>& tgf2 \
633 ) \
634 { \
635  typedef typename product<Type1, Type2>::type productType; \
636  \
637  const GeometricField<Type2, GeoMesh, PrimitiveField2>& gf2 = tgf2(); \
638  \
639  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
640  ( \
641  reuseTmpGeometricField \
642  <productType, Type2, GeoMesh, PrimitiveField2>::New \
643  ( \
644  tgf2, \
645  '(' + gf1.name() + #op + gf2.name() + ')', \
646  gf1.dimensions() op gf2.dimensions() \
647  ) \
648  ); \
649  \
650  Foam::opFunc(tRes.ref(), gf1, gf2); \
651  \
652  tgf2.clear(); \
653  \
654  return tRes; \
655 } \
656  \
657 template \
658 < \
659  class Type1, \
660  class Type2, \
661  class GeoMesh, \
662  template<class> class PrimitiveField1, \
663  template<class> class PrimitiveField2 \
664 > \
665 tmp<GeometricField<typename product<Type1, Type2>::type, GeoMesh, Field>> \
666 operator op \
667 ( \
668  const tmp<GeometricField<Type1, GeoMesh, PrimitiveField1>>& tgf1, \
669  const GeometricField<Type2, GeoMesh, PrimitiveField2>& gf2 \
670 ) \
671 { \
672  typedef typename product<Type1, Type2>::type productType; \
673  \
674  const GeometricField<Type1, GeoMesh, PrimitiveField1>& gf1 = tgf1(); \
675  \
676  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
677  ( \
678  reuseTmpGeometricField \
679  <productType, Type1, GeoMesh, PrimitiveField1>::New \
680  ( \
681  tgf1, \
682  '(' + gf1.name() + #op + gf2.name() + ')', \
683  gf1.dimensions() op gf2.dimensions() \
684  ) \
685  ); \
686  \
687  Foam::opFunc(tRes.ref(), gf1, gf2); \
688  \
689  tgf1.clear(); \
690  \
691  return tRes; \
692 } \
693  \
694 template \
695 < \
696  class Type1, \
697  class Type2, \
698  class GeoMesh, \
699  template<class> class PrimitiveField1, \
700  template<class> class PrimitiveField2 \
701 > \
702 tmp<GeometricField<typename product<Type1, Type2>::type, GeoMesh, Field>> \
703 operator op \
704 ( \
705  const tmp<GeometricField<Type1, GeoMesh, PrimitiveField1>>& tgf1, \
706  const tmp<GeometricField<Type2, GeoMesh, PrimitiveField2>>& tgf2 \
707 ) \
708 { \
709  typedef typename product<Type1, Type2>::type productType; \
710  \
711  const GeometricField<Type1, GeoMesh, PrimitiveField1>& gf1 = tgf1(); \
712  const GeometricField<Type2, GeoMesh, PrimitiveField2>& gf2 = tgf2(); \
713  \
714  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
715  ( \
716  reuseTmpTmpGeometricField \
717  < \
718  productType, \
719  Type1, \
720  Type2, \
721  GeoMesh, \
722  PrimitiveField1, \
723  PrimitiveField2 \
724  >::New \
725  ( \
726  tgf1, \
727  tgf2, \
728  '(' + gf1.name() + #op + gf2.name() + ')', \
729  gf1.dimensions() op gf2.dimensions() \
730  ) \
731  ); \
732  \
733  Foam::opFunc(tRes.ref(), gf1, gf2); \
734  \
735  tgf1.clear(); \
736  tgf2.clear(); \
737  \
738  return tRes; \
739 } \
740  \
741  \
742 template \
743 < \
744  class Form, \
745  class Type, \
746  class GeoMesh, \
747  template<class> class PrimitiveField1, \
748  template<class> class PrimitiveField2 \
749 > \
750 void opFunc \
751 ( \
752  GeometricField \
753  < \
754  typename product<Type, Form>::type, \
755  GeoMesh, \
756  PrimitiveField1 \
757  >& gf, \
758  const GeometricField<Type, GeoMesh, PrimitiveField2>& gf1, \
759  const dimensioned<Form>& dvs \
760 ) \
761 { \
762  Foam::opFunc(gf.primitiveFieldRef(), gf1.primitiveField(), dvs.value()); \
763  Foam::opFunc(gf.boundaryFieldRef(), gf1.boundaryField(), dvs.value()); \
764 } \
765  \
766 template \
767 < \
768  class Form, \
769  class Type, \
770  class GeoMesh, \
771  template<class> class PrimitiveField \
772 > \
773 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
774 operator op \
775 ( \
776  const GeometricField<Type, GeoMesh, PrimitiveField>& gf1, \
777  const dimensioned<Form>& dvs \
778 ) \
779 { \
780  typedef typename product<Type, Form>::type productType; \
781  \
782  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
783  ( \
784  GeometricField<productType, GeoMesh, Field>::New \
785  ( \
786  '(' + gf1.name() + #op + dvs.name() + ')', \
787  gf1.mesh(), \
788  gf1.dimensions() op dvs.dimensions() \
789  ) \
790  ); \
791  \
792  Foam::opFunc(tRes.ref(), gf1, dvs); \
793  \
794  return tRes; \
795 } \
796  \
797 template \
798 < \
799  class Form, \
800  class Cmpt, \
801  direction nCmpt, \
802  class Type, \
803  class GeoMesh, \
804  template<class> class PrimitiveField \
805 > \
806 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
807 operator op \
808 ( \
809  const GeometricField<Type, GeoMesh, PrimitiveField>& gf1, \
810  const VectorSpace<Form, Cmpt, nCmpt>& vs \
811 ) \
812 { \
813  return gf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
814 } \
815  \
816 template \
817 < \
818  class Form, \
819  class Type, \
820  class GeoMesh, \
821  template<class> class PrimitiveField \
822 > \
823 tmp<GeometricField<typename product<Type, Form>::type, GeoMesh, Field>> \
824 operator op \
825 ( \
826  const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf1, \
827  const dimensioned<Form>& dvs \
828 ) \
829 { \
830  typedef typename product<Type, Form>::type productType; \
831  \
832  const GeometricField<Type, GeoMesh, PrimitiveField>& gf1 = tgf1(); \
833  \
834  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
835  ( \
836  reuseTmpGeometricField \
837  <productType, Type, GeoMesh, PrimitiveField>::New \
838  ( \
839  tgf1, \
840  '(' + gf1.name() + #op + dvs.name() + ')', \
841  gf1.dimensions() op dvs.dimensions() \
842  ) \
843  ); \
844  \
845  Foam::opFunc(tRes.ref(), gf1, dvs); \
846  \
847  tgf1.clear(); \
848  \
849  return tRes; \
850 } \
851  \
852 template \
853 < \
854  class Form, \
855  class Cmpt, \
856  direction nCmpt, \
857  class Type, \
858  class GeoMesh, \
859  template<class> class PrimitiveField \
860 > \
861 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
862 operator op \
863 ( \
864  const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf1, \
865  const VectorSpace<Form, Cmpt, nCmpt>& vs \
866 ) \
867 { \
868  return tgf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
869 } \
870  \
871  \
872 template \
873 < \
874  class Form, \
875  class Type, \
876  class GeoMesh, \
877  template<class> class PrimitiveField1, \
878  template<class> class PrimitiveField2 \
879 > \
880 void opFunc \
881 ( \
882  GeometricField \
883  < \
884  typename product<Form, Type>::type, \
885  GeoMesh, \
886  PrimitiveField1 \
887  >& gf, \
888  const dimensioned<Form>& dvs, \
889  const GeometricField<Type, GeoMesh, PrimitiveField2>& gf1 \
890 ) \
891 { \
892  Foam::opFunc(gf.primitiveFieldRef(), dvs.value(), gf1.primitiveField()); \
893  Foam::opFunc(gf.boundaryFieldRef(), dvs.value(), gf1.boundaryField()); \
894 } \
895  \
896 template \
897 < \
898  class Form, \
899  class Type, \
900  class GeoMesh, \
901  template<class> class PrimitiveField \
902 > \
903 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
904 operator op \
905 ( \
906  const dimensioned<Form>& dvs, \
907  const GeometricField<Type, GeoMesh, PrimitiveField>& gf1 \
908 ) \
909 { \
910  typedef typename product<Form, Type>::type productType; \
911  \
912  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
913  ( \
914  GeometricField<productType, GeoMesh, Field>::New \
915  ( \
916  '(' + dvs.name() + #op + gf1.name() + ')', \
917  gf1.mesh(), \
918  dvs.dimensions() op gf1.dimensions() \
919  ) \
920  ); \
921  \
922  Foam::opFunc(tRes.ref(), dvs, gf1); \
923  \
924  return tRes; \
925 } \
926  \
927 template \
928 < \
929  class Form, \
930  class Cmpt, \
931  direction nCmpt, \
932  class Type, \
933  class GeoMesh, \
934  template<class> class PrimitiveField \
935 > \
936 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
937 operator op \
938 ( \
939  const VectorSpace<Form, Cmpt, nCmpt>& vs, \
940  const GeometricField<Type, GeoMesh, PrimitiveField>& gf1 \
941 ) \
942 { \
943  return dimensioned<Form>(static_cast<const Form&>(vs)) op gf1; \
944 } \
945  \
946 template \
947 < \
948  class Form, \
949  class Type, \
950  class GeoMesh, \
951  template<class> class PrimitiveField \
952 > \
953 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
954 operator op \
955 ( \
956  const dimensioned<Form>& dvs, \
957  const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf1 \
958 ) \
959 { \
960  typedef typename product<Form, Type>::type productType; \
961  \
962  const GeometricField<Type, GeoMesh, PrimitiveField>& gf1 = tgf1(); \
963  \
964  tmp<GeometricField<productType, GeoMesh, Field>> tRes \
965  ( \
966  reuseTmpGeometricField \
967  <productType, Type, GeoMesh, PrimitiveField>::New \
968  ( \
969  tgf1, \
970  '(' + dvs.name() + #op + gf1.name() + ')', \
971  dvs.dimensions() op gf1.dimensions() \
972  ) \
973  ); \
974  \
975  Foam::opFunc(tRes.ref(), dvs, gf1); \
976  \
977  tgf1.clear(); \
978  \
979  return tRes; \
980 } \
981  \
982 template \
983 < \
984  class Form, \
985  class Cmpt, \
986  direction nCmpt, \
987  class Type, \
988  class GeoMesh, \
989  template<class> class PrimitiveField \
990 > \
991 tmp<GeometricField<typename product<Form, Type>::type, GeoMesh, Field>> \
992 operator op \
993 ( \
994  const VectorSpace<Form, Cmpt, nCmpt>& vs, \
995  const tmp<GeometricField<Type, GeoMesh, PrimitiveField>>& tgf1 \
996 ) \
997 { \
998  return dimensioned<Form>(static_cast<const Form&>(vs)) op tgf1; \
999 }
1000 
1003 
1008 
1009 #undef PRODUCT_OPERATOR
1010 
1011 
1012 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1013 
1014 } // End namespace Foam
1015 
1016 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1017 
1018 #include "undefFieldFunctionsM.H"
1019 
1020 // ************************************************************************* //
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
#define TEMPLATE2
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc)
#define TEMPLATE
#define PRODUCT_OPERATOR(product, op, opFunc)
#define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc)
#define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc)
#define BINARY_FUNCTION(func)
#define BINARY_OPERATOR(Template, Type, Type1, Type2, op, opFunc)
#define UNARY_OPERATOR(op, opFunc)
#define UNARY_FUNCTION(Template, Type, Type1, func)
#define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc)
const dimensionSet & dimensions() const
Return dimensions.
const Mesh & mesh() const
Return mesh.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:47
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
Field< Type >::cmptType cmptType
Component type of the elements of the field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
const word & name() const
Return name.
Definition: IOobject.H:307
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:90
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:136
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
Namespace for OpenFOAM.
void subtract(LagrangianPatchField< typename typeOfSum< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void dot(LagrangianPatchField< typename innerProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void negate(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
void cmptMultiply(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< Type > &f2)
Type gSum(const FieldField< Field, Type > &f)
void outer(LagrangianPatchField< typename outerProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void divide(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< scalar > &f2)
void dotdot(LagrangianPatchField< typename scalarProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
scalar gSumMag(const FieldField< Field, Type > &f)
void cmptDivide(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< Type > &f2)
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void cross(LagrangianPatchField< typename crossProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void component(LagrangianPatchField< typename LagrangianPatchField< Type >::cmptType > &sf, const LagrangianPatchField< Type > &f, const direction d)
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
void multiply(LagrangianPatchField< Type > &f, const LagrangianPatchField< scalar > &f1, const LagrangianPatchField< Type > &f2)
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:501
void cmptAv(LagrangianPatchField< typename LagrangianPatchField< Type >::cmptType > &f, const LagrangianPatchField< Type > &f1)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
Type gAverage(const FieldField< Field, Type > &f)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Type gMin(const FieldField< Field, Type > &f)
void add(LagrangianPatchField< typename typeOfSum< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
Type gMax(const FieldField< Field, Type > &f)
void cmptMag(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
uint8_t direction
Definition: direction.H:45