Go to the documentation of this file.
32 #define TEMPLATE template<class Type>
59 void T(Field<Type>& res,
const UList<Type>&
f)
65 template<
class Type, direction r>
75 powProductType, res, =,
pow, Type, vf, powProductType,
80 template<
class Type, direction r>
91 tmp<Field<powProductType>>::
New(
f.size())
93 pow<Type, r>(tres.ref(),
f);
97 template<
class Type, direction r>
101 const tmp<Field<Type>>& tf,
107 pow<Type, r>(tres.ref(), tf());
117 const UList<Type>& vf
126 sqr(
const UList<Type>&
f)
131 tmp<Field<outerProductType>>::
New(
f.size())
139 sqr(
const tmp<Field<Type>>& tf)
143 sqr(tres.ref(), tf());
174 magSqr(
const tmp<Field<Type>>& tf)
199 mag(
const UList<Type>&
f)
210 mag(
const tmp<Field<Type>>& tf)
229 tmp<Field<typename Field<Type>::cmptType>>
cmptMax(
const UList<Type>&
f)
238 tmp<Field<typename Field<Type>::cmptType>>
cmptMax(
const tmp<Field<Type>>& tf)
256 tmp<Field<typename Field<Type>::cmptType>>
cmptMin(
const UList<Type>&
f)
265 tmp<Field<typename Field<Type>::cmptType>>
cmptMin(
const tmp<Field<Type>>& tf)
283 tmp<Field<typename Field<Type>::cmptType>>
cmptAv(
const UList<Type>&
f)
292 tmp<Field<typename Field<Type>::cmptType>>
cmptAv(
const tmp<Field<Type>>& tf)
309 tmp<Field<Type>>
cmptMag(
const UList<Type>&
f)
317 tmp<Field<Type>>
cmptMag(
const tmp<Field<Type>>& tf)
341 tmp<Field<Type>>
cmptMagSqr(
const tmp<Field<Type>>& tf)
350 #define TMP_UNARY_FUNCTION(ReturnType, Func) \
352 template<class Type> \
353 ReturnType Func(const tmp<Field<Type>>& tf1) \
355 ReturnType res = Func(tf1()); \
376 Type
min(
const UList<Type>&
f)
391 Type
sum(
const UList<Type>&
f)
395 solveType Sum =
Zero;
472 prodType result =
Zero;
473 if (f1.size() && (f1.size() == f2.size()))
482 Type
sumCmptProd(
const UList<Type>& f1,
const UList<Type>& f2)
485 if (f1.size() && (f1.size() == f2.size()))
508 prodType result =
Zero;
518 sumSqr(
const tmp<Field<Type>>& tf)
521 prodType result =
sumSqr(tf());
532 magType result =
Zero;
561 Type avrg =
sum(
f)/
f.size();
567 <<
"empty field, returning zero" <<
endl;
576 #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \
578 template<class Type> \
579 ReturnType gFunc(const UList<Type>& f, const label comm) \
581 ReturnType res = Func(f); \
582 reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \
585 TMP_UNARY_FUNCTION(ReturnType, gFunc)
600 #undef G_UNARY_FUNCTION
621 const UList<Type>& f1,
622 const UList<Type>& f2,
634 const UList<Type>&
f,
650 <<
"empty field, returning zero." <<
endl;
657 #undef TMP_UNARY_FUNCTION
689 #define PRODUCT_OPERATOR(product, Op, OpFunc) \
691 template<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) \
703 template<class Type1, class Type2> \
704 tmp<Field<typename product<Type1, Type2>::type>> \
705 operator 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); \
713 template<class Type1, class Type2> \
714 tmp<Field<typename product<Type1, Type2>::type>> \
715 operator 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()); \
724 template<class Type1, class Type2> \
725 tmp<Field<typename product<Type1, Type2>::type>> \
726 operator 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); \
735 template<class Type1, class Type2> \
736 tmp<Field<typename product<Type1, Type2>::type>> \
737 operator 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()); \
747 template<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)) \
760 template<class Type, class Form, class Cmpt, direction nCmpt> \
761 tmp<Field<typename product<Type, Form>::type>> \
762 operator 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)); \
770 template<class Type, class Form, class Cmpt, direction nCmpt> \
771 tmp<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)); \
785 template<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) \
798 template<class Form, class Cmpt, direction nCmpt, class Type> \
799 tmp<Field<typename product<Form, Type>::type>> \
800 operator 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); \
808 template<class Form, class Cmpt, direction nCmpt, class Type> \
809 tmp<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_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define TFOR_ALL_F_OP_FUNC_F_S(typeF1, f1, OP, FUNC, typeF2, f2, typeS, s)
void cmptMagSqr(Field< Type > &res, const UList< Type > &f)
#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type gMinMagSqr(const UList< Type > &f, const label comm)
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
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))
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
A class for managing temporary objects.
static constexpr const zero Zero
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
Type gAverage(const FieldField< Field, Type > &f)
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
#define TMP_UNARY_FUNCTION(ReturnType, Func)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
#define TFOR_ALL_S_OP_FUNC_F_S(typeS1, s1, OP, FUNC, typeF, f, typeS2, s2)
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &df)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
Ostream & endl(Ostream &os)
Type gSum(const FieldField< Field, Type > &f)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
outerProduct1< Type >::type sumSqr(const UList< Type > &f)
complex sumProd(const UList< complex > &f1, const UList< complex > &f2)
label min(const labelHashSet &set, label minValue=labelMax)
outerProduct1< Type >::type gSumSqr(const UList< Type > &f, const label comm)
#define TFOR_ALL_F_OP_FUNC_F(typeF1, f1, OP, FUNC, typeF2, f2)
Type sumCmptMag(const UList< Type > &f)
Type gMaxMagSqr(const UList< Type > &f, const label comm)
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Type maxMagSqr(const UList< Type > &f)
Type gSumCmptMag(const UList< Type > &f, const label comm)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
pTraits< Type >::cmptType cmptType
Generic templated field type.
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
#define PRODUCT_OPERATOR(product, Op, OpFunc)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
pTraits< arg1 >::cmptType type
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
label max(const labelHashSet &set, label maxValue=labelMin)
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
scalarProduct< Type, Type >::type gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
static tmp< Field< TypeR > > New(const tmp< Field< Type1 >> &tf1)
#define TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
Type minMagSqr(const UList< Type > &f)
Inter-processor communication reduction functions.
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static int & msgType() noexcept
dimensionSet clip(const dimensionSet &ds1, const dimensionSet &ds2)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
A traits class, which is primarily used for primitives.
Type sumCmptProd(const UList< Type > &f1, const UList< Type > &f2)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
MinMax< label > minMax(const labelHashSet &set)
void sumReduce(T &Value, label &Count, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Type gMin(const FieldField< Field, Type > &f)
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
#define WarningInFunction
pTraits< typename pTraits< arg1 >::cmptType >::magType type
A min/max value pair with additional methods. In addition to conveniently storing values,...
Type gMax(const FieldField< Field, Type > &f)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
MinMax< Type > gMinMax(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)