32 #define TEMPLATE template<template<class> class Field, class Type> 42 template<
template<
class>
class Field,
class Type>
50 const label loopLen = (sf).size();
52 for (label i = 0; i < loopLen; ++i)
59 template<
template<
class>
class Field,
class Type>
60 void T(FieldField<Field, Type>& f1,
const FieldField<Field, Type>& f2)
62 const label loopLen = (f1).size();
64 for (label i = 0; i < loopLen; ++i)
71 template<
template<
class>
class Field,
class Type,
direction r>
75 const FieldField<Field, Type>& vf
78 const label loopLen = (
f).size();
80 for (label i = 0; i < loopLen; ++i)
86 template<
template<
class>
class Field,
class Type,
direction r>
100 pow<Type, r>(tres.ref(),
f);
104 template<
template<
class>
class Field,
class Type,
direction r>
118 pow<Type, r>(tres.ref(), tf());
124 template<
template<
class>
class Field,
class Type>
128 const FieldField<Field, Type>& vf
131 const label loopLen = (
f).size();
133 for (label i = 0; i < loopLen; ++i)
139 template<
template<
class>
class Field,
class Type>
141 sqr(
const FieldField<Field, Type>&
f)
144 tmp<FieldField<Field, outerProductType>> tres
152 template<
template<
class>
class Field,
class Type>
154 sqr(
const tmp<FieldField<Field, Type>>& tf)
163 sqr(tres.ref(), tf());
169 template<
template<
class>
class Field,
class Type>
173 const FieldField<Field, Type>&
f 176 const label loopLen = (sf).size();
178 for (label i = 0; i < loopLen; ++i)
184 template<
template<
class>
class Field,
class Type>
186 magSqr(
const FieldField<Field, Type>&
f)
199 template<
template<
class>
class Field,
class Type>
201 magSqr(
const tmp<FieldField<Field, Type>>& tf)
216 template<
template<
class>
class Field,
class Type>
220 const FieldField<Field, Type>&
f 223 const label loopLen = (sf).size();
225 for (label i = 0; i < loopLen; ++i)
231 template<
template<
class>
class Field,
class Type>
233 mag(
const FieldField<Field, Type>&
f)
246 template<
template<
class>
class Field,
class Type>
248 mag(
const tmp<FieldField<Field, Type>>& tf)
257 mag(tres.ref(), tf());
263 template<
template<
class>
class Field,
class Type>
267 const FieldField<Field, Type>&
f 270 const label loopLen = (cf).size();
272 for (label i = 0; i < loopLen; ++i)
278 template<
template<
class>
class Field,
class Type>
279 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMax 281 const FieldField<Field, Type>&
f 295 template<
template<
class>
class Field,
class Type>
296 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMax 298 const tmp<FieldField<Field, Type>>& tf
314 template<
template<
class>
class Field,
class Type>
318 const FieldField<Field, Type>&
f 321 const label loopLen = (cf).size();
323 for (label i = 0; i < loopLen; ++i)
329 template<
template<
class>
class Field,
class Type>
330 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMin 332 const FieldField<Field, Type>&
f 346 template<
template<
class>
class Field,
class Type>
347 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMin 349 const tmp<FieldField<Field, Type>>& tf
365 template<
template<
class>
class Field,
class Type>
369 const FieldField<Field, Type>&
f 372 const label loopLen = (cf).size();
374 for (label i = 0; i < loopLen; ++i)
380 template<
template<
class>
class Field,
class Type>
381 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptAv 383 const FieldField<Field, Type>&
f 397 template<
template<
class>
class Field,
class Type>
398 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptAv 400 const tmp<FieldField<Field, Type>>& tf
416 template<
template<
class>
class Field,
class Type>
419 FieldField<Field, Type>& cf,
420 const FieldField<Field, Type>&
f 423 const label loopLen = (cf).size();
425 for (label i = 0; i < loopLen; ++i)
431 template<
template<
class>
class Field,
class Type>
432 tmp<FieldField<Field, Type>>
cmptMag 434 const FieldField<Field, Type>&
f 446 template<
template<
class>
class Field,
class Type>
447 tmp<FieldField<Field, Type>>
cmptMag 449 const tmp<FieldField<Field, Type>>& tf
452 tmp<FieldField<Field, Type>> tres(
New(tf));
459 #define TMP_UNARY_FUNCTION(returnType, func) \ 461 template<template<class> class Field, class Type> \ 462 returnType func(const tmp<FieldField<Field, Type>>& tf1) \ 464 returnType res = func(tf1()); \ 469 template<
template<
class>
class Field,
class Type>
474 const label loopLen = (
f).size();
476 for (label i = 0; i < loopLen; ++i)
480 result =
max(
max(
f[i]), result);
491 template<
template<
class>
class Field,
class Type>
492 Type
min(
const FieldField<Field, Type>&
f)
496 const label loopLen = (
f).size();
498 for (label i = 0; i < loopLen; ++i)
512 template<
template<
class>
class Field,
class Type>
513 Type
sum(
const FieldField<Field, Type>&
f)
517 const label loopLen = (
f).size();
519 for (label i = 0; i < loopLen; ++i)
529 template<
template<
class>
class Field,
class Type>
534 magType result =
Zero;
536 const label loopLen = (
f).size();
538 for (label i = 0; i < loopLen; ++i)
548 template<
template<
class>
class Field,
class Type>
549 Type
average(
const FieldField<Field, Type>&
f)
553 const label loopLen = (
f).size();
555 for (label i = 0; i < loopLen; ++i)
562 Type avrg =
sum(
f)/
n;
568 <<
"empty fieldField, returning zero" <<
endl;
576 template<
template<
class>
class Field,
class Type>
577 MinMax<Type>
minMax(
const FieldField<Field, Type>&
f)
581 const label loopLen = (
f).size();
583 for (label i = 0; i < loopLen; ++i)
593 template<
template<
class>
class Field,
class Type>
598 const label loopLen = (
f).size();
600 for (label i = 0; i < loopLen; ++i)
612 #define G_UNARY_FUNCTION(ReturnType, gFunc, func, rFunc) \ 614 template<template<class> class Field, class Type> \ 615 ReturnType gFunc(const FieldField<Field, Type>& f) \ 617 ReturnType res = func(f); \ 618 reduce(res, rFunc##Op<ReturnType>()); \ 621 TMP_UNARY_FUNCTION(ReturnType, gFunc) 631 #undef G_UNARY_FUNCTION 634 template<
template<
class>
class Field,
class Type>
639 const label loopLen = (
f).size();
641 for (label i = 0; i < loopLen; ++i)
656 <<
"empty fieldField, returning zero" <<
endl;
663 #undef TMP_UNARY_FUNCTION 695 #define PRODUCT_OPERATOR(product, op, opFunc) \ 699 template<class> class Field1, \ 700 template<class> class Field2, \ 706 FieldField<Field1, typename product<Type1, Type2>::type>& f, \ 707 const FieldField<Field1, Type1>& f1, \ 708 const FieldField<Field2, Type2>& f2 \ 711 const label loopLen = (f).size(); \ 713 for (label i = 0; i < loopLen; ++i) \ 715 opFunc(f[i], f1[i], f2[i]); \ 721 template<class> class Field1, \ 722 template<class> class Field2, \ 726 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \ 729 const FieldField<Field1, Type1>& f1, \ 730 const FieldField<Field2, Type2>& f2 \ 733 typedef typename product<Type1, Type2>::type productType; \ 734 tmp<FieldField<Field1, productType>> tres \ 736 FieldField<Field1, productType>::NewCalculatedType(f1) \ 738 opFunc(tres.ref(), f1, f2); \ 742 template<template<class> class Field, class Type1, class Type2> \ 743 tmp<FieldField<Field, typename product<Type1, Type2>::type>> \ 746 const FieldField<Field, Type1>& f1, \ 747 const tmp<FieldField<Field, Type2>>& tf2 \ 750 typedef typename product<Type1, Type2>::type productType; \ 751 tmp<FieldField<Field, productType>> tres \ 753 reuseTmpFieldField<Field, productType, Type2>::New(tf2) \ 755 opFunc(tres.ref(), f1, tf2()); \ 762 template<class> class Field1, \ 763 template<class> class Field2, \ 767 tmp<FieldField<Field, typename product<Type1, Type2>::type>> \ 770 const FieldField<Field1, Type1>& f1, \ 771 const tmp<FieldField<Field2, Type2>>& tf2 \ 774 typedef typename product<Type1, Type2>::type productType; \ 775 tmp<FieldField<Field1, productType>> tres \ 777 FieldField<Field1, productType>::NewCalculatedType(f1) \ 779 opFunc(tres.ref(), f1, tf2()); \ 786 template<class> class Field1, \ 787 template<class> class Field2, \ 791 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \ 794 const tmp<FieldField<Field1, Type1>>& tf1, \ 795 const FieldField<Field2, Type2>& f2 \ 798 typedef typename product<Type1, Type2>::type productType; \ 799 tmp<FieldField<Field1, productType>> tres \ 801 reuseTmpFieldField<Field1, productType, Type1>::New(tf1) \ 803 opFunc(tres.ref(), tf1(), f2); \ 810 template<class> class Field1, \ 811 template<class> class Field2, \ 815 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \ 818 const tmp<FieldField<Field1, Type1>>& tf1, \ 819 const tmp<FieldField<Field2, Type2>>& tf2 \ 822 typedef typename product<Type1, Type2>::type productType; \ 823 tmp<FieldField<Field1, productType>> tres \ 825 reuseTmpTmpFieldField<Field1, productType, Type1, Type1, Type2>::New \ 828 opFunc(tres.ref(), tf1(), tf2()); \ 836 template<class> class Field, \ 844 FieldField<Field, typename product<Type, Form>::type>& f, \ 845 const FieldField<Field, Type>& f1, \ 846 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 849 const label loopLen = (f).size(); \ 851 for (label i = 0; i < loopLen; ++i) \ 853 opFunc(f[i], f1[i], vs); \ 859 template<class> class Field, \ 865 tmp<FieldField<Field, typename product<Type, Form>::type>> \ 868 const FieldField<Field, Type>& f1, \ 869 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 872 typedef typename product<Type, Form>::type productType; \ 873 tmp<FieldField<Field, productType>> tres \ 875 FieldField<Field, productType>::NewCalculatedType(f1) \ 877 opFunc(tres.ref(), f1, static_cast<const Form&>(vs)); \ 883 template<class> class Field, \ 889 tmp<FieldField<Field, typename product<Type, Form>::type>> \ 892 const tmp<FieldField<Field, Type>>& tf1, \ 893 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 896 typedef typename product<Type, Form>::type productType; \ 897 tmp<FieldField<Field, productType>> tres \ 899 reuseTmpFieldField<Field, productType, Type>::New(tf1) \ 901 opFunc(tres.ref(), tf1(), static_cast<const Form&>(vs)); \ 908 template<class> class Field, \ 916 FieldField<Field, typename product<Form, Type>::type>& f, \ 917 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 918 const FieldField<Field, Type>& f1 \ 921 const label loopLen = (f).size(); \ 923 for (label i = 0; i < loopLen; ++i) \ 925 opFunc(f[i], vs, f1[i]); \ 931 template<class> class Field, \ 937 tmp<FieldField<Field, typename product<Form, Type>::type>> \ 940 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 941 const FieldField<Field, Type>& f1 \ 944 typedef typename product<Form, Type>::type productType; \ 945 tmp<FieldField<Field, productType>> tres \ 947 FieldField<Field, productType>::NewCalculatedType(f1) \ 949 opFunc(tres.ref(), static_cast<const Form&>(vs), f1); \ 955 template<class> class Field, \ 961 tmp<FieldField<Field, typename product<Form, Type>::type>> \ 964 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 965 const tmp<FieldField<Field, Type>>& tf1 \ 968 typedef typename product<Form, Type>::type productType; \ 969 tmp<FieldField<Field, productType>> tres \ 971 reuseTmpFieldField<Field, productType, Type>::New(tf1) \ 973 opFunc(tres.ref(), static_cast<const Form&>(vs), tf1()); \ 986 #undef PRODUCT_OPERATOR void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
void size(const label n)
Older name for setAddressableSize.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void multiply(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Inter-processor communication reduction functions.
MinMax< scalar > scalarMinMax
A scalar min/max range.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Type gMin(const FieldField< Field, Type > &f)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A min/max value pair with additional methods. In addition to conveniently storing values...
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives.
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
The magnitude type for given argument.
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
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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)
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)
A field of fields is a PtrList of fields with reference counting.
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
#define G_UNARY_FUNCTION(ReturnType, gFunc, func, rFunc)
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Type gSum(const FieldField< Field, Type > &f)
Generic templated field type.
dimensionSet clip(const dimensionSet &ds1, const dimensionSet &ds2)
#define TMP_UNARY_FUNCTION(returnType, func)
Type max(const tmp< FieldField< Field, Type >> &tf1)
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
static tmp< FieldField< Field, Type > > NewCalculatedType(const FieldField< Field, Type2 > &ff)
Return a pointer to a new calculatedFvPatchFieldField created on.
void cmptMag(FieldField< Field, Type > &cf, 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)
Type gMax(const FieldField< Field, Type > &f)
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &df)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
#define PRODUCT_OPERATOR(product, op, opFunc)
void negate(FieldField< Field, Type > &res, const FieldField< Field, Type > &f)
pTraits< Type >::cmptType cmptType
Component type.
#define WarningInFunction
Report a warning using Foam::Warning.
Type gAverage(const FieldField< Field, Type > &f)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
static tmp< FieldField< Field, TypeR > > New(const tmp< FieldField< Field, Type1 >> &tf1)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &df)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
pTraits< typename pTraits< arg1 >::cmptType >::magType type
static constexpr const zero Zero
Global zero (0)