Go to the documentation of this file.
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()); \
418 if (
f1.size() && (
f1.size() == f2.
size()))
420 scalar SumProd = 0.0;
434 if (
f1.size() && (
f1.size() == f2.
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
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
#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)
#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)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
static void clear(const tmp< Field< Type1 > > &tf1)
scalar gSumSqr(const UList< Type > &f, const label comm)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
A class for managing temporary objects.
#define TFOR_ALL_S_OP_FUNC_F_F(typeS, s, OP, FUNC, typeF1, f1, typeF2, f2)
Type gAverage(const FieldField< Field, Type > &f)
#define TMP_UNARY_FUNCTION(ReturnType, Func)
typeOfRank< typename pTraits< arg1 >::cmptType, int(pTraits< arg1 >::rank)+int(pTraits< arg2 >::rank) >::type type
#define TFOR_ALL_S_OP_F(typeS, s, OP, typeF, f)
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)
scalar sumSqr(const UList< Type > &f)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
dimensioned< scalar > mag(const dimensioned< Type > &)
#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)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *int(pTraits< arg1 >::rank) >::type type
#define TFOR_ALL_F_OP_F_FUNC(typeF1, f1, OP, typeF2, f2, FUNC)
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)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
#define TFOR_ALL_S_OP_FUNC_F(typeS, s, OP, FUNC, typeF, f)
static tmp< Field< TypeR > > New(const tmp< Field< Type1 > > &tf1)
#define PRODUCT_OPERATOR(product, Op, OpFunc)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh > &df)
void negate(FieldField< Field, Type > &res, 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)
#define TFOR_ALL_S_OP_F_OP_F(typeS, s, OP1, typeF1, f1, OP2, typeF2, f2)
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))
scalar gSumMag(const FieldField< Field, Type > &f)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
Type minMagSqr(const UList< Type > &f)
#define TFOR_ALL_F_OP_F_FUNC_S(typeF1, f1, OP, typeF2, f2, FUNC, typeS, s)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
static int & msgType()
Message tag of standard messages.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
Traits class for primitives.
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)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void size(const label)
Override size to be inconsistent with allocated storage.
void sumReduce(T &Value, label &Count, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
scalar gSumProd(const UList< Type > &f1, const UList< Type > &f2, const label comm)
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)
label size() const
Return the number of elements in the UList.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
scalar sumProd(const UList< Type > &f1, const UList< Type > &f2)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
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)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)