32 template<class Type, template<class> class PatchField, class GeoMesh> 42 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
65 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
68 GeometricField<Type, PatchField, GeoMesh>& result,
69 const GeometricField<Type, PatchField, GeoMesh>& f1
72 T(result.primitiveFieldRef(), f1.primitiveField());
73 T(result.boundaryFieldRef(), f1.boundaryField());
74 result.oriented() = f1.oriented();
77 result.boundaryField().check();
85 template<
class>
class PatchField,
110 template<
class>
class PatchField,
131 pow<Type, r, PatchField, GeoMesh>(tres.ref(), f1);
140 template<
class>
class PatchField,
153 const auto& f1 = tf1();
163 pow<Type, r, PatchField, GeoMesh>(tres.ref(), f1);
170 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
177 const GeometricField<Type, PatchField, GeoMesh>& f1
191 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
209 "sqr(" + f1.
name() +
')',
219 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
233 const auto& f1 = tf1();
239 "sqr(" + f1.
name() +
')',
250 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
254 const GeometricField<Type, PatchField, GeoMesh>& f1
268 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
272 const GeometricField<Type, PatchField, GeoMesh>& f1
281 "magSqr(" + f1.name() +
')',
290 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
294 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1
297 auto tres =
magSqr(tf1.cref());
304 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
308 const GeometricField<Type, PatchField, GeoMesh>& f1
322 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
326 const GeometricField<Type, PatchField, GeoMesh>& f1
335 "mag(" + f1.name() +
')',
344 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
348 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1
351 auto tres =
mag(tf1.cref());
358 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
367 const GeometricField<Type, PatchField, GeoMesh>& f1
379 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
398 "cmptAv(" + f1.
name() +
')',
408 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
427 #define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(ReturnType, Func, BinaryOp) \ 429 template<class Type, template<class> class PatchField, class GeoMesh> \ 430 dimensioned<ReturnType> Func \ 432 const GeometricField<Type, PatchField, GeoMesh>& f1 \ 435 return dimensioned<ReturnType> \ 437 #Func "(" + f1.name() + ')', \ 443 Foam::Func(f1.primitiveField()), \ 444 Foam::Func(f1.boundaryField()) \ 446 BinaryOp<ReturnType>() \ 451 template<class Type, template<class> class PatchField, class GeoMesh> \ 452 dimensioned<ReturnType> Func \ 454 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1 \ 457 dimensioned<ReturnType> res = Func(tf1()); \ 467 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY 470 #define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc) \ 472 template<class Type, template<class> class PatchField, class GeoMesh> \ 473 dimensioned<ReturnType> Func \ 475 const GeometricField<Type, PatchField, GeoMesh>& f1 \ 478 return dimensioned<ReturnType> \ 480 #Func "(" + f1.name() + ')', \ 482 gFunc(f1.primitiveField()) \ 486 template<class Type, template<class> class PatchField, class GeoMesh> \ 487 dimensioned<ReturnType> Func \ 489 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1 \ 492 dimensioned<ReturnType> res = Func(tf1()); \ 501 #undef UNARY_REDUCTION_FUNCTION 519 template<class Type, template<class> class PatchField, class
GeoMesh>
529 clamp(result.primitiveFieldRef(), f1.primitiveField(),
range);
530 clamp(result.boundaryFieldRef(), f1.boundaryField(),
range);
531 result.oriented() = f1.oriented();
532 result.correctLocalBoundaryConditions();
535 result.boundaryField().check();
539 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
540 tmp<GeometricField<Type, PatchField, GeoMesh>>
543 const GeometricField<Type, PatchField, GeoMesh>& f1,
551 "clamp01(" + f1.name() +
')',
561 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
562 tmp<GeometricField<Type, PatchField, GeoMesh>>
565 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1,
569 const auto& f1 = tf1();
575 "clamp01(" + f1.name() +
')',
610 #define PRODUCT_OPERATOR(product, Op, OpFunc) \ 613 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 617 <typename product<Type1, Type2>::type, PatchField, GeoMesh>& result, \ 618 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 619 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 624 result.primitiveFieldRef(), \ 625 f1.primitiveField(), \ 626 f2.primitiveField() \ 630 result.boundaryFieldRef(), \ 631 f1.boundaryField(), \ 635 result.oriented() = (f1.oriented() Op f2.oriented()); \ 636 result.correctLocalBoundaryConditions(); \ 637 if (GeometricBoundaryField<Type1, PatchField, GeoMesh>::debug) \ 639 result.boundaryField().check(); \ 645 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 648 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 652 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 653 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 656 typedef typename product<Type1, Type2>::type resultType; \ 659 reuseTmpGeometricField<resultType, Type1, PatchField, GeoMesh>::New \ 662 '(' + f1.name() + #Op + f2.name() + ')', \ 663 (f1.dimensions() Op f2.dimensions()) \ 666 Foam::OpFunc(tres.ref(), f1, f2); \ 673 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 676 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 680 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 681 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \ 684 typedef typename product<Type1, Type2>::type resultType; \ 686 const auto& f2 = tf2(); \ 689 reuseTmpGeometricField<resultType, Type2, PatchField, GeoMesh>::New \ 692 '(' + f1.name() + #Op + f2.name() + ')', \ 693 (f1.dimensions() Op f2.dimensions()) \ 696 Foam::OpFunc(tres.ref(), f1, f2); \ 703 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 706 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 710 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \ 711 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 714 typedef typename product<Type1, Type2>::type resultType; \ 716 const auto& f1 = tf1(); \ 719 reuseTmpGeometricField<resultType, Type1, PatchField, GeoMesh>::New \ 722 '(' + f1.name() + #Op + f2.name() + ')', \ 723 (f1.dimensions() Op f2.dimensions()) \ 726 Foam::OpFunc(tres.ref(), f1, f2); \ 733 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 736 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 740 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \ 741 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \ 744 typedef typename product<Type1, Type2>::type resultType; \ 746 const auto& f1 = tf1(); \ 747 const auto& f2 = tf2(); \ 750 reuseTmpTmpGeometricField \ 751 <resultType, Type1, Type1, Type2, PatchField, GeoMesh>::New \ 755 '(' + f1.name() + #Op + f2.name() + ')', \ 756 (f1.dimensions() Op f2.dimensions()) \ 759 Foam::OpFunc(tres.ref(), f1, f2); \ 767 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 771 <typename product<Type, Form>::type, PatchField, GeoMesh>& result, \ 772 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 773 const dimensioned<Form>& dvs \ 776 Foam::OpFunc(result.primitiveFieldRef(), f1.primitiveField(), dvs.value());\ 777 Foam::OpFunc(result.boundaryFieldRef(), f1.boundaryField(), dvs.value()); \ 778 result.oriented() = f1.oriented(); \ 779 if (GeometricBoundaryField<Type, PatchField, GeoMesh>::debug) \ 781 result.boundaryField().check(); \ 786 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 787 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \ 790 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 791 const dimensioned<Form>& dvs \ 794 typedef typename product<Type, Form>::type resultType; \ 797 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 800 '(' + f1.name() + #Op + dvs.name() + ')', \ 801 (f1.dimensions() Op dvs.dimensions()) \ 804 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 GeometricField<Type, PatchField, GeoMesh>& f1, \ 821 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 824 return f1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 829 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 830 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \ 833 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 834 const dimensioned<Form>& dvs \ 837 typedef typename product<Type, Form>::type resultType; \ 839 const auto& f1 = tf1(); \ 842 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 845 '(' + f1.name() + #Op + dvs.name() + ')', \ 846 (f1.dimensions() Op dvs.dimensions()) \ 849 Foam::OpFunc(tres.ref(), f1, dvs); \ 860 class Type, template<class> class PatchField, \ 863 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 866 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 867 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 870 return tf1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 875 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 879 <typename product<Form, Type>::type, PatchField, GeoMesh>& result, \ 880 const dimensioned<Form>& dvs, \ 881 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 884 Foam::OpFunc(result.primitiveFieldRef(), dvs.value(), f2.primitiveField());\ 885 Foam::OpFunc(result.boundaryFieldRef(), dvs.value(), f2.boundaryField()); \ 886 result.oriented() = f2.oriented(); \ 887 if (GeometricBoundaryField<Type, PatchField, GeoMesh>::debug) \ 889 result.boundaryField().check(); \ 894 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 895 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 898 const dimensioned<Form>& dvs, \ 899 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 902 typedef typename product<Form, Type>::type resultType; \ 905 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 908 '(' + dvs.name() + #Op + f2.name() + ')', \ 909 (dvs.dimensions() Op f2.dimensions()) \ 912 Foam::OpFunc(tres.ref(), dvs, f2); \ 922 class Type, template<class> class PatchField, \ 925 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 928 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 929 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 932 return dimensioned<Form>(static_cast<const Form&>(vs)) Op f2; \ 936 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 937 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 940 const dimensioned<Form>& dvs, \ 941 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf2 \ 944 typedef typename product<Form, Type>::type resultType; \ 946 const auto& f2 = tf2(); \ 949 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 952 '(' + dvs.name() + #Op + f2.name() + ')', \ 953 (dvs.dimensions() Op f2.dimensions()) \ 956 Foam::OpFunc(tres.ref(), dvs, f2); \ 967 class Type, template<class> class PatchField, \ 970 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 973 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 974 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf2 \ 977 return dimensioned<Form>(static_cast<const Form&>(vs)) Op tf2; \ 989 #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 expressions::valueTypeCode::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)
Generic GeometricBoundaryField class.
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)
static int debug
Enable debug.
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)
void correctLocalBoundaryConditions()
Correct boundary conditions after a purely local operation.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
const dimensionSet & dimensions() const noexcept
Return dimensions.
pTraits< typename pTraits< arg1 >::cmptType >::magType type