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, \ 436 return dimensioned<ReturnType> \ 438 #Func "(" + f1.name() + ')', \ 444 Foam::Func(f1.primitiveField()), \ 445 Foam::Func(f1.boundaryField()) \ 447 BinaryOp<ReturnType>(), \ 448 UPstream::msgType(), \ 454 template<class Type, template<class> class PatchField, class GeoMesh> \ 455 dimensioned<ReturnType> Func \ 457 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 461 dimensioned<ReturnType> res = Func(tf1(), comm); \ 472 #undef UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY 476 #define UNARY_REDUCTION_FUNCTION(ReturnType, Func) \ 478 template<class Type, template<class> class PatchField, class GeoMesh> \ 479 dimensioned<ReturnType> Func \ 481 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 485 return Func(f1.internalField(), comm); \ 488 template<class Type, template<class> class PatchField, class GeoMesh> \ 489 dimensioned<ReturnType> Func \ 491 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 495 auto result = Func(tf1(), comm); \ 504 #undef UNARY_REDUCTION_FUNCTION 522 template<class Type, template<class> class PatchField, class
GeoMesh>
532 clamp(result.primitiveFieldRef(), f1.primitiveField(),
range);
533 clamp(result.boundaryFieldRef(), f1.boundaryField(),
range);
534 result.oriented() = f1.oriented();
535 result.correctLocalBoundaryConditions();
538 result.boundaryField().check();
542 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
543 tmp<GeometricField<Type, PatchField, GeoMesh>>
546 const GeometricField<Type, PatchField, GeoMesh>& f1,
554 "clamp01(" + f1.name() +
')',
564 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
565 tmp<GeometricField<Type, PatchField, GeoMesh>>
568 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1,
572 const auto& f1 = tf1();
578 "clamp01(" + f1.name() +
')',
613 #define PRODUCT_OPERATOR(product, Op, OpFunc) \ 616 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 620 <typename product<Type1, Type2>::type, PatchField, GeoMesh>& result, \ 621 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 622 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 627 result.primitiveFieldRef(), \ 628 f1.primitiveField(), \ 629 f2.primitiveField() \ 633 result.boundaryFieldRef(), \ 634 f1.boundaryField(), \ 638 result.oriented() = (f1.oriented() Op f2.oriented()); \ 639 result.correctLocalBoundaryConditions(); \ 640 if (GeometricBoundaryField<Type1, PatchField, GeoMesh>::debug) \ 642 result.boundaryField().check(); \ 648 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 651 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 655 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 656 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 659 typedef typename product<Type1, Type2>::type resultType; \ 662 reuseTmpGeometricField<resultType, Type1, PatchField, GeoMesh>::New \ 665 '(' + f1.name() + #Op + f2.name() + ')', \ 666 (f1.dimensions() Op f2.dimensions()) \ 669 Foam::OpFunc(tres.ref(), f1, f2); \ 676 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 679 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 683 const GeometricField<Type1, PatchField, GeoMesh>& f1, \ 684 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \ 687 typedef typename product<Type1, Type2>::type resultType; \ 689 const auto& f2 = tf2(); \ 692 reuseTmpGeometricField<resultType, Type2, PatchField, GeoMesh>::New \ 695 '(' + f1.name() + #Op + f2.name() + ')', \ 696 (f1.dimensions() Op f2.dimensions()) \ 699 Foam::OpFunc(tres.ref(), f1, f2); \ 706 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 709 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 713 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \ 714 const GeometricField<Type2, PatchField, GeoMesh>& f2 \ 717 typedef typename product<Type1, Type2>::type resultType; \ 719 const auto& f1 = tf1(); \ 722 reuseTmpGeometricField<resultType, Type1, PatchField, GeoMesh>::New \ 725 '(' + f1.name() + #Op + f2.name() + ')', \ 726 (f1.dimensions() Op f2.dimensions()) \ 729 Foam::OpFunc(tres.ref(), f1, f2); \ 736 <class Type1, class Type2, template<class> class PatchField, class GeoMesh> \ 739 GeometricField<typename product<Type1, Type2>::type, PatchField, GeoMesh> \ 743 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \ 744 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \ 747 typedef typename product<Type1, Type2>::type resultType; \ 749 const auto& f1 = tf1(); \ 750 const auto& f2 = tf2(); \ 753 reuseTmpTmpGeometricField \ 754 <resultType, Type1, Type1, Type2, PatchField, GeoMesh>::New \ 758 '(' + f1.name() + #Op + f2.name() + ')', \ 759 (f1.dimensions() Op f2.dimensions()) \ 762 Foam::OpFunc(tres.ref(), f1, f2); \ 770 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 774 <typename product<Type, Form>::type, PatchField, GeoMesh>& result, \ 775 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 776 const dimensioned<Form>& dvs \ 779 Foam::OpFunc(result.primitiveFieldRef(), f1.primitiveField(), dvs.value());\ 780 Foam::OpFunc(result.boundaryFieldRef(), f1.boundaryField(), dvs.value()); \ 781 result.oriented() = f1.oriented(); \ 782 if (GeometricBoundaryField<Type, PatchField, GeoMesh>::debug) \ 784 result.boundaryField().check(); \ 789 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 790 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \ 793 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 794 const dimensioned<Form>& dvs \ 797 typedef typename product<Type, Form>::type resultType; \ 800 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 803 '(' + f1.name() + #Op + dvs.name() + ')', \ 804 (f1.dimensions() Op dvs.dimensions()) \ 807 Foam::OpFunc(tres.ref(), f1, dvs); \ 817 class Type, template<class> class PatchField, \ 820 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 823 const GeometricField<Type, PatchField, GeoMesh>& f1, \ 824 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 827 return f1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 832 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 833 tmp<GeometricField<typename product<Type, Form>::type, PatchField, GeoMesh>> \ 836 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 837 const dimensioned<Form>& dvs \ 840 typedef typename product<Type, Form>::type resultType; \ 842 const auto& f1 = tf1(); \ 845 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 848 '(' + f1.name() + #Op + dvs.name() + ')', \ 849 (f1.dimensions() Op dvs.dimensions()) \ 852 Foam::OpFunc(tres.ref(), f1, dvs); \ 863 class Type, template<class> class PatchField, \ 866 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 869 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \ 870 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 873 return tf1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 878 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 882 <typename product<Form, Type>::type, PatchField, GeoMesh>& result, \ 883 const dimensioned<Form>& dvs, \ 884 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 887 Foam::OpFunc(result.primitiveFieldRef(), dvs.value(), f2.primitiveField());\ 888 Foam::OpFunc(result.boundaryFieldRef(), dvs.value(), f2.boundaryField()); \ 889 result.oriented() = f2.oriented(); \ 890 if (GeometricBoundaryField<Type, PatchField, GeoMesh>::debug) \ 892 result.boundaryField().check(); \ 897 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 898 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 901 const dimensioned<Form>& dvs, \ 902 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 905 typedef typename product<Form, Type>::type resultType; \ 908 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 911 '(' + dvs.name() + #Op + f2.name() + ')', \ 912 (dvs.dimensions() Op f2.dimensions()) \ 915 Foam::OpFunc(tres.ref(), dvs, f2); \ 925 class Type, template<class> class PatchField, \ 928 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 931 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 932 const GeometricField<Type, PatchField, GeoMesh>& f2 \ 935 return dimensioned<Form>(static_cast<const Form&>(vs)) Op f2; \ 939 <class Form, class Type, template<class> class PatchField, class GeoMesh> \ 940 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 943 const dimensioned<Form>& dvs, \ 944 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf2 \ 947 typedef typename product<Form, Type>::type resultType; \ 949 const auto& f2 = tf2(); \ 952 reuseTmpGeometricField<resultType, Type, PatchField, GeoMesh>::New \ 955 '(' + dvs.name() + #Op + f2.name() + ')', \ 956 (dvs.dimensions() Op f2.dimensions()) \ 959 Foam::OpFunc(tres.ref(), dvs, f2); \ 970 class Type, template<class> class PatchField, \ 973 tmp<GeometricField<typename product<Form, Type>::type, PatchField, GeoMesh>> \ 976 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 977 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf2 \ 980 return dimensioned<Form>(static_cast<const Form&>(vs)) Op tf2; \ 992 #undef PRODUCT_OPERATOR #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)
#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)
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)
orientedType oriented() const noexcept
Return oriented type.
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)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
#define UNARY_REDUCTION_FUNCTION(ReturnType, Func)
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
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)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
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)
const dimensionSet & dimensions() const noexcept
Return dimensions.
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
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
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.
#define PRODUCT_OPERATOR(product, Op, OpFunc)
static int debug
Enable debug.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define TERNARY_TYPE_FUNCTION_FFS(ReturnType, Type1, Type2, Type3, Func)
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)
#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)
pTraits< typename pTraits< arg1 >::cmptType >::magType type