29 #define TEMPLATE template<class Type> 62 template<
class Type,
int r>
72 powProductType, res, =,
pow, Type, vf, powProductType,
77 template<
class Type,
int r>
90 pow<Type, r>(tRes(),
f);
94 template<
class Type,
int r>
104 pow<Type, r>(tRes(),
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()); \ 362 Type maxMagSqr(const
UList<Type>& f)
389 Type minMagSqr(const
UList<Type>& f)
418 if (f1.size() && (f1.size() == f2.size()))
420 scalar SumProd = 0.0;
493 Type sumCmptMag(const
UList<Type>& f)
514 Type avrg =
sum(f)/f.size();
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);
597 WarningIn(
"gAverage(const UList<Type>&)")
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(), 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(), f1, tf2()); \ 667 reuseTmp<productType, Type2>::clear(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(), tf1(), f2); \ 678 reuseTmp<productType, Type1>::clear(tf1); \ 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(), tf1(), tf2()); \ 690 reuseTmpTmp<productType, Type1, Type1, Type2>::clear(tf1, tf2); \ 694 template<class Type, class Form, class Cmpt, int nCmpt> \ 697 Field<typename product<Type, Form>::type>& res, \ 698 const UList<Type>& f1, \ 699 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 702 typedef typename product<Type, Form>::type productType; \ 703 TFOR_ALL_F_OP_F_OP_S \ 704 (productType, res, =,Type, f1, Op, Form, static_cast<const Form&>(vs))\ 707 template<class Type, class Form, class Cmpt, int nCmpt> \ 708 tmp<Field<typename product<Type, Form>::type> > \ 709 operator Op(const UList<Type>& f1, const VectorSpace<Form,Cmpt,nCmpt>& vs) \ 711 typedef typename product<Type, Form>::type productType; \ 712 tmp<Field<productType> > tRes(new Field<productType>(f1.size())); \ 713 OpFunc(tRes(), f1, static_cast<const Form&>(vs)); \ 717 template<class Type, class Form, class Cmpt, int nCmpt> \ 718 tmp<Field<typename product<Type, Form>::type> > \ 721 const tmp<Field<Type> >& tf1, \ 722 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 725 typedef typename product<Type, Form>::type productType; \ 726 tmp<Field<productType> > tRes = reuseTmp<productType, Type>::New(tf1); \ 727 OpFunc(tRes(), tf1(), static_cast<const Form&>(vs)); \ 728 reuseTmp<productType, Type>::clear(tf1); \ 732 template<class Form, class Cmpt, int nCmpt, class Type> \ 735 Field<typename product<Form, Type>::type>& res, \ 736 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 737 const UList<Type>& f1 \ 740 typedef typename product<Form, Type>::type productType; \ 741 TFOR_ALL_F_OP_S_OP_F \ 742 (productType, res, =,Form,static_cast<const Form&>(vs), Op, Type, f1) \ 745 template<class Form, class Cmpt, int nCmpt, class Type> \ 746 tmp<Field<typename product<Form, Type>::type> > \ 747 operator Op(const VectorSpace<Form,Cmpt,nCmpt>& vs, const UList<Type>& f1) \ 749 typedef typename product<Form, Type>::type productType; \ 750 tmp<Field<productType> > tRes(new Field<productType>(f1.size())); \ 751 OpFunc(tRes(), static_cast<const Form&>(vs), f1); \ 755 template<class Form, class Cmpt, int nCmpt, class Type> \ 756 tmp<Field<typename product<Form, Type>::type> > \ 759 const VectorSpace<Form,Cmpt,nCmpt>& vs, const tmp<Field<Type> >& tf1 \ 762 typedef typename product<Form, Type>::type productType; \ 763 tmp<Field<productType> > tRes = reuseTmp<productType, Type>::New(tf1); \ 764 OpFunc(tRes(), static_cast<const Form&>(vs), tf1()); \ 765 reuseTmp<productType, Type>::clear(tf1); \ 777 #undef PRODUCT_OPERATOR void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
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 ))
dimensioned< scalar > mag(const dimensioned< Type > &)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
#define TFOR_ALL_S_OP_F(typeS, s, OP, typeF, f)
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, 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.
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc)
scalar sumSqr(const UList< Type > &f)
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
#define TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
typeOfRank< typename pTraits< arg1 >::cmptType, int(pTraits< arg1 >::rank)+int(pTraits< arg2 >::rank) >::type type
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static tmp< Field< TypeR > > New(const tmp< Field< Type1 > > &tf1)
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
#define WarningIn(functionName)
Report a warning using Foam::Warning.
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
#define TFOR_ALL_F_OP_FUNC_F(typeF1, f1, OP, FUNC, typeF2, f2)
pTraits< Type >::cmptType cmptType
Component type.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define PRODUCT_OPERATOR(product, Op, OpFunc)
static int & msgType()
Message tag of standard messages.
label size() const
Return the number of elements in the UList.
#define TMP_UNARY_FUNCTION(ReturnType, Func)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Pre-declare SubField and related Field type.
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
scalar gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
Traits class for primitives.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Type gAverage(const FieldField< Field, Type > &f)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
static void clear(const tmp< Field< Type1 > > &tf1)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Type sumCmptProd(const UList< Type > &f1, const UList< Type > &f2)
Type gSumCmptProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dotdot(FieldField< Field1, typename scalarProduct< 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)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
scalar sumProd(const UList< Type > &f1, const UList< Type > &f2)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void sumReduce(T &Value, label &Count, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Type gMax(const FieldField< Field, Type > &f)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
A class for managing temporary objects.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *int(pTraits< arg1 >::rank) >::type type
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
#define TFOR_ALL_F_OP_FUNC_F_S(typeF1, f1, OP, FUNC, typeF2, f2, typeS, s)