32#define TEMPLATE template<class Type>
65template<
class Type, direction r>
75 powProductType, res, =,
pow, Type, vf, powProductType,
80template<
class Type, direction r>
81tmp<Field<typename powProduct<Type, r>::type>>
93 pow<Type, r>(tres.ref(),
f);
97template<
class Type, direction r>
98tmp<Field<typename powProduct<Type, r>::type>>
107 pow<Type, r>(tres.ref(), tf());
125tmp<Field<typename outerProduct<Type, Type>::type>>
138tmp<Field<typename outerProduct<Type, Type>::type>>
143 sqr(tres.ref(), tf());
162tmp<Field<typename typeOfMag<Type>::type>>
173tmp<Field<typename typeOfMag<Type>::type>>
198tmp<Field<typename typeOfMag<Type>::type>>
209tmp<Field<typename typeOfMag<Type>::type>>
215 mag(tres.ref(), tf());
350#define TMP_UNARY_FUNCTION(ReturnType, Func) \
352template<class Type> \
353ReturnType Func(const tmp<Field<Type>>& tf1) \
355 ReturnType res = Func(tf1()); \
395 solveType Sum =
Zero;
472 prodType result =
Zero;
508 prodType result =
Zero;
521 prodType result =
sumSqr(tf());
532 magType result =
Zero;
567 <<
"empty field, returning zero" <<
endl;
576#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \
578template<class Type> \
579ReturnType gFunc(const UList<Type>& f, const label comm) \
581 ReturnType res = Func(f); \
582 reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \
585TMP_UNARY_FUNCTION(ReturnType, gFunc)
600#undef G_UNARY_FUNCTION
613 prodType result =
sumProd(f1, f2);
650 <<
"empty field, returning zero." <<
endl;
657#undef TMP_UNARY_FUNCTION
689#define PRODUCT_OPERATOR(product, Op, OpFunc) \
691template<class Type1, class Type2> \
694 Field<typename product<Type1, Type2>::type>& res, \
695 const UList<Type1>& f1, \
696 const UList<Type2>& f2 \
699 typedef typename product<Type1, Type2>::type productType; \
700 TFOR_ALL_F_OP_F_OP_F(productType, res, =, Type1, f1, Op, Type2, f2) \
703template<class Type1, class Type2> \
704tmp<Field<typename product<Type1, Type2>::type>> \
705operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \
707 typedef typename product<Type1, Type2>::type productType; \
708 auto tres = tmp<Field<productType>>::New(f1.size()); \
709 OpFunc(tres.ref(), f1, f2); \
713template<class Type1, class Type2> \
714tmp<Field<typename product<Type1, Type2>::type>> \
715operator Op(const UList<Type1>& f1, const tmp<Field<Type2>>& tf2) \
717 typedef typename product<Type1, Type2>::type productType; \
718 auto tres = reuseTmp<productType, Type2>::New(tf2); \
719 OpFunc(tres.ref(), f1, tf2()); \
724template<class Type1, class Type2> \
725tmp<Field<typename product<Type1, Type2>::type>> \
726operator Op(const tmp<Field<Type1>>& tf1, const UList<Type2>& f2) \
728 typedef typename product<Type1, Type2>::type productType; \
729 auto tres = reuseTmp<productType, Type1>::New(tf1); \
730 OpFunc(tres.ref(), tf1(), f2); \
735template<class Type1, class Type2> \
736tmp<Field<typename product<Type1, Type2>::type>> \
737operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \
739 typedef typename product<Type1, Type2>::type productType; \
740 auto tres = reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \
741 OpFunc(tres.ref(), tf1(), tf2()); \
747template<class Type, class Form, class Cmpt, direction nCmpt> \
750 Field<typename product<Type, Form>::type>& res, \
751 const UList<Type>& f1, \
752 const VectorSpace<Form,Cmpt,nCmpt>& vs \
755 typedef typename product<Type, Form>::type productType; \
756 TFOR_ALL_F_OP_F_OP_S \
757 (productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs)) \
760template<class Type, class Form, class Cmpt, direction nCmpt> \
761tmp<Field<typename product<Type, Form>::type>> \
762operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \
764 typedef typename product<Type, Form>::type productType; \
765 auto tres = tmp<Field<productType>>::New(f1.size()); \
766 OpFunc(tres.ref(), f1, static_cast<const Form&>(vs)); \
770template<class Type, class Form, class Cmpt, direction nCmpt> \
771tmp<Field<typename product<Type, Form>::type>> \
774 const tmp<Field<Type>>& tf1, \
775 const VectorSpace<Form,Cmpt,nCmpt>& vs \
778 typedef typename product<Type, Form>::type productType; \
779 auto tres = reuseTmp<productType, Type>::New(tf1); \
780 OpFunc(tres.ref(), tf1(), static_cast<const Form&>(vs)); \
785template<class Form, class Cmpt, direction nCmpt, class Type> \
788 Field<typename product<Form, Type>::type>& res, \
789 const VectorSpace<Form,Cmpt,nCmpt>& vs, \
790 const UList<Type>& f1 \
793 typedef typename product<Form, Type>::type productType; \
794 TFOR_ALL_F_OP_S_OP_F \
795 (productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \
798template<class Form, class Cmpt, direction nCmpt, class Type> \
799tmp<Field<typename product<Form, Type>::type>> \
800operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \
802 typedef typename product<Form, Type>::type productType; \
803 auto tres = tmp<Field<productType>>::New(f1.size()); \
804 OpFunc(tres.ref(), static_cast<const Form&>(vs), f1); \
808template<class Form, class Cmpt, direction nCmpt, class Type> \
809tmp<Field<typename product<Form, Type>::type>> \
812 const VectorSpace<Form,Cmpt,nCmpt>& vs, const tmp<Field<Type>>& tf1 \
815 typedef typename product<Form, Type>::type productType; \
816 auto tres = reuseTmp<productType, Type>::New(tf1); \
817 OpFunc(tres.ref(), static_cast<const Form&>(vs), tf1()); \
830#undef PRODUCT_OPERATOR
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
#define BINARY_TYPE_FUNCTION_FS(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 TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
#define TFOR_ALL_F_OP_FUNC_F_S(typeF1, f1, OP, FUNC, typeF2, f2, typeS, s)
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
#define TFOR_ALL_S_OP_FUNC_F_S(typeS1, s1, OP, FUNC, typeF, f, typeS2, s2)
#define TFOR_ALL_F_OP_FUNC_F(typeF1, f1, OP, FUNC, typeF2, f2)
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
Inter-processor communication reduction functions.
Generic templated field type.
A min/max value pair with additional methods. In addition to conveniently storing values,...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
static int & msgType() noexcept
Message tag of standard messages.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Outer-product of identical types.
A traits class, which is primarily used for primitives.
A class for managing temporary objects.
The magnitude type for given argument.
pTraits< typenamepTraits< arg1 >::cmptType >::magType type
type
Volume classification types.
#define PRODUCT_OPERATOR(product, op, opFunc)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
scalarProduct< Type, Type >::type gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionSet clip(const dimensionSet &ds1, const dimensionSet &ds2)
Type gSum(const FieldField< Field, Type > &f)
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)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Type sumCmptProd(const UList< Type > &f1, const UList< Type > &f2)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Type maxMagSqr(const UList< Type > &f)
void cmptMagSqr(Field< Type > &res, const UList< Type > &f)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Type gMaxMagSqr(const UList< Type > &f, const label comm)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &df)
Ostream & endl(Ostream &os)
Add newline and flush stream.
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)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
complex sumProd(const UList< complex > &f1, const UList< complex > &f2)
Sum product.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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)
void sumReduce(T &value, label &count, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
outerProduct1< Type >::type sumSqr(const UList< Type > &f)
Type gAverage(const FieldField< Field, Type > &f)
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0)
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)
Type minMagSqr(const UList< Type > &f)
Type gMin(const FieldField< Field, Type > &f)
void cmptMag(FieldField< Field, Type > &cf, 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)
outerProduct1< Type >::type gSumSqr(const UList< Type > &f, const label comm)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh > > cmptAv(const DimensionedField< Type, GeoMesh > &df)
Type gMinMagSqr(const UList< Type > &f, const label comm)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
Type gSumCmptMag(const UList< Type > &f, const label comm)
Type gMax(const FieldField< Field, Type > &f)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Type sumCmptMag(const UList< Type > &f)
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)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
A non-counting (dummy) refCount.