32 template<class Type, template<class> class PatchField, class GeoMesh>
42template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
60 result.boundaryField().check();
65template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
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,
99 result.correctLocalBoundaryConditions();
102 result.boundaryField().check();
110 template<
class>
class PatchField,
140 template<
class>
class PatchField,
153 const auto& f1 = tf1();
159 "pow(" + f1.name() +
',' +
Foam::name(r) +
')',
160 pow(f1.dimensions(), r)
170template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
177 const GeometricField<Type, PatchField, GeoMesh>& f1
180 sqr(result.primitiveFieldRef(), f1.primitiveField());
181 sqr(result.boundaryFieldRef(), f1.boundaryField());
182 result.oriented() =
sqr(f1.oriented());
183 result.correctLocalBoundaryConditions();
186 result.boundaryField().check();
191template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
209 "sqr(" + f1.
name() +
')',
219template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
233 const auto& f1 = tf1();
239 "sqr(" + f1.name() +
')',
250template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
254 const GeometricField<Type, PatchField, GeoMesh>& f1
257 magSqr(result.primitiveFieldRef(), f1.primitiveField());
258 magSqr(result.boundaryFieldRef(), f1.boundaryField());
259 result.oriented() =
magSqr(f1.oriented());
260 result.correctLocalBoundaryConditions();
263 result.boundaryField().check();
268template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
281 "magSqr(" + f1.name() +
')',
290template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
291tmp<GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>>
294 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1
297 auto tres =
magSqr(tf1.cref());
304template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
308 const GeometricField<Type, PatchField, GeoMesh>& f1
311 mag(result.primitiveFieldRef(), f1.primitiveField());
312 mag(result.boundaryFieldRef(), f1.boundaryField());
313 result.oriented() =
mag(f1.oriented());
314 result.correctLocalBoundaryConditions();
317 result.boundaryField().check();
322template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
335 "mag(" + f1.name() +
')',
344template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
345tmp<GeometricField<typename typeOfMag<Type>::type, PatchField, GeoMesh>>
348 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1
351 auto tres =
mag(tf1.cref());
358template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
367 const GeometricField<Type, PatchField, GeoMesh>& f1
370 cmptAv(result.primitiveFieldRef(), f1.primitiveField());
371 cmptAv(result.boundaryFieldRef(), f1.boundaryField());
372 result.oriented() =
cmptAv(f1.oriented());
375 result.boundaryField().check();
379template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
398 "cmptAv(" + f1.
name() +
')',
408template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
427#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(ReturnType, Func, BinaryOp) \
429template<class Type, template<class> class PatchField, class GeoMesh> \
430dimensioned<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(), \
454template<class Type, template<class> class PatchField, class GeoMesh> \
455dimensioned<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) \
478template<class Type, template<class> class PatchField, class GeoMesh> \
479dimensioned<ReturnType> Func \
481 const GeometricField<Type, PatchField, GeoMesh>& f1, \
485 return Func(f1.internalField(), comm); \
488template<class Type, template<class> class PatchField, class GeoMesh> \
489dimensioned<ReturnType> Func \
491 const tmp<GeometricField<Type, PatchField, GeoMesh>>& tf1, \
495 auto result = Func(tf1(), comm); \
504#undef UNARY_REDUCTION_FUNCTION
522template<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();
542template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
554 "clamp01(" + f1.name() +
')',
558 clamp(tres.ref(), f1, Foam::zero_one{});
564template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
565tmp<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> \
790tmp<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, \
820tmp<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> \
833tmp<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, \
866tmp<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> \
898tmp<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, \
928tmp<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> \
940tmp<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, \
973tmp<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_FUNCTION(ReturnType, Type1, Type2, Func)
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define TERNARY_FUNCTION(ReturnType, Type1, Type2, Type3, Func)
#define TERNARY_TYPE_FUNCTION_FFS(ReturnType, Type1, Type2, Type3, Func)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
#define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc)
#define UNARY_REDUCTION_FUNCTION_WITH_BOUNDARY(ReturnType, Func, BinaryOp)
const dimensionSet & dimensions() const noexcept
Return dimensions.
orientedType oriented() const noexcept
Return oriented type.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
bool check() const
Helper: check if field has been evaluated. See instantiations.
static int debug
Enable debug.
Generic GeometricField class.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
Field< Type >::cmptType cmptType
Component type of the field elements.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
const word & name() const noexcept
Return the object name.
A min/max value pair with additional methods. In addition to conveniently storing values,...
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
symmTypeOfRank< typenamepTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank)>::type type
A class for managing temporary objects.
The magnitude type for given argument.
pTraits< typenamepTraits< arg1 >::cmptType >::magType type
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
#define PRODUCT_OPERATOR(product, op, opFunc)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void subtract(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
MinMax< scalar > scalarMinMax
A scalar min/max range.
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
tmp< DimensionedField< typename DimensionedField< Type, GeoMesh >::cmptType, GeoMesh > > cmptAv(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void negate(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1)
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
void outer(FieldField< Field1, typename outerProduct< 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)
dimensioned< typename typeOfMag< Type >::type > sumMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static tmp< GeometricField< TypeR, PatchField, GeoMesh > > New(const GeometricField< Type1, PatchField, GeoMesh > &f1, const word &name, const dimensionSet &dimensions)
Pass-through to New GeometricField.