32 template<class Type, template<class> class PatchField, class GeoMesh> 42 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
61 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
64 GeometricField<Type, PatchField, GeoMesh>& result,
65 const GeometricField<Type, PatchField, GeoMesh>& f1
68 T(result.primitiveFieldRef(), f1.primitiveField());
69 T(result.boundaryFieldRef(), f1.boundaryField());
70 result.oriented() = f1.oriented();
77 template<
class>
class PatchField,
97 template<
class>
class PatchField,
118 pow<Type, r, PatchField, GeoMesh>(tres.ref(), f1);
127 template<
class>
class PatchField,
140 const auto& f1 = tf1();
150 pow<Type, r, PatchField, GeoMesh>(tres.ref(), f1);
157 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
164 const GeometricField<Type, PatchField, GeoMesh>& f1
173 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
191 "sqr(" + f1.
name() +
')',
201 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
215 const auto& f1 = tf1();
221 "sqr(" + f1.
name() +
')',
232 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
236 const GeometricField<Type, PatchField, GeoMesh>& f1
245 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
249 const GeometricField<Type, PatchField, GeoMesh>& f1
258 "magSqr(" + f1.name() +
')',
267 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
271 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1
274 auto tres =
magSqr(tf1.cref());
281 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
285 const GeometricField<Type, PatchField, GeoMesh>& f1
294 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
298 const GeometricField<Type, PatchField, GeoMesh>& f1
307 "mag(" + f1.name() +
')',
316 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
320 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1
323 auto tres =
mag(tf1.cref());
330 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
339 const GeometricField<Type, PatchField, GeoMesh>& f1
347 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
366 "cmptAv(" + f1.
name() +
')',
376 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
395 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(ReturnType, Func, BinaryOp) \ 397 template<class Type, template<class> class PatchField, class GeoMesh> \ 398 dimensioned<ReturnType> Func \ 400 const GeometricField<Type, PatchField, GeoMesh>& f1 \ 403 return dimensioned<ReturnType> \ 405 #Func "(" + f1.name() + ')', \ 411 Foam::Func(f1.primitiveField()), \ 412 Foam::Func(f1.boundaryField()) \ 414 BinaryOp<ReturnType>() \ 419 template<class Type, template<class> class PatchField, class GeoMesh> \ 420 dimensioned<ReturnType> Func \ 422 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1 \ 425 dimensioned<ReturnType> res = Func(tf1()); \ 435 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY 438 #define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc) \ 440 template<class Type, template<class> class PatchField, class GeoMesh> \ 441 dimensioned<ReturnType> Func \ 443 const GeometricField<Type, PatchField, GeoMesh>& f1 \ 446 return dimensioned<ReturnType> \ 448 #Func "(" + f1.name() + ')', \ 450 gFunc(f1.primitiveField()) \ 454 template<class Type, template<class> class PatchField, class GeoMesh> \ 455 dimensioned<ReturnType> Func \ 457 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1 \ 460 dimensioned<ReturnType> res = Func(tf1()); \ 469 #undef UNARY_REDUCTION_FUNCTION 487 template<class Type, template<class> class PatchField, class
GeoMesh>
497 clamp(result.primitiveFieldRef(), f1.primitiveField(),
range);
499 result.oriented() = f1.oriented();
502 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
503 tmp<GeometricField<Type, PatchField, GeoMesh>>
506 const GeometricField<Type, PatchField, GeoMesh>& f1,
514 "clamp01(" + f1.name() +
')',
524 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
525 tmp<GeometricField<Type, PatchField, GeoMesh>>
528 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1,
532 const auto& f1 = tf1();
538 "clamp01(" + f1.name() +
')',
573 #define PRODUCT_OPERATOR(product, Op, OpFunc) \ 576 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 580 <typename product<Type1, Type2>::type, PatchField, GeoMesh>& result, \ 581 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 582 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 587 result.primitiveFieldRef(), \ 588 f1.primitiveField(), \ 589 f2.primitiveField() \ 593 result.boundaryFieldRef(), \ 594 f1.boundaryField(), \ 598 result.oriented() = (f1.oriented() Op f2.oriented()); \ 603 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 606 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 610 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 611 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 614 typedef typename product<Type1, Type2>::type resultType; \ 617 reuseTmpGeometricField<resultType, Type1, PatchField, GeoMesh>::New \ 620 '(' + f1.name() + #Op + f2.name() + ')', \ 621 (f1.dimensions() Op f2.dimensions()) \ 624 Foam::OpFunc(tres.ref(), f1, f2); \ 631 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 634 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 638 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 639 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \ 642 typedef typename product<Type1, Type2>::type resultType; \ 644 const auto& f2 = tf2(); \ 647 reuseTmpGeometricField<resultType, Type2, PatchField, GeoMesh>::New \ 650 '(' + f1.name() + #Op + f2.name() + ')', \ 651 (f1.dimensions() Op f2.dimensions()) \ 654 Foam::OpFunc(tres.ref(), f1, f2); \ 661 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 664 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 668 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \ 669 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 672 typedef typename product<Type1, Type2>::type resultType; \ 674 const auto& f1 = tf1(); \ 677 reuseTmpGeometricField<resultType, Type1, PatchField, GeoMesh>::New \ 680 '(' + f1.name() + #Op + f2.name() + ')', \ 681 (f1.dimensions() Op f2.dimensions()) \ 684 Foam::OpFunc(tres.ref(), f1, f2); \ 691 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 694 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 698 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \ 699 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \ 702 typedef typename product<Type1, Type2>::type resultType; \ 704 const auto& f1 = tf1(); \ 705 const auto& f2 = tf2(); \ 708 reuseTmpTmpGeometricField \ 709 <resultType, Type1, Type1, Type2, PatchField, GeoMesh>::New \ 713 '(' + f1.name() + #Op + f2.name() + ')', \ 714 (f1.dimensions() Op f2.dimensions()) \ 717 Foam::OpFunc(tres.ref(), f1, f2); \ 725 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 729 <typename product<Type, Form>::type, PatchField, GeoMesh>& result, \ 730 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 731 const dimensioned<Form>& dvs \ 734 Foam::OpFunc(result.primitiveFieldRef(), f1.primitiveField(), dvs.value());\ 735 Foam::OpFunc(result.boundaryFieldRef(), f1.boundaryField(), dvs.value()); \ 736 result.oriented() = f1.oriented(); \ 740 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 741 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \ 744 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 745 const dimensioned<Form>& dvs \ 748 typedef typename product<Type, Form>::type resultType; \ 751 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 754 '(' + f1.name() + #Op + dvs.name() + ')', \ 755 (f1.dimensions() Op dvs.dimensions()) \ 758 Foam::OpFunc(tres.ref(), f1, dvs); \ 768 class Type, template<class> class PatchField, \ 771 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 774 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 775 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 778 return f1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 783 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 784 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \ 787 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 788 const dimensioned<Form>& dvs \ 791 typedef typename product<Type, Form>::type resultType; \ 793 const auto& f1 = tf1(); \ 796 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 799 '(' + f1.name() + #Op + dvs.name() + ')', \ 800 (f1.dimensions() Op dvs.dimensions()) \ 803 Foam::OpFunc(tres.ref(), f1, dvs); \ 814 class Type, template<class> class PatchField, \ 817 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 820 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 821 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 824 return tf1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 829 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 833 <typename product<Form, Type>::type, PatchField, GeoMesh>& result, \ 834 const dimensioned<Form>& dvs, \ 835 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 838 Foam::OpFunc(result.primitiveFieldRef(), dvs.value(), f2.primitiveField());\ 839 Foam::OpFunc(result.boundaryFieldRef(), dvs.value(), f2.boundaryField()); \ 840 result.oriented() = f2.oriented(); \ 844 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 845 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 848 const dimensioned<Form>& dvs, \ 849 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 852 typedef typename product<Form, Type>::type resultType; \ 855 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 858 '(' + dvs.name() + #Op + f2.name() + ')', \ 859 (dvs.dimensions() Op f2.dimensions()) \ 862 Foam::OpFunc(tres.ref(), dvs, f2); \ 872 class Type, template<class> class PatchField, \ 875 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 878 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 879 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 882 return dimensioned<Form>(static_cast<const Form&>(vs)) Op f2; \ 886 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 887 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 890 const dimensioned<Form>& dvs, \ 891 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf2 \ 894 typedef typename product<Form, Type>::type resultType; \ 896 const auto& f2 = tf2(); \ 899 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 902 '(' + dvs.name() + #Op + f2.name() + ')', \ 903 (dvs.dimensions() Op f2.dimensions()) \ 906 Foam::OpFunc(tres.ref(), dvs, f2); \ 917 class Type, template<class> class PatchField, \ 920 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 923 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 924 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf2 \ 927 return dimensioned<Form>(static_cast<const Form&>(vs)) Op tf2; \ 939 #undef PRODUCT_OPERATOR dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
#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)
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
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)
const word & name() const noexcept
Return the object name.
Field< Type >::cmptType cmptType
Component type of the field elements.
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)
orientedType oriented() const noexcept
Return oriented type.
#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
Generic GeometricField class.
#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)
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 > &)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func)
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static tmp< GeometricField< TypeR, PatchField, GeoMesh > > New(const GeometricField< Type1, PatchField, GeoMesh > &f1, const word &name, const dimensionSet &dimensions)
Pass-through to New GeometricField.
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 > &)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
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)
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void clear()
Clear exponents - resets to be dimensionless.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1)
Type gAverage(const FieldField< Field, Type > &f)
#define PRODUCT_OPERATOR(product, Op, OpFunc)
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
BINARY_TYPE_FUNCTION_FS(Type, Type, MinMax< Type >, clip)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define TERNARY_TYPE_FUNCTION_FFS(ReturnType, Type1, Type2, Type3, Func)
#define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc)
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
A class for managing temporary objects.
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
#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)
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(ReturnType, Func, BinaryOp)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
const dimensionSet & dimensions() const noexcept
Return dimensions.
pTraits< typename pTraits< arg1 >::cmptType >::magType type