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-2015 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  <
45  PatchField,
46  GeoMesh
47  >& gcf,
49  const direction d
50 )
51 {
52  component(gcf.internalField(), gf.internalField(), d);
53  component(gcf.boundaryField(), 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.internalField(), gf1.internalField());
65  T(gf.boundaryField(), gf1.boundaryField());
66 }
67 
68 
69 template<class Type, template<class> class PatchField, class GeoMesh, int r>
70 void pow
71 (
72  GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>& gf,
74 )
75 {
76  pow(gf.internalField(), gf1.internalField(), r);
77  pow(gf.boundaryField(), gf1.boundaryField(), r);
78 }
79 
80 template<class Type, template<class> class PatchField, class GeoMesh, int r>
82 pow
83 (
86 )
87 {
88  typedef typename powProduct<Type, r>::type powProductType;
89 
91  (
93  (
94  IOobject
95  (
96  "pow(" + gf.name() + ',' + name(r) + ')',
97  gf.instance(),
98  gf.db(),
101  ),
102  gf.mesh(),
103  pow(gf.dimensions(), r)
104  )
105  );
106 
107  pow<Type, r, PatchField, GeoMesh>(tPow(), gf);
108 
109  return tPow;
110 }
111 
112 
113 template<class Type, template<class> class PatchField, class GeoMesh, int r>
115 pow
116 (
119 )
120 {
121  typedef typename powProduct<Type, r>::type powProductType;
122 
124 
126  (
128  (
129  IOobject
130  (
131  "pow(" + gf.name() + ',' + name(r) + ')',
132  gf.instance(),
133  gf.db(),
136  ),
137  gf.mesh(),
138  pow(gf.dimensions(), r)
139  )
140  );
141 
142  pow<Type, r, PatchField, GeoMesh>(tPow(), gf);
143 
144  tgf.clear();
145 
146  return tPow;
147 }
148 
149 
150 template<class Type, template<class> class PatchField, class GeoMesh>
151 void sqr
152 (
154  <typename outerProduct<Type, Type>::type, PatchField, GeoMesh>& gf,
156 )
157 {
158  sqr(gf.internalField(), gf1.internalField());
159  sqr(gf.boundaryField(), gf1.boundaryField());
160 }
161 
162 template<class Type, template<class> class PatchField, class GeoMesh>
163 tmp
164 <
165  GeometricField
166  <
168  PatchField,
169  GeoMesh
170  >
171 >
173 {
174  typedef typename outerProduct<Type, Type>::type outerProductType;
175 
177  (
179  (
180  IOobject
181  (
182  "sqr(" + gf.name() + ')',
183  gf.instance(),
184  gf.db(),
187  ),
188  gf.mesh(),
189  sqr(gf.dimensions())
190  )
191  );
192 
193  sqr(tSqr(), gf);
194 
195  return tSqr;
196 }
197 
198 template<class Type, template<class> class PatchField, class GeoMesh>
199 tmp
200 <
201  GeometricField
202  <
204  PatchField,
205  GeoMesh
206  >
207 >
209 {
210  typedef typename outerProduct<Type, Type>::type outerProductType;
211 
213 
215  (
217  (
218  IOobject
219  (
220  "sqr(" + gf.name() + ')',
221  gf.instance(),
222  gf.db(),
225  ),
226  gf.mesh(),
227  sqr(gf.dimensions())
228  )
229  );
230 
231  sqr(tSqr(), gf);
232 
233  tgf.clear();
234 
235  return tSqr;
236 }
237 
238 
239 template<class Type, template<class> class PatchField, class GeoMesh>
240 void magSqr
241 (
244 )
245 {
246  magSqr(gsf.internalField(), gf.internalField());
247  magSqr(gsf.boundaryField(), gf.boundaryField());
248 }
249 
250 template<class Type, template<class> class PatchField, class GeoMesh>
251 tmp<GeometricField<scalar, PatchField, GeoMesh> > magSqr
252 (
254 )
255 {
257  (
259  (
260  IOobject
261  (
262  "magSqr(" + gf.name() + ')',
263  gf.instance(),
264  gf.db(),
267  ),
268  gf.mesh(),
269  sqr(gf.dimensions())
270  )
271  );
272 
273  magSqr(tMagSqr(), gf);
274 
275  return tMagSqr;
276 }
277 
278 template<class Type, template<class> class PatchField, class GeoMesh>
279 tmp<GeometricField<scalar, PatchField, GeoMesh> > magSqr
280 (
282 )
283 {
285 
287  (
289  (
290  IOobject
291  (
292  "magSqr(" + gf.name() + ')',
293  gf.instance(),
294  gf.db(),
297  ),
298  gf.mesh(),
299  sqr(gf.dimensions())
300  )
301  );
302 
303  magSqr(tMagSqr(), gf);
304 
305  tgf.clear();
306 
307  return tMagSqr;
308 }
309 
310 
311 template<class Type, template<class> class PatchField, class GeoMesh>
312 void mag
313 (
316 )
317 {
318  mag(gsf.internalField(), gf.internalField());
319  mag(gsf.boundaryField(), gf.boundaryField());
320 }
321 
322 template<class Type, template<class> class PatchField, class GeoMesh>
323 tmp<GeometricField<scalar, PatchField, GeoMesh> > mag
324 (
326 )
327 {
329  (
331  (
332  IOobject
333  (
334  "mag(" + gf.name() + ')',
335  gf.instance(),
336  gf.db(),
339  ),
340  gf.mesh(),
341  gf.dimensions()
342  )
343  );
344 
345  mag(tMag(), gf);
346 
347  return tMag;
348 }
349 
350 template<class Type, template<class> class PatchField, class GeoMesh>
351 tmp<GeometricField<scalar, PatchField, GeoMesh> > mag
352 (
354 )
355 {
357 
359  (
361  (
362  IOobject
363  (
364  "mag(" + gf.name() + ')',
365  gf.instance(),
366  gf.db(),
369  ),
370  gf.mesh(),
371  gf.dimensions()
372  )
373  );
374 
375  mag(tMag(), gf);
376 
377  tgf.clear();
378 
379  return tMag;
380 }
381 
382 
383 template<class Type, template<class> class PatchField, class GeoMesh>
384 void cmptAv
385 (
387  <
389  PatchField,
390  GeoMesh
391  >& gcf,
393 )
394 {
395  cmptAv(gcf.internalField(), gf.internalField());
396  cmptAv(gcf.boundaryField(), gf.boundaryField());
397 }
398 
399 template<class Type, template<class> class PatchField, class GeoMesh>
400 tmp
401 <
402  GeometricField
403  <
405  PatchField,
406  GeoMesh
407  >
408 >
410 {
412  cmptType;
413 
415  (
417  (
418  IOobject
419  (
420  "cmptAv(" + gf.name() + ')',
421  gf.instance(),
422  gf.db(),
425  ),
426  gf.mesh(),
427  gf.dimensions()
428  )
429  );
430 
431  cmptAv(CmptAv(), gf);
432 
433  return CmptAv;
434 }
435 
436 template<class Type, template<class> class PatchField, class GeoMesh>
437 tmp
438 <
439  GeometricField
440  <
442  PatchField,
443  GeoMesh
444  >
445 >
447 {
449  cmptType;
450 
452 
454  (
456  (
457  IOobject
458  (
459  "cmptAv(" + gf.name() + ')',
460  gf.instance(),
461  gf.db(),
464  ),
465  gf.mesh(),
466  gf.dimensions()
467  )
468  );
469 
470  cmptAv(CmptAv(), gf);
471 
472  tgf.clear();
473 
474  return CmptAv;
475 }
476 
477 
478 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc) \
479  \
480 template<class Type, template<class> class PatchField, class GeoMesh> \
481 dimensioned<returnType> func \
482 ( \
483  const GeometricField<Type, PatchField, GeoMesh>& gf \
484 ) \
485 { \
486  return dimensioned<Type> \
487  ( \
488  #func "(" + gf.name() + ')', \
489  gf.dimensions(), \
490  Foam::func(gFunc(gf.internalField()), gFunc(gf.boundaryField())) \
491  ); \
492 } \
493  \
494 template<class Type, template<class> class PatchField, class GeoMesh> \
495 dimensioned<returnType> func \
496 ( \
497  const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
498 ) \
499 { \
500  dimensioned<returnType> res = func(tgf1()); \
501  tgf1.clear(); \
502  return res; \
503 }
504 
507 
508 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
509 
510 
511 #define UNARY_REDUCTION_FUNCTION(returnType, func, gFunc) \
512  \
513 template<class Type, template<class> class PatchField, class GeoMesh> \
514 dimensioned<returnType> func \
515 ( \
516  const GeometricField<Type, PatchField, GeoMesh>& gf \
517 ) \
518 { \
519  return dimensioned<Type> \
520  ( \
521  #func "(" + gf.name() + ')', \
522  gf.dimensions(), \
523  gFunc(gf.internalField()) \
524  ); \
525 } \
526  \
527 template<class Type, template<class> class PatchField, class GeoMesh> \
528 dimensioned<returnType> func \
529 ( \
530  const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
531 ) \
532 { \
533  dimensioned<returnType> res = func(tgf1()); \
534  tgf1.clear(); \
535  return res; \
536 }
537 
541 
542 #undef UNARY_REDUCTION_FUNCTION
543 
544 
545 BINARY_FUNCTION(Type, Type, Type, max)
546 BINARY_FUNCTION(Type, Type, Type, min)
547 BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
548 BINARY_FUNCTION(Type, Type, Type, cmptDivide)
549 
550 BINARY_TYPE_FUNCTION(Type, Type, Type, max)
551 BINARY_TYPE_FUNCTION(Type, Type, Type, min)
552 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
553 BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
554 
555 
556 // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
557 
558 UNARY_OPERATOR(Type, Type, -, negate, transform)
559 
560 BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
561 BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
562 BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
563 
564 BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
565 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
566 
567 BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
568 
569 
570 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
571 
572 #define PRODUCT_OPERATOR(product, op, opFunc) \
573  \
574 template \
575 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
576 void opFunc \
577 ( \
578  GeometricField \
579  <typename product<Type1, Type2>::type, PatchField, GeoMesh>& gf, \
580  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
581  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
582 ) \
583 { \
584  Foam::opFunc(gf.internalField(), gf1.internalField(), gf2.internalField());\
585  Foam::opFunc(gf.boundaryField(), gf1.boundaryField(), gf2.boundaryField());\
586 } \
587  \
588 template \
589 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
590 tmp \
591 < \
592  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
593 > \
594 operator op \
595 ( \
596  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
597  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
598 ) \
599 { \
600  typedef typename product<Type1, Type2>::type productType; \
601  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes \
602  ( \
603  new GeometricField<productType, PatchField, GeoMesh> \
604  ( \
605  IOobject \
606  ( \
607  '(' + gf1.name() + #op + gf2.name() + ')', \
608  gf1.instance(), \
609  gf1.db(), \
610  IOobject::NO_READ, \
611  IOobject::NO_WRITE \
612  ), \
613  gf1.mesh(), \
614  gf1.dimensions() op gf2.dimensions() \
615  ) \
616  ); \
617  \
618  Foam::opFunc(tRes(), gf1, gf2); \
619  \
620  return tRes; \
621 } \
622  \
623 template \
624 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
625 tmp \
626 < \
627  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
628 > \
629 operator op \
630 ( \
631  const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
632  const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
633 ) \
634 { \
635  typedef typename product<Type1, Type2>::type productType; \
636  \
637  const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
638  \
639  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes = \
640  reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh>::New \
641  ( \
642  tgf2, \
643  '(' + gf1.name() + #op + gf2.name() + ')', \
644  gf1.dimensions() op gf2.dimensions() \
645  ); \
646  \
647  Foam::opFunc(tRes(), gf1, gf2); \
648  \
649  reuseTmpGeometricField<productType, Type2, PatchField, GeoMesh> \
650  ::clear(tgf2); \
651  \
652  return tRes; \
653 } \
654  \
655 template \
656 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
657 tmp \
658 < \
659  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
660 > \
661 operator op \
662 ( \
663  const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
664  const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
665 ) \
666 { \
667  typedef typename product<Type1, Type2>::type productType; \
668  \
669  const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
670  \
671  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes = \
672  reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh>::New \
673  ( \
674  tgf1, \
675  '(' + gf1.name() + #op + gf2.name() + ')', \
676  gf1.dimensions() op gf2.dimensions() \
677  ); \
678  \
679  Foam::opFunc(tRes(), gf1, gf2); \
680  \
681  reuseTmpGeometricField<productType, Type1, PatchField, GeoMesh> \
682  ::clear(tgf1); \
683  \
684  return tRes; \
685 } \
686  \
687 template \
688 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
689 tmp \
690 < \
691  GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
692 > \
693 operator op \
694 ( \
695  const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
696  const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
697 ) \
698 { \
699  typedef typename product<Type1, Type2>::type productType; \
700  \
701  const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
702  const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
703  \
704  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes = \
705  reuseTmpTmpGeometricField \
706  <productType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
707  ( \
708  tgf1, \
709  tgf2, \
710  '(' + gf1.name() + #op + gf2.name() + ')', \
711  gf1.dimensions() op gf2.dimensions() \
712  ); \
713  \
714  Foam::opFunc(tRes(), gf1, gf2); \
715  \
716  reuseTmpTmpGeometricField \
717  <productType, Type1, Type1, Type2, PatchField, GeoMesh> \
718  ::clear(tgf1, tgf2); \
719  \
720  return tRes; \
721 } \
722  \
723 template \
724 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
725 void opFunc \
726 ( \
727  GeometricField \
728  <typename product<Type, Form>::type, PatchField, GeoMesh>& gf, \
729  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
730  const dimensioned<Form>& dvs \
731 ) \
732 { \
733  Foam::opFunc(gf.internalField(), gf1.internalField(), dvs.value()); \
734  Foam::opFunc(gf.boundaryField(), gf1.boundaryField(), dvs.value()); \
735 } \
736  \
737 template \
738 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
739 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh> > \
740 operator op \
741 ( \
742  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
743  const dimensioned<Form>& dvs \
744 ) \
745 { \
746  typedef typename product<Type, Form>::type productType; \
747  \
748  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes \
749  ( \
750  new GeometricField<productType, PatchField, GeoMesh> \
751  ( \
752  IOobject \
753  ( \
754  '(' + gf1.name() + #op + dvs.name() + ')', \
755  gf1.instance(), \
756  gf1.db(), \
757  IOobject::NO_READ, \
758  IOobject::NO_WRITE \
759  ), \
760  gf1.mesh(), \
761  gf1.dimensions() op dvs.dimensions() \
762  ) \
763  ); \
764  \
765  Foam::opFunc(tRes(), gf1, dvs); \
766  \
767  return tRes; \
768 } \
769  \
770 template \
771 < \
772  class Form, \
773  class Cmpt, \
774  int nCmpt, \
775  class Type, template<class> class PatchField, \
776  class GeoMesh \
777 > \
778 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh> > \
779 operator op \
780 ( \
781  const GeometricField<Type, PatchField, GeoMesh>& gf1, \
782  const VectorSpace<Form,Cmpt,nCmpt>& vs \
783 ) \
784 { \
785  return gf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
786 } \
787  \
788  \
789 template \
790 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
791 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh> > \
792 operator op \
793 ( \
794  const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1, \
795  const dimensioned<Form>& dvs \
796 ) \
797 { \
798  typedef typename product<Type, Form>::type productType; \
799  \
800  const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
801  \
802  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes = \
803  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
804  ( \
805  tgf1, \
806  '(' + gf1.name() + #op + dvs.name() + ')', \
807  gf1.dimensions() op dvs.dimensions() \
808  ); \
809  \
810  Foam::opFunc(tRes(), gf1, dvs); \
811  \
812  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh> \
813  ::clear(tgf1); \
814  \
815  return tRes; \
816 } \
817  \
818 template \
819 < \
820  class Form, \
821  class Cmpt, \
822  int nCmpt, \
823  class Type, template<class> class PatchField, \
824  class GeoMesh \
825 > \
826 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh> > \
827 operator op \
828 ( \
829  const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1, \
830  const VectorSpace<Form,Cmpt,nCmpt>& vs \
831 ) \
832 { \
833  return tgf1 op dimensioned<Form>(static_cast<const Form&>(vs)); \
834 } \
835  \
836  \
837 template \
838 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
839 void opFunc \
840 ( \
841  GeometricField \
842  <typename product<Form, Type>::type, PatchField, GeoMesh>& gf, \
843  const dimensioned<Form>& dvs, \
844  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
845 ) \
846 { \
847  Foam::opFunc(gf.internalField(), dvs.value(), gf1.internalField()); \
848  Foam::opFunc(gf.boundaryField(), dvs.value(), gf1.boundaryField()); \
849 } \
850  \
851 template \
852 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
853 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh> > \
854 operator op \
855 ( \
856  const dimensioned<Form>& dvs, \
857  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
858 ) \
859 { \
860  typedef typename product<Form, Type>::type productType; \
861  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes \
862  ( \
863  new GeometricField<productType, PatchField, GeoMesh> \
864  ( \
865  IOobject \
866  ( \
867  '(' + dvs.name() + #op + gf1.name() + ')', \
868  gf1.instance(), \
869  gf1.db(), \
870  IOobject::NO_READ, \
871  IOobject::NO_WRITE \
872  ), \
873  gf1.mesh(), \
874  dvs.dimensions() op gf1.dimensions() \
875  ) \
876  ); \
877  \
878  Foam::opFunc(tRes(), dvs, gf1); \
879  \
880  return tRes; \
881 } \
882  \
883 template \
884 < \
885  class Form, \
886  class Cmpt, \
887  int nCmpt, \
888  class Type, template<class> class PatchField, \
889  class GeoMesh \
890 > \
891 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh> > \
892 operator op \
893 ( \
894  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
895  const GeometricField<Type, PatchField, GeoMesh>& gf1 \
896 ) \
897 { \
898  return dimensioned<Form>(static_cast<const Form&>(vs)) op gf1; \
899 } \
900  \
901 template \
902 <class Form, class Type, template<class> class PatchField, class GeoMesh> \
903 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh> > \
904 operator op \
905 ( \
906  const dimensioned<Form>& dvs, \
907  const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
908 ) \
909 { \
910  typedef typename product<Form, Type>::type productType; \
911  \
912  const GeometricField<Type, PatchField, GeoMesh>& gf1 = tgf1(); \
913  \
914  tmp<GeometricField<productType, PatchField, GeoMesh> > tRes = \
915  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh>::New \
916  ( \
917  tgf1, \
918  '(' + dvs.name() + #op + gf1.name() + ')', \
919  dvs.dimensions() op gf1.dimensions() \
920  ); \
921  \
922  Foam::opFunc(tRes(), dvs, gf1); \
923  \
924  reuseTmpGeometricField<productType, Type, PatchField, GeoMesh> \
925  ::clear(tgf1); \
926  \
927  return tRes; \
928 } \
929  \
930 template \
931 < \
932  class Form, \
933  class Cmpt, \
934  int nCmpt, \
935  class Type, template<class> class PatchField, \
936  class GeoMesh \
937 > \
938 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh> > \
939 operator op \
940 ( \
941  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
942  const tmp<GeometricField<Type, PatchField, GeoMesh> >& tgf1 \
943 ) \
944 { \
945  return dimensioned<Form>(static_cast<const Form&>(vs)) op tgf1; \
946 }
947 
950 
955 
956 #undef PRODUCT_OPERATOR
957 
958 
959 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
960 
961 } // End namespace Foam
962 
963 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
964 
965 #include "undefFieldFunctionsM.H"
966 
967 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
BINARY_TYPE_OPERATOR_SF
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:531
BINARY_OPERATOR
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:417
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
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:871
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:41
Foam::cmptMultiply
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:571
Foam::innerProduct
Definition: products.H:89
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, int(pTraits< arg1 >::rank)+int(pTraits< arg2 >::rank) >::type type
Definition: products.H:72
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:875
Foam::crossProduct
Definition: products.H:77
undefFieldFunctionsM.H
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::gSum
Type gSum(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:564
BINARY_FUNCTION
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
Definition: DimensionedFieldFunctionsM.C:142
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::GeometricField::cmptType
Field< Type >::cmptType cmptType
Definition: GeometricField.H:273
UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, gFunc)
Definition: GeometricFieldFunctions.C:478
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
GeometricFieldReuseFunctions.H
Foam::powProduct::type
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *int(pTraits< arg1 >::rank) >::type type
Definition: products.H:118
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:511
Foam::scalarProduct
Definition: products.H:101
Foam::typeOfSum
Definition: products.H:55
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
GeometricFieldFunctionsM.C
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
Foam::GeometricField::internalField
InternalField & internalField()
Return internal field.
Definition: GeometricField.C:724
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::sumMag
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:334
Foam::negate
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
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:870
Foam::GeoMesh
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:46
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::gSumMag
scalar gSumMag(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:565
BINARY_TYPE_FUNCTION
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
Definition: DimensionedFieldFunctionsM.C:410
PRODUCT_OPERATOR
#define PRODUCT_OPERATOR(product, op, opFunc)
Definition: GeometricFieldFunctions.C:572
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::cmptDivide
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::cmptAv
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:252
UNARY_OPERATOR
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
Definition: DimensionedFieldFunctionsM.C:86
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:873
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:333
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::gMin
Type gMin(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:563
BINARY_TYPE_OPERATOR_FS
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:608
Foam::multiply
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
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:874
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Foam::outerProduct
Definition: products.H:64
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:562
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::average
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:335
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:876