29 #define TEMPLATE template<template<class> class Field, class Type>
39 template<
template<
class>
class Field,
class Type>
54 template<
template<
class>
class Field,
class Type>
64 template<
template<
class>
class Field,
class Type,
direction r>
77 template<
template<
class>
class Field,
class Type,
direction r>
78 tmp<FieldField<Field, typename powProduct<Type, r>::type>>
89 pow<Type, r>(tRes.
ref(),
f);
93 template<
template<
class>
class Field,
class Type,
direction r>
94 tmp<FieldField<Field, typename powProduct<Type, r>::type>>
105 pow<Type, r>(tRes.
ref(),
tf());
111 template<
template<
class>
class Field,
class Type>
124 template<
template<
class>
class Field,
class Type>
125 tmp<FieldField<Field, typename outerProduct<Type, Type>::type>>
137 template<
template<
class>
class Field,
class Type>
138 tmp<FieldField<Field, typename outerProduct<Type, Type>::type>>
152 template<
template<
class>
class Field,
class Type>
161 template<
template<
class>
class Field,
class Type>
173 template<
template<
class>
class Field,
class Type>
187 template<
template<
class>
class Field,
class Type>
196 template<
template<
class>
class Field,
class Type>
208 template<
template<
class>
class Field,
class Type>
222 template<
template<
class>
class Field,
class Type>
235 template<
template<
class>
class Field,
class Type>
250 template<
template<
class>
class Field,
class Type>
267 template<
template<
class>
class Field,
class Type>
280 template<
template<
class>
class Field,
class Type>
295 template<
template<
class>
class Field,
class Type>
312 template<
template<
class>
class Field,
class Type>
325 template<
template<
class>
class Field,
class Type>
340 template<
template<
class>
class Field,
class Type>
357 template<
template<
class>
class Field,
class Type>
370 template<
template<
class>
class Field,
class Type>
384 template<
template<
class>
class Field,
class Type>
397 #define TMP_UNARY_FUNCTION(returnType, func) \
399 template<template<class> class Field, class Type> \
400 returnType func(const tmp<FieldField<Field, Type>>& tf1) \
402 returnType res = func(tf1()); \
407 template<
template<
class>
class Field,
class Type>
435 template<
template<
class>
class Field,
class Type>
444 while (!
f[i].size()) i++;
466 template<
template<
class>
class Field,
class Type>
488 template<
template<
class>
class Field,
class Type>
510 template<
template<
class>
class Field,
class Type>
525 <<
"empty fieldField, returning zero" <<
endl;
530 Type avrg =
sum(
f)/
n;
537 <<
"empty fieldField, returning zero" <<
endl;
546 #define G_UNARY_FUNCTION(returnType, gFunc, func, rFunc) \
548 template<template<class> class Field, class Type> \
549 returnType gFunc(const FieldField<Field, Type>& f) \
551 returnType res = func(f); \
552 reduce(res, rFunc##Op<Type>()); \
555 TMP_UNARY_FUNCTION(returnType, gFunc)
562 #undef G_UNARY_FUNCTION
565 template<
template<
class>
class Field,
class Type>
586 <<
"empty fieldField, returning zero" <<
endl;
594 #undef TMP_UNARY_FUNCTION
624 #define PRODUCT_OPERATOR(product, op, opFunc) \
628 template<class> class Field1, \
629 template<class> class Field2, \
635 FieldField<Field1, typename product<Type1, Type2>::type>& f, \
636 const FieldField<Field1, Type1>& f1, \
637 const FieldField<Field2, Type2>& f2 \
642 opFunc(f[i], f1[i], f2[i]); \
648 template<class> class Field1, \
649 template<class> class Field2, \
653 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \
656 const FieldField<Field1, Type1>& f1, \
657 const FieldField<Field2, Type2>& f2 \
660 typedef typename product<Type1, Type2>::type productType; \
661 tmp<FieldField<Field1, productType>> tRes \
663 FieldField<Field1, productType>::NewCalculatedType(f1) \
665 opFunc(tRes.ref(), f1, f2); \
669 template<template<class> class Field, class Type1, class Type2> \
670 tmp<FieldField<Field, typename product<Type1, Type2>::type>> \
673 const FieldField<Field, Type1>& f1, \
674 const tmp<FieldField<Field, Type2>>& tf2 \
677 typedef typename product<Type1, Type2>::type productType; \
678 tmp<FieldField<Field, productType>> tRes \
680 reuseTmpFieldField<Field, productType, Type2>::New(tf2) \
682 opFunc(tRes.ref(), f1, tf2()); \
689 template<class> class Field1, \
690 template<class> class Field2, \
694 tmp<FieldField<Field, typename product<Type1, Type2>::type>> \
697 const FieldField<Field1, Type1>& f1, \
698 const tmp<FieldField<Field2, Type2>>& tf2 \
701 typedef typename product<Type1, Type2>::type productType; \
702 tmp<FieldField<Field1, productType>> tRes \
704 FieldField<Field1, productType>::NewCalculatedType(f1) \
706 opFunc(tRes.ref(), f1, tf2()); \
713 template<class> class Field1, \
714 template<class> class Field2, \
718 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \
721 const tmp<FieldField<Field1, Type1>>& tf1, \
722 const FieldField<Field2, Type2>& f2 \
725 typedef typename product<Type1, Type2>::type productType; \
726 tmp<FieldField<Field1, productType>> tRes \
728 reuseTmpFieldField<Field1, productType, Type1>::New(tf1) \
730 opFunc(tRes.ref(), tf1(), f2); \
737 template<class> class Field1, \
738 template<class> class Field2, \
742 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \
745 const tmp<FieldField<Field1, Type1>>& tf1, \
746 const tmp<FieldField<Field2, Type2>>& tf2 \
749 typedef typename product<Type1, Type2>::type productType; \
750 tmp<FieldField<Field1, productType>> tRes \
752 reuseTmpTmpFieldField<Field1, productType, Type1, Type2>::New(tf1, tf2)\
754 opFunc(tRes.ref(), tf1(), tf2()); \
762 template<class> class Field, \
770 FieldField<Field, typename product<Type, Form>::type>& f, \
771 const FieldField<Field, Type>& f1, \
772 const VectorSpace<Form,Cmpt,nCmpt>& vs \
777 opFunc(f[i], f1[i], vs); \
783 template<class> class Field, \
789 tmp<FieldField<Field, typename product<Type, Form>::type>> \
792 const FieldField<Field, Type>& f1, \
793 const VectorSpace<Form,Cmpt,nCmpt>& vs \
796 typedef typename product<Type, Form>::type productType; \
797 tmp<FieldField<Field, productType>> tRes \
799 FieldField<Field, productType>::NewCalculatedType(f1) \
801 opFunc(tRes.ref(), f1, static_cast<const Form&>(vs)); \
807 template<class> class Field, \
813 tmp<FieldField<Field, typename product<Type, Form>::type>> \
816 const tmp<FieldField<Field, Type>>& tf1, \
817 const VectorSpace<Form,Cmpt,nCmpt>& vs \
820 typedef typename product<Type, Form>::type productType; \
821 tmp<FieldField<Field, productType>> tRes \
823 reuseTmpFieldField<Field, productType, Type>::New(tf1) \
825 opFunc(tRes.ref(), tf1(), static_cast<const Form&>(vs)); \
832 template<class> class Field, \
840 FieldField<Field, typename product<Form, Type>::type>& f, \
841 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
842 const FieldField<Field, Type>& f1 \
847 opFunc(f[i], vs, f1[i]); \
853 template<class> class Field, \
859 tmp<FieldField<Field, typename product<Form, Type>::type>> \
862 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
863 const FieldField<Field, Type>& f1 \
866 typedef typename product<Form, Type>::type productType; \
867 tmp<FieldField<Field, productType>> tRes \
869 FieldField<Field, productType>::NewCalculatedType(f1) \
871 opFunc(tRes.ref(), static_cast<const Form&>(vs), f1); \
877 template<class> class Field, \
883 tmp<FieldField<Field, typename product<Form, Type>::type>> \
886 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
887 const tmp<FieldField<Field, Type>>& tf1 \
890 typedef typename product<Form, Type>::type productType; \
891 tmp<FieldField<Field, productType>> tRes \
893 reuseTmpFieldField<Field, productType, Type>::New(tf1) \
895 opFunc(tRes.ref(), static_cast<const Form&>(vs), tf1()); \
908 #undef PRODUCT_OPERATOR
#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 G_UNARY_FUNCTION(returnType, gFunc, func, rFunc)
#define TMP_UNARY_FUNCTION(returnType, func)
#define PRODUCT_OPERATOR(product, op, opFunc)
Inter-processor communication reduction functions.
#define forAll(list, i)
Loop across all elements in list.
pTraits< Type >::cmptType cmptType
Component type.
Pre-declare SubField and related Field type.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Traits class for primitives.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
volScalarField sf(fieldObject, mesh)
#define WarningInFunction
Report a warning using Foam::Warning.
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
Type gSum(const FieldField< Field, Type > &f)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
scalar gSumMag(const FieldField< Field, Type > &f)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
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)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< scalar > mag(const dimensioned< Type > &)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionSet cmptMag(const dimensionSet &)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Type gAverage(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)
Type gMin(const FieldField< Field, Type > &f)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Type gMax(const FieldField< Field, Type > &f)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh > &df)