29 #define TEMPLATE template<class Type> 62 template<
class Type, direction r>
72 powProductType, res, =,
pow, Type, vf, powProductType,
77 template<
class Type, direction r>
90 pow<Type, r>(tRes.
ref(),
f);
94 template<
class Type, direction r>
104 pow<Type, r>(tRes.
ref(),
tf());
300 #define TMP_UNARY_FUNCTION(ReturnType, Func) \ 302 template<class Type> \ 303 ReturnType Func(const tmp<Field<Type>>& tf1) \ 305 ReturnType res = Func(tf1()); \ 521 <<
"empty field, returning zero" <<
endl;
530 #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \ 532 template<class Type> \ 533 ReturnType gFunc(const UList<Type>& f, const label comm) \ 535 ReturnType res = Func(f); \ 536 reduce(res, rFunc##Op<Type>(), Pstream::msgType(), comm); \ 539 TMP_UNARY_FUNCTION(ReturnType, gFunc) 550 #undef G_UNARY_FUNCTION 560 scalar SumProd =
sumProd(f1, f2);
598 <<
"empty field, returning zero." <<
endl;
606 #undef TMP_UNARY_FUNCTION 636 #define PRODUCT_OPERATOR(product, Op, OpFunc) \ 638 template<class Type1, class Type2> \ 641 Field<typename product<Type1, Type2>::type>& res, \ 642 const UList<Type1>& f1, \ 643 const UList<Type2>& f2 \ 646 typedef typename product<Type1, Type2>::type productType; \ 647 TFOR_ALL_F_OP_F_OP_F(productType, res, =, Type1, f1, Op, Type2, f2) \ 650 template<class Type1, class Type2> \ 651 tmp<Field<typename product<Type1, Type2>::type>> \ 652 operator Op(const UList<Type1>& f1, const UList<Type2>& f2) \ 654 typedef typename product<Type1, Type2>::type productType; \ 655 tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \ 656 OpFunc(tRes.ref(), f1, f2); \ 660 template<class Type1, class Type2> \ 661 tmp<Field<typename product<Type1, Type2>::type>> \ 662 operator Op(const UList<Type1>& f1, const tmp<Field<Type2>>& tf2) \ 664 typedef typename product<Type1, Type2>::type productType; \ 665 tmp<Field<productType>> tRes = reuseTmp<productType, Type2>::New(tf2); \ 666 OpFunc(tRes.ref(), f1, tf2()); \ 671 template<class Type1, class Type2> \ 672 tmp<Field<typename product<Type1, Type2>::type>> \ 673 operator Op(const tmp<Field<Type1>>& tf1, const UList<Type2>& f2) \ 675 typedef typename product<Type1, Type2>::type productType; \ 676 tmp<Field<productType>> tRes = reuseTmp<productType, Type1>::New(tf1); \ 677 OpFunc(tRes.ref(), tf1(), f2); \ 682 template<class Type1, class Type2> \ 683 tmp<Field<typename product<Type1, Type2>::type>> \ 684 operator Op(const tmp<Field<Type1>>& tf1, const tmp<Field<Type2>>& tf2) \ 686 typedef typename product<Type1, Type2>::type productType; \ 687 tmp<Field<productType>> tRes = \ 688 reuseTmpTmp<productType, Type1, Type1, Type2>::New(tf1, tf2); \ 689 OpFunc(tRes.ref(), tf1(), tf2()); \ 695 template<class Type, class Form, class Cmpt, direction nCmpt> \ 698 Field<typename product<Type, Form>::type>& res, \ 699 const UList<Type>& f1, \ 700 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 703 typedef typename product<Type, Form>::type productType; \ 704 TFOR_ALL_F_OP_F_OP_S \ 705 (productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs)) \ 708 template<class Type, class Form, class Cmpt, direction nCmpt> \ 709 tmp<Field<typename product<Type, Form>::type>> \ 710 operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \ 712 typedef typename product<Type, Form>::type productType; \ 713 tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \ 714 OpFunc(tRes.ref(), f1, static_cast<const Form&>(vs)); \ 718 template<class Type, class Form, class Cmpt, direction nCmpt> \ 719 tmp<Field<typename product<Type, Form>::type>> \ 722 const tmp<Field<Type>>& tf1, \ 723 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 726 typedef typename product<Type, Form>::type productType; \ 727 tmp<Field<productType>> tRes = reuseTmp<productType, Type>::New(tf1); \ 728 OpFunc(tRes.ref(), tf1(), static_cast<const Form&>(vs)); \ 733 template<class Form, class Cmpt, direction nCmpt, class Type> \ 736 Field<typename product<Form, Type>::type>& res, \ 737 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 738 const UList<Type>& f1 \ 741 typedef typename product<Form, Type>::type productType; \ 742 TFOR_ALL_F_OP_S_OP_F \ 743 (productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \ 746 template<class Form, class Cmpt, direction nCmpt, class Type> \ 747 tmp<Field<typename product<Form, Type>::type>> \ 748 operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \ 750 typedef typename product<Form, Type>::type productType; \ 751 tmp<Field<productType>> tRes(new Field<productType>(f1.size())); \ 752 OpFunc(tRes.ref(), static_cast<const Form&>(vs), f1); \ 756 template<class Form, class Cmpt, direction nCmpt, class Type> \ 757 tmp<Field<typename product<Form, Type>::type>> \ 760 const VectorSpace<Form,Cmpt,nCmpt>& vs, const tmp<Field<Type>>& tf1 \ 763 typedef typename product<Form, Type>::type productType; \ 764 tmp<Field<productType>> tRes = reuseTmp<productType, Type>::New(tf1); \ 765 OpFunc(tRes.ref(), static_cast<const Form&>(vs), tf1()); \ 778 #undef PRODUCT_OPERATOR void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
static tmp< Field< TypeR > > New(const tmp< Field< Type1 >> &tf1)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Inter-processor communication reduction functions.
#define TMP_UNARY_FUNCTION(ReturnType, Func)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
Type minMagSqr(const UList< Type > &f)
T & ref() const
Return non-const reference or generate a fatal error.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
pTraits< Type >::cmptType cmptType
Component type.
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
static int & msgType()
Message tag of standard messages.
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
#define TFOR_ALL_F_OP_FUNC_F(typeF1, f1, OP, FUNC, typeF2, f2)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type sumCmptProd(const UList< Type > &f1, const UList< Type > &f2)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dot(FieldField< Field1, typename innerProduct< 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 > sum(const DimensionedField< Type, GeoMesh > &df)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
scalar sumProd(const UList< Type > &f1, const UList< Type > &f2)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
Pre-declare SubField and related Field type.
#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc)
#define TFOR_ALL_S_OP_F(typeS, s, OP, typeF, f)
Type sumCmptMag(const UList< Type > &f)
void clear()
Clear the list, i.e. set size to zero.
void sumReduce(T &Value, label &Count, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define TFOR_ALL_S_OP_FUNC_F_S(typeS1, s1, OP, FUNC, typeF, f, typeS2, s2)
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
dimensionSet cmptMag(const dimensionSet &)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
scalar gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type gMax(const FieldField< Field, Type > &f)
#define TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
scalar sumSqr(const UList< Type > &f)
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
#define WarningInFunction
Report a warning using Foam::Warning.
Type gAverage(const FieldField< Field, Type > &f)
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
Type maxMagSqr(const UList< Type > &f)
dimensioned< scalar > mag(const dimensioned< Type > &)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
A class for managing temporary objects.
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
label size() const
Return the number of elements in the UList.
#define PRODUCT_OPERATOR(product, Op, OpFunc)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh > &df)
#define TFOR_ALL_F_OP_FUNC_F_S(typeF1, f1, OP, FUNC, typeF2, f2, typeS, s)