31 #define TEMPLATE template<class Type, class GeoMesh> 41 template<
class Type,
class GeoMesh, direction r>
59 pow<Type, r, GeoMesh>(tres.ref().field(), f1.
field());
65 template<
class Type,
class GeoMesh, direction r>
69 const tmp<DimensionedField<Type, GeoMesh>>& tf1,
75 const auto& f1 = tf1();
85 pow<Type, r, GeoMesh>(tres.ref().field(), f1.
field());
92 template<
class Type,
class GeoMesh>
94 sqr(
const DimensionedField<Type, GeoMesh>& f1)
102 "sqr(" + f1.name() +
')',
106 sqr(tres.ref().field(), f1.field());
111 template<
class Type,
class GeoMesh>
113 sqr(
const tmp<DimensionedField<Type, GeoMesh>>& tf1)
117 const auto& f1 = tf1();
123 "sqr(" + f1.name() +
')',
127 sqr(tres.ref().field(), f1.field());
134 template<
class Type,
class GeoMesh>
136 magSqr(
const DimensionedField<Type, GeoMesh>& f1)
144 "magSqr(" + f1.name() +
')',
153 template<
class Type,
class GeoMesh>
155 magSqr(
const tmp<DimensionedField<Type, GeoMesh>>& tf1)
159 const auto& f1 = tf1();
165 "magSqr(" + f1.name() +
')',
169 magSqr(tres.ref().field(), f1.field());
176 template<
class Type,
class GeoMesh>
178 mag(
const DimensionedField<Type, GeoMesh>& f1)
186 "mag(" + f1.name() +
')',
190 mag(tres.ref().field(), f1.field());
195 template<
class Type,
class GeoMesh>
197 mag(
const tmp<DimensionedField<Type, GeoMesh>>& tf1)
201 const auto& f1 = tf1();
207 "mag(" + f1.name() +
')',
211 mag(tres.ref().field(), f1.field());
218 template<
class Type,
class GeoMesh>
234 "cmptAv(" + f1.
name() +
')',
244 template<
class Type,
class GeoMesh>
256 const auto& f1 = tf1();
262 "cmptAv(" + f1.name() +
')',
273 #define UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc) \ 275 template<class Type, class GeoMesh> \ 276 dimensioned<ReturnType> Func \ 278 const DimensionedField<Type, GeoMesh>& f1 \ 281 return dimensioned<ReturnType> \ 283 #Func "(" + f1.name() + ')', \ 289 template<class Type, class GeoMesh> \ 290 dimensioned<ReturnType> Func \ 292 const tmp<DimensionedField<Type, GeoMesh>>& tf1 \ 295 dimensioned<ReturnType> res = Func(tf1()); \ 309 #undef UNARY_REDUCTION_FUNCTION 327 template<class Type, class
GeoMesh>
338 result.oriented() = f1.oriented();
341 template<
class Type,
class GeoMesh>
342 tmp<DimensionedField<Type, GeoMesh>>
345 const DimensionedField<Type, GeoMesh>& f1,
353 "clamp01(" + f1.name() +
')',
363 template<
class Type,
class GeoMesh>
364 tmp<DimensionedField<Type, GeoMesh>>
367 const tmp<DimensionedField<Type, GeoMesh>>& tf1,
371 const auto& f1 = tf1();
377 "clamp01(" + f1.name() +
')',
412 #define PRODUCT_OPERATOR(product, Op, OpFunc) \ 414 template<class Type1, class Type2, class GeoMesh> \ 415 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh>> \ 418 const DimensionedField<Type1, GeoMesh>& f1, \ 419 const DimensionedField<Type2, GeoMesh>& f2 \ 422 typedef typename product<Type1, Type2>::type resultType; \ 425 reuseTmpDimensionedField<resultType, Type1, GeoMesh>::New \ 428 '(' + f1.name() + #Op + f2.name() + ')', \ 429 (f1.dimensions() Op f2.dimensions()) \ 432 Foam::OpFunc(tres.ref().field(), f1.field(), f2.field()); \ 438 template<class Type1, class Type2, class GeoMesh> \ 439 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh>> \ 442 const DimensionedField<Type1, GeoMesh>& f1, \ 443 const tmp<DimensionedField<Type2, GeoMesh>>& tf2 \ 446 typedef typename product<Type1, Type2>::type resultType; \ 448 const auto& f2 = tf2(); \ 451 reuseTmpDimensionedField<resultType, Type2, GeoMesh>::New \ 454 '(' + f1.name() + #Op + f2.name() + ')', \ 455 (f1.dimensions() Op f2.dimensions()) \ 458 Foam::OpFunc(tres.ref().field(), f1.field(), f2.field()); \ 465 template<class Type1, class Type2, class GeoMesh> \ 466 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh>> \ 469 const tmp<DimensionedField<Type1, GeoMesh>>& tf1, \ 470 const DimensionedField<Type2, GeoMesh>& f2 \ 473 typedef typename product<Type1, Type2>::type resultType; \ 475 const auto& f1 = tf1(); \ 478 reuseTmpDimensionedField<resultType, Type1, GeoMesh>::New \ 481 '(' + f1.name() + #Op + f2.name() + ')', \ 482 (f1.dimensions() Op f2.dimensions()) \ 485 Foam::OpFunc(tres.ref().field(), f1.field(), f2.field()); \ 492 template<class Type1, class Type2, class GeoMesh> \ 493 tmp<DimensionedField<typename product<Type1, Type2>::type, GeoMesh>> \ 496 const tmp<DimensionedField<Type1, GeoMesh>>& tf1, \ 497 const tmp<DimensionedField<Type2, GeoMesh>>& tf2 \ 500 typedef typename product<Type1, Type2>::type resultType; \ 502 const auto& f1 = tf1(); \ 503 const auto& f2 = tf2(); \ 506 reuseTmpTmpDimensionedField \ 507 <resultType, Type1, Type1, Type2, GeoMesh>::New \ 511 '(' + f1.name() + #Op + f2.name() + ')', \ 512 (f1.dimensions() Op f2.dimensions()) \ 515 Foam::OpFunc(tres.ref().field(), f1.field(), f2.field()); \ 523 template<class Form, class Type, class GeoMesh> \ 524 tmp<DimensionedField<typename product<Type, Form>::type, GeoMesh>> \ 527 const DimensionedField<Type, GeoMesh>& f1, \ 528 const dimensioned<Form>& dvs \ 531 typedef typename product<Type, Form>::type resultType; \ 534 reuseTmpDimensionedField<resultType, Type, GeoMesh>::New \ 537 '(' + f1.name() + #Op + dvs.name() + ')', \ 538 (f1.dimensions() Op dvs.dimensions()) \ 541 Foam::OpFunc(tres.ref().field(), f1.field(), dvs.value()); \ 547 template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \ 548 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \ 551 const DimensionedField<Type, GeoMesh>& f1, \ 552 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 555 return f1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 559 template<class Form, class Type, class GeoMesh> \ 560 tmp<DimensionedField<typename product<Type, Form>::type, GeoMesh>> \ 563 const tmp<DimensionedField<Type, GeoMesh>>& tf1, \ 564 const dimensioned<Form>& dvs \ 567 typedef typename product<Type, Form>::type resultType; \ 569 const auto& f1 = tf1(); \ 572 reuseTmpDimensionedField<resultType, Type, GeoMesh>::New \ 575 '(' + f1.name() + #Op + dvs.name() + ')', \ 576 (f1.dimensions() Op dvs.dimensions()) \ 579 Foam::OpFunc(tres.ref().field(), f1.field(), dvs.value()); \ 586 template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \ 587 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \ 590 const tmp<DimensionedField<Type, GeoMesh>>& tf1, \ 591 const VectorSpace<Form,Cmpt,nCmpt>& vs \ 594 return tf1 Op dimensioned<Form>(static_cast<const Form&>(vs)); \ 598 template<class Form, class Type, class GeoMesh> \ 599 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \ 602 const dimensioned<Form>& dvs, \ 603 const DimensionedField<Type, GeoMesh>& f2 \ 606 typedef typename product<Form, Type>::type resultType; \ 609 reuseTmpDimensionedField<resultType, Type, GeoMesh>::New \ 612 '(' + dvs.name() + #Op + f2.name() + ')', \ 613 (dvs.dimensions() Op f2.dimensions()) \ 616 Foam::OpFunc(tres.ref().field(), dvs.value(), f2.field()); \ 622 template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \ 623 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \ 626 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 627 const DimensionedField<Type, GeoMesh>& f2 \ 630 return dimensioned<Form>(static_cast<const Form&>(vs)) Op f2; \ 634 template<class Form, class Type, class GeoMesh> \ 635 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \ 638 const dimensioned<Form>& dvs, \ 639 const tmp<DimensionedField<Type, GeoMesh>>& tf2 \ 642 typedef typename product<Form, Type>::type resultType; \ 644 const auto& f2 = tf2(); \ 647 reuseTmpDimensionedField<resultType, Type, GeoMesh>::New \ 650 '(' + dvs.name() + #Op + f2.name() + ')', \ 651 (dvs.dimensions() Op f2.dimensions()) \ 654 Foam::OpFunc(tres.ref().field(), dvs.value(), f2.field()); \ 661 template<class Form, class Cmpt, direction nCmpt, class Type, class GeoMesh> \ 662 tmp<DimensionedField<typename product<Form, Type>::type, GeoMesh>> \ 665 const VectorSpace<Form,Cmpt,nCmpt>& vs, \ 666 const tmp<DimensionedField<Type, GeoMesh>>& tf2 \ 669 return dimensioned<Form>(static_cast<const Form&>(vs)) Op tf2; \ 681 #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)
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)
const word & name() const noexcept
Return the object name.
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 UNARY_REDUCTION_FUNCTION(ReturnType, Func, gFunc)
#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
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func)
Field< Type >::cmptType cmptType
Component type of the field elements.
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)
#define PRODUCT_OPERATOR(product, Op, OpFunc)
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.
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.
static tmp< DimensionedField< TypeR, GeoMesh > > New(const DimensionedField< Type1, GeoMesh > &f1, const word &name, const dimensionSet &dimensions)
Pass-through to New DimensionedField.
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)
Type gMax(const FieldField< Field, Type > &f)
scalarMinMax gMinMaxMag(const FieldField< Field, Type > &f)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
const Field< Type > & field() const noexcept
Return const-reference to the field values.
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.
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1)
Type gAverage(const FieldField< Field, Type > &f)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
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)
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)
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