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-------------------------------------------------------------------------------
11License
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
37namespace Foam
38{
39
40// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
41
42template<class Type, template<class> class PatchField, class GeoMesh>
44(
46 <
48 PatchField,
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
61template<class Type, template<class> class PatchField, class GeoMesh>
62void T
63(
66)
67{
69 T(gf.boundaryFieldRef(), gf1.boundaryField());
70 gf.oriented() = gf1.oriented();
71}
72
73
74template
75<
76 class Type,
77 template<class> class PatchField,
78 class GeoMesh,
79 direction r
80>
81void 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
93template
94<
95 class Type,
96 template<class> class PatchField,
97 class GeoMesh,
98 direction r
99>
100tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
102(
105)
106{
107 typedef typename powProduct<Type, r>::type powProductType;
108
109 auto tres =
111 (
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
130template
131<
132 class Type,
133 template<class> class PatchField,
134 class GeoMesh,
135 direction r
136>
137tmp<GeometricField<typename powProduct<Type, r>::type, PatchField, GeoMesh>>
139(
142)
143{
144 typedef typename powProduct<Type, r>::type powProductType;
145
147
148 auto tres =
150 (
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
170template<class Type, template<class> class PatchField, class GeoMesh>
171void 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
184template<class Type, template<class> class PatchField, class GeoMesh>
185tmp
186<
187 GeometricField
188 <
190 PatchField,
191 GeoMesh
192 >
193>
195{
196 typedef typename outerProduct<Type, Type>::type outerProductType;
197
198 auto tres =
200 (
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
219template<class Type, template<class> class PatchField, class GeoMesh>
220tmp
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 (
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
258template<class Type, template<class> class PatchField, class GeoMesh>
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
271template<class Type, template<class> class PatchField, class GeoMesh>
272tmp<GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>>
274(
276)
277{
278 typedef typename typeOfMag<Type>::type magType;
279
280 auto tres =
282 (
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
300template<class Type, template<class> class PatchField, class GeoMesh>
301tmp<GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>>
303(
305)
306{
307 auto tres = magSqr(tgf.cref());
308 tgf.clear();
309
310 return tres;
311}
312
313
314template<class Type, template<class> class PatchField, class GeoMesh>
315void 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
327template<class Type, template<class> class PatchField, class GeoMesh>
328tmp<GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>>
330(
332)
333{
334 typedef typename typeOfMag<Type>::type magType;
335
336 auto tres =
338 (
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
356template<class Type, template<class> class PatchField, class GeoMesh>
357tmp<GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>>
359(
361)
362{
363 auto tres = mag(tgf.cref());
364 tgf.clear();
365
366 return tres;
367}
368
369
370template<class Type, template<class> class PatchField, class GeoMesh>
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
387template<class Type, template<class> class PatchField, class GeoMesh>
388tmp
389<
390 GeometricField
391 <
393 PatchField,
394 GeoMesh
395 >
396>
398{
400 cmptType;
401
402 auto tres =
404 (
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
423template<class Type, template<class> class PatchField, class GeoMesh>
424tmp
425<
426 GeometricField
427 <
429 PatchField,
430 GeoMesh
431 >
432>
434{
436 cmptType;
437
439
440 auto tres =
442 (
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 \
465template<class Type, template<class> class PatchField, class GeoMesh> \
466dimensioned<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 \
487template<class Type, template<class> class PatchField, class GeoMesh> \
488dimensioned<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 \
508template<class Type, template<class> class PatchField, class GeoMesh> \
509dimensioned<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 \
522template<class Type, template<class> class PatchField, class GeoMesh> \
523dimensioned<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
540BINARY_FUNCTION(Type, Type, Type, max)
541BINARY_FUNCTION(Type, Type, Type, min)
542BINARY_FUNCTION(Type, Type, Type, cmptMultiply)
543BINARY_FUNCTION(Type, Type, Type, cmptDivide)
544
545BINARY_TYPE_FUNCTION(Type, Type, Type, max)
546BINARY_TYPE_FUNCTION(Type, Type, Type, min)
547BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply)
548BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide)
549
550
551// * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
552
553UNARY_OPERATOR(Type, Type, -, negate, transform)
554
555BINARY_OPERATOR(Type, Type, scalar, *, '*', multiply)
556BINARY_OPERATOR(Type, scalar, Type, *, '*', multiply)
557BINARY_OPERATOR(Type, Type, scalar, /, '|', divide)
558
559BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, '*', multiply)
560BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, '*', multiply)
561
562BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, '|', divide)
563
564
565// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
566
567#define PRODUCT_OPERATOR(product, op, opFunc) \
568 \
569template \
570<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
571void 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 \
595template \
596<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
597tmp \
598< \
599 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
600> \
601operator 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 \
630template \
631<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
632tmp \
633< \
634 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
635> \
636operator 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 \
661template \
662<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
663tmp \
664< \
665 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
666> \
667operator 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 \
692template \
693<class Type1, class Type2, template<class> class PatchField, class GeoMesh> \
694tmp \
695< \
696 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \
697> \
698operator 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 \
727template \
728<class Form, class Type, template<class> class PatchField, class GeoMesh> \
729void 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 \
742template \
743<class Form, class Type, template<class> class PatchField, class GeoMesh> \
744tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \
745operator 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 \
773template \
774< \
775 class Form, \
776 class Cmpt, \
777 direction nCmpt, \
778 class Type, template<class> class PatchField, \
779 class GeoMesh \
780> \
781tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
782operator 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 \
792template \
793<class Form, class Type, template<class> class PatchField, class GeoMesh> \
794tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \
795operator 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 \
820template \
821< \
822 class Form, \
823 class Cmpt, \
824 direction nCmpt, \
825 class Type, template<class> class PatchField, \
826 class GeoMesh \
827> \
828tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
829operator 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 \
839template \
840<class Form, class Type, template<class> class PatchField, class GeoMesh> \
841void 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 \
854template \
855<class Form, class Type, template<class> class PatchField, class GeoMesh> \
856tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
857operator 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 \
885template \
886< \
887 class Form, \
888 class Cmpt, \
889 direction nCmpt, \
890 class Type, template<class> class PatchField, \
891 class GeoMesh \
892> \
893tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
894operator 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 \
903template \
904<class Form, class Type, template<class> class PatchField, class GeoMesh> \
905tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
906operator 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 \
931template \
932< \
933 class Form, \
934 class Cmpt, \
935 direction nCmpt, \
936 class Type, template<class> class PatchField, \
937 class GeoMesh \
938> \
939tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \
940operator 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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
#define UNARY_REDUCTION_FUNCTION(returnType, func, dfunc)
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(returnType, func, binaryOp)
const dimensionSet & dimensions() const
Return dimensions.
const Mesh & mesh() const
Return mesh.
const orientedType & oriented() const noexcept
Return oriented type.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:49
Generic GeometricField class.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Field< Type >::cmptType cmptType
The field component type.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:196
A min/max value pair with additional methods. In addition to conveniently storing values,...
Definition: MinMax.H:128
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
Definition: products.H:114
A class for managing temporary objects.
Definition: tmp.H:65
The magnitude type for given argument.
Definition: products.H:89
pTraits< typenamepTraits< arg1 >::cmptType >::magType type
Definition: products.H:92
type
Volume classification types.
Definition: volumeType.H:66
const volScalarField & T
#define PRODUCT_OPERATOR(product, op, opFunc)
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Type gSum(const FieldField< Field, Type > &f)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void subtract(FieldField< Field1, typename typeOfSum< 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 > average(const DimensionedField< Type, GeoMesh > &df)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Definition: hashSets.C:61
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &df)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
uint8_t direction
Definition: direction.H:56
Type gAverage(const FieldField< Field, Type > &f)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh > > cmptAv(const DimensionedField< Type, GeoMesh > &df)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Scalar combine the magitude of a value.
Definition: MinMaxOps.H:237
Combine values and/or MinMax ranges.
Definition: MinMaxOps.H:115