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>
97 pow<Type, r>(tres.ref(),
f);
101 template<
template<
class>
class Field,
class Type,
direction r>
112 pow<Type, r>(tres.ref(), tf());
118 template<
template<
class>
class Field,
class Type>
122 const FieldField<Field, Type>& vf
125 const label loopLen = (
f).size();
127 for (label i = 0; i < loopLen; ++i)
133 template<
template<
class>
class Field,
class Type>
135 sqr(
const FieldField<Field, Type>&
f)
145 template<
template<
class>
class Field,
class Type>
147 sqr(
const tmp<FieldField<Field, Type>>& tf)
153 sqr(tres.ref(), tf());
159 template<
template<
class>
class Field,
class Type>
163 const FieldField<Field, Type>&
f 166 const label loopLen = (sf).size();
168 for (label i = 0; i < loopLen; ++i)
174 template<
template<
class>
class Field,
class Type>
176 magSqr(
const FieldField<Field, Type>&
f)
186 template<
template<
class>
class Field,
class Type>
188 magSqr(
const tmp<FieldField<Field, Type>>& tf)
200 template<
template<
class>
class Field,
class Type>
204 const FieldField<Field, Type>&
f 207 const label loopLen = (sf).size();
209 for (label i = 0; i < loopLen; ++i)
215 template<
template<
class>
class Field,
class Type>
217 mag(
const FieldField<Field, Type>&
f)
227 template<
template<
class>
class Field,
class Type>
229 mag(
const tmp<FieldField<Field, Type>>& tf)
235 mag(tres.ref(), tf());
241 template<
template<
class>
class Field,
class Type>
245 const FieldField<Field, Type>&
f 248 const label loopLen = (cf).size();
250 for (label i = 0; i < loopLen; ++i)
256 template<
template<
class>
class Field,
class Type>
257 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMax 259 const FieldField<Field, Type>&
f 270 template<
template<
class>
class Field,
class Type>
271 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMax 273 const tmp<FieldField<Field, Type>>& tf
286 template<
template<
class>
class Field,
class Type>
290 const FieldField<Field, Type>&
f 293 const label loopLen = (cf).size();
295 for (label i = 0; i < loopLen; ++i)
301 template<
template<
class>
class Field,
class Type>
302 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMin 304 const FieldField<Field, Type>&
f 315 template<
template<
class>
class Field,
class Type>
316 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptMin 318 const tmp<FieldField<Field, Type>>& tf
331 template<
template<
class>
class Field,
class Type>
335 const FieldField<Field, Type>&
f 338 const label loopLen = (cf).size();
340 for (label i = 0; i < loopLen; ++i)
346 template<
template<
class>
class Field,
class Type>
347 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptAv 349 const FieldField<Field, Type>&
f 360 template<
template<
class>
class Field,
class Type>
361 tmp<FieldField<Field, typename FieldField<Field, Type>::cmptType>>
cmptAv 363 const tmp<FieldField<Field, Type>>& tf
376 template<
template<
class>
class Field,
class Type>
379 FieldField<Field, Type>& cf,
380 const FieldField<Field, Type>&
f 383 const label loopLen = (cf).size();
385 for (label i = 0; i < loopLen; ++i)
391 template<
template<
class>
class Field,
class Type>
392 tmp<FieldField<Field, Type>>
cmptMag 394 const FieldField<Field, Type>&
f 403 template<
template<
class>
class Field,
class Type>
404 tmp<FieldField<Field, Type>>
cmptMag 406 const tmp<FieldField<Field, Type>>& tf
409 tmp<FieldField<Field, Type>> tres(
New(tf));
416 #define TMP_UNARY_FUNCTION(ReturnType, Func) \ 418 template<template<class> class Field, class Type> \ 419 ReturnType Func(const tmp<FieldField<Field, Type>>& tf1) \ 421 ReturnType res = Func(tf1()); \ 426 template<
template<
class>
class Field,
class Type>
431 const label loopLen = (
f).size();
433 for (label i = 0; i < loopLen; ++i)
437 result =
max(
max(
f[i]), result);
448 template<
template<
class>
class Field,
class Type>
449 Type
min(
const FieldField<Field, Type>&
f)
453 const label loopLen = (
f).size();
455 for (label i = 0; i < loopLen; ++i)
469 template<
template<
class>
class Field,
class Type>
470 Type
sum(
const FieldField<Field, Type>&
f)
474 const label loopLen = (
f).size();
476 for (label i = 0; i < loopLen; ++i)
486 template<
template<
class>
class Field,
class Type>
491 resultType result =
Zero;
493 const label loopLen = (
f).size();
495 for (label i = 0; i < loopLen; ++i)
505 template<
template<
class>
class Field,
class Type>
506 Type
average(
const FieldField<Field, Type>&
f)
511 const label loopLen = (
f).size();
513 for (label i = 0; i < loopLen; ++i)
515 const label
n =
f[i].
size();
529 <<
"empty fieldField, returning zero" <<
endl;
537 template<
template<
class>
class Field,
class Type>
538 MinMax<Type>
minMax(
const FieldField<Field, Type>&
f)
542 const label loopLen = (
f).size();
544 for (label i = 0; i < loopLen; ++i)
554 template<
template<
class>
class Field,
class Type>
559 const label loopLen = (
f).size();
561 for (label i = 0; i < loopLen; ++i)
573 #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \ 575 template<template<class> class Field, class Type> \ 576 ReturnType gFunc(const FieldField<Field, Type>& f) \ 578 ReturnType res = Func(f); \ 579 reduce(res, rFunc##Op<ReturnType>()); \ 582 TMP_UNARY_FUNCTION(ReturnType, gFunc) 592 #undef G_UNARY_FUNCTION 595 template<
template<
class>
class Field,
class Type>
605 const label loopLen = (
f).size();
607 for (label i = 0; i < loopLen; ++i)
609 const label
n =
f[i].
size();
629 <<
"Empty FieldField, returning zero" <<
endl;
636 #undef TMP_UNARY_FUNCTION 675 #define PRODUCT_OPERATOR(product, Op, OpFunc) \ 679 template<class> class Field1, \ 680 template<class> class Field2, \ 686 FieldField<Field1, typename product<Type1, Type2>::type>& f, \ 687 const FieldField<Field1, Type1>& f1, \ 688 const FieldField<Field2, Type2>& f2 \ 691 const label loopLen = (f).size(); \ 693 for (label i = 0; i < loopLen; ++i) \ 695 OpFunc(f[i], f1[i], f2[i]); \ 701 template<class> class Field1, \ 702 template<class> class Field2, \ 706 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \ 709 const FieldField<Field1, Type1>& f1, \ 710 const FieldField<Field2, Type2>& f2 \ 713 typedef typename product<Type1, Type2>::type resultType; \ 714 auto tres = FieldField<Field1, resultType>::NewCalculatedType(f1); \ 715 OpFunc(tres.ref(), f1, f2); \ 719 template<template<class> class Field, class Type1, class Type2> \ 720 tmp<FieldField<Field, typename product<Type1, Type2>::type>> \ 723 const FieldField<Field, Type1>& f1, \ 724 const tmp<FieldField<Field, Type2>>& tf2 \ 727 typedef typename product<Type1, Type2>::type resultType; \ 728 auto tres = reuseTmpFieldField<Field, resultType, Type2>::New(tf2); \ 729 OpFunc(tres.ref(), f1, tf2()); \ 736 template<class> class Field1, \ 737 template<class> class Field2, \ 741 tmp<FieldField<Field, typename product<Type1, Type2>::type>> \ 744 const FieldField<Field1, Type1>& f1, \ 745 const tmp<FieldField<Field2, Type2>>& tf2 \ 748 typedef typename product<Type1, Type2>::type resultType; \ 749 auto tres = FieldField<Field1, resultType>::NewCalculatedType(f1); \ 750 OpFunc(tres.ref(), f1, tf2()); \ 757 template<class> class Field1, \ 758 template<class> class Field2, \ 762 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \ 765 const tmp<FieldField<Field1, Type1>>& tf1, \ 766 const FieldField<Field2, Type2>& f2 \ 769 typedef typename product<Type1, Type2>::type resultType; \ 770 auto tres = reuseTmpFieldField<Field1, resultType, Type1>::New(tf1); \ 771 OpFunc(tres.ref(), tf1(), f2); \ 778 template<class> class Field1, \ 779 template<class> class Field2, \ 783 tmp<FieldField<Field1, typename product<Type1, Type2>::type>> \ 786 const tmp<FieldField<Field1, Type1>>& tf1, \ 787 const tmp<FieldField<Field2, Type2>>& tf2 \ 790 typedef typename product<Type1, Type2>::type resultType; \ 793 reuseTmpTmpFieldField<Field1, resultType, Type1, Type1, Type2>::New \ 796 OpFunc(tres.ref(), tf1(), tf2()); \ 804 template<class> class Field, \ 812 FieldField<Field, typename product<Type, Form>::type>& result, \ 813 const FieldField<Field, Type>& f1, \ 814 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 817 const label loopLen = (result).size(); \ 819 for (label i = 0; i < loopLen; ++i) \ 821 OpFunc(result[i], f1[i], vs); \ 827 template<class> class Field, \ 833 tmp<FieldField<Field, typename product<Type, Form>::type>> \ 836 const FieldField<Field, Type>& f1, \ 837 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 840 typedef typename product<Type, Form>::type resultType; \ 841 auto tres = FieldField<Field, resultType>::NewCalculatedType(f1); \ 842 OpFunc(tres.ref(), f1, static_cast<const Form&>(vs)); \ 848 template<class> class Field, \ 854 tmp<FieldField<Field, typename product<Type, Form>::type>> \ 857 const tmp<FieldField<Field, Type>>& tf1, \ 858 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 861 typedef typename product<Type, Form>::type resultType; \ 862 auto tres = reuseTmpFieldField<Field, resultType, Type>::New(tf1); \ 863 OpFunc(tres.ref(), tf1(), static_cast<const Form&>(vs)); \ 870 template<class> class Field, \ 878 FieldField<Field, typename product<Form, Type>::type>& result, \ 879 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 880 const FieldField<Field, Type>& f1 \ 883 const label loopLen = (result).size(); \ 885 for (label i = 0; i < loopLen; ++i) \ 887 OpFunc(result[i], vs, f1[i]); \ 893 template<class> class Field, \ 899 tmp<FieldField<Field, typename product<Form, Type>::type>> \ 902 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 903 const FieldField<Field, Type>& f1 \ 906 typedef typename product<Form, Type>::type resultType; \ 907 auto tres = FieldField<Field, resultType>::NewCalculatedType(f1); \ 908 OpFunc(tres.ref(), static_cast<const Form&>(vs), f1); \ 914 template<class> class Field, \ 920 tmp<FieldField<Field, typename product<Form, Type>::type>> \ 923 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 924 const tmp<FieldField<Field, Type>>& tf1 \ 927 typedef typename product<Form, Type>::type resultType; \ 928 auto tres = reuseTmpFieldField<Field, resultType, Type>::New(tf1); \ 929 OpFunc(tres.ref(), static_cast<const Form&>(vs), tf1()); \ 942 #undef PRODUCT_OPERATOR 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 divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
Inter-processor communication reduction functions.
MinMax< scalar > scalarMinMax
A scalar min/max range.
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh >> cmptAv(const DimensionedField< Type, GeoMesh > &f1)
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 and vector-space.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
#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)
static int & msgType() noexcept
Message tag of standard messages.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
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)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
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 > &)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Type gSum(const FieldField< Field, Type > &f)
Generic templated field type.
Type max(const tmp< FieldField< Field, Type >> &tf1)
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
#define TMP_UNARY_FUNCTION(ReturnType, Func)
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
void negate(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1)
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 gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
Type gMax(const FieldField< Field, Type > &f)
#define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc)
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
#define PRODUCT_OPERATOR(product, Op, OpFunc)
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
pTraits< Type >::cmptType cmptType
Component type.
#define WarningInFunction
Report a warning using Foam::Warning.
void sumReduce(T &value, CountType &count, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) the sum of value and counter (eg, for averaging) ...
static tmp< FieldField< Field, TypeR > > New(const FieldField< Field, Type1 > &f1)
Pass-through to NewCalculatedType.
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define TERNARY_TYPE_FUNCTION_FFS(ReturnType, Type1, Type2, Type3, Func)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
#define TERNARY_FUNCTION(ReturnType, Type1, Type2, Type3, Func)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
pTraits< typename pTraits< arg1 >::cmptType >::magType type
static constexpr const zero Zero
Global zero (0)