diff --git a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C index fd5f0968981db237ca8b4124cac3128e23ee9c65..c0600bd97c4afc124d10ddc6eeaafc3f674c4c51 100644 --- a/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C +++ b/src/OpenFOAM/fields/FieldFields/FieldField/FieldFieldFunctions.C @@ -430,10 +430,7 @@ Type max(const FieldField<Field, Type>& f) } else { - WarningIn("max(const FieldField<Field, Type>&) const") - << "empty fieldField, returning zero" << endl; - - return pTraits<Type>::zero; + return pTraits<Type>::min; } } @@ -464,10 +461,7 @@ Type min(const FieldField<Field, Type>& f) } else { - WarningIn("min(const FieldField<Field, Type>&) const") - << "empty fieldField, returning zero" << endl; - - return pTraits<Type>::zero; + return pTraits<Type>::max; } } diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C index ea1debc235914a7302eab63ca2ee55a900b29933..b000421d76a38286a276bba359484ab80df78f7b 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C +++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C @@ -319,10 +319,7 @@ Type max(const UList<Type>& f) } else { - WarningIn("max(const UList<Type>&)") - << "empty field, returning zero" << endl; - - return pTraits<Type>::zero; + return pTraits<Type>::min; } } @@ -339,10 +336,7 @@ Type min(const UList<Type>& f) } else { - WarningIn("min(const UList<Type>&)") - << "empty field, returning zero" << endl; - - return pTraits<Type>::zero; + return pTraits<Type>::max; } } diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H index a425ab1b106c2024b9393d5afa363ee9c9556bec..035551a240f3da75098108ca7c46ced13ec55dbc 100644 --- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H +++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H @@ -71,6 +71,8 @@ public: static const char* componentNames[]; static const DiagTensor zero; static const DiagTensor one; + static const DiagTensor max; + static const DiagTensor min; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.C b/src/OpenFOAM/primitives/Scalar/Scalar.C index 4593405cd5cce314ed3b1f1c06b8e586ecb341b4..86087309cb0a2b466d993e536a6da3da438babdd 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.C +++ b/src/OpenFOAM/primitives/Scalar/Scalar.C @@ -34,6 +34,8 @@ namespace Foam const char* const pTraits<Scalar>::typeName = "scalar"; const Scalar pTraits<Scalar>::zero = 0.0; const Scalar pTraits<Scalar>::one = 1.0; +const Scalar pTraits<Scalar>::max = ScalarVGREAT; +const Scalar pTraits<Scalar>::min = -ScalarVGREAT; const char* pTraits<Scalar>::componentNames[] = { "x" }; @@ -45,7 +47,6 @@ pTraits<Scalar>::pTraits(Istream& is) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- return a string representation of a Scalar word name(const Scalar s) { std::ostringstream osBuffer; diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.H b/src/OpenFOAM/primitives/Scalar/Scalar.H index 5e2fbc0a26d57f5aa9dd2fb11e9035a16e9ca061..365a7f017eb0e9e631a2b8f77d6aacc87c0101c5 100644 --- a/src/OpenFOAM/primitives/Scalar/Scalar.H +++ b/src/OpenFOAM/primitives/Scalar/Scalar.H @@ -61,6 +61,8 @@ public: static const char* componentNames[]; static const Scalar zero; static const Scalar one; + static const Scalar max; + static const Scalar min; // Constructors diff --git a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.C b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.C index a3bcf71c99916b17746af64d9e0480e07da97e59..6fb4d3732079a12fcde01430469c5d70afca0343 100644 --- a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.C +++ b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.C @@ -32,10 +32,12 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #define Scalar doubleScalar +#define ScalarVGREAT doubleScalarVGREAT #define ScalarVSMALL doubleScalarVSMALL #define readScalar readDoubleScalar #include "Scalar.C" #undef Scalar +#undef ScalarVGREAT #undef ScalarVSMALL #undef readScalar diff --git a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H index 640918c8134fac0857f625a947d2b13406a4b6df..ff4db3393b4b5b02af1dd2fac68abb3838af3172 100644 --- a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H +++ b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H @@ -61,6 +61,7 @@ static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150; #define Scalar doubleScalar +#define ScalarVGREAT doubleScalarVGREAT #define ScalarVSMALL doubleScalarVSMALL #define readScalar readDoubleScalar @@ -98,6 +99,7 @@ inline Scalar yn(const int n, const Scalar s) } #undef Scalar +#undef ScalarVGREAT #undef ScalarVSMALL #undef readScalar #undef transFunc diff --git a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.C b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.C index 5355dc9d8979fa180c340fc1d2fae9ea01f52f70..d5488cebd3f2d55e8e644aa9e0846555c7ded44f 100644 --- a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.C +++ b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.C @@ -32,11 +32,13 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #define Scalar floatScalar +#define ScalarVGREAT floatScalarVGREAT #define ScalarVSMALL floatScalarVSMALL #define readScalar readFloatScalar #include "Scalar.C" #undef Scalar #undef ScalarVSMALL +#undef ScalarVSMALL #undef readScalar // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H index 7ae47138a7dd98b4c7d4d5174d21e4a201a3b04b..99537311ce27889fd37125b54a06dd787fc965f0 100644 --- a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H +++ b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H @@ -61,6 +61,7 @@ static const floatScalar floatScalarROOTVSMALL = 1.0e-18; #define Scalar floatScalar +#define ScalarVGREAT floatScalarVGREAT #define ScalarVSMALL floatScalarVSMALL #define readScalar readFloatScalar @@ -98,6 +99,7 @@ inline Scalar yn(const int n, const Scalar s) } #undef Scalar +#undef ScalarVGREAT #undef ScalarVSMALL #undef readScalar #undef transFunc diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H index e0698ba7f0fd0caa250951bbb12865012bcf3820..56c51a48d8b8be3f361aced6a32564b1b8c1dae2 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H +++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H @@ -75,6 +75,8 @@ public: static const char* componentNames[]; static const SphericalTensor zero; static const SphericalTensor one; + static const SphericalTensor max; + static const SphericalTensor min; static const SphericalTensor I; static const SphericalTensor oneThirdI; static const SphericalTensor twoThirdsI; diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H index 8e5adcabf47855de51887b9492018df2bccbcf9a..03ba8598012aa39f95ee879682c9a7860c4c4e4b 100644 --- a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H +++ b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H @@ -71,6 +71,8 @@ public: static const char* componentNames[]; static const SphericalTensor2D zero; static const SphericalTensor2D one; + static const SphericalTensor2D max; + static const SphericalTensor2D min; static const SphericalTensor2D I; static const SphericalTensor2D oneThirdI; static const SphericalTensor2D twoThirdsI; diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H index efb76e2f8725df46a1e3c36009e1c854fa2529ca..e43a0d741d7b7a3c44be8571bad9e85acfb7cae2 100644 --- a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H +++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H @@ -78,6 +78,8 @@ public: static const SymmTensor zero; static const SymmTensor one; + static const SymmTensor max; + static const SymmTensor min; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H index ea4e5d72b19dccf28c2f9774733683547601ff10..305829c16de4c91f3684158412b13df49891e26b 100644 --- a/src/OpenFOAM/primitives/Tensor/Tensor.H +++ b/src/OpenFOAM/primitives/Tensor/Tensor.H @@ -79,6 +79,8 @@ public: static const Tensor zero; static const Tensor one; + static const Tensor max; + static const Tensor min; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H index 1f2e629761b1baca7ec6b32a9a9d9d6bc85bc120..f3c5d30e64447e31f588dd1aca56a008e4e96524 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H @@ -74,6 +74,9 @@ public: static const Tensor2D zero; static const Tensor2D one; + static const Tensor2D max; + static const Tensor2D min; + //- Component labeling enumeration enum components { XX, XY, YX, YY }; diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H index bc1af5db057c6ab23a97146530919bac2bf0dbb7..c9d7de528681749f0b463d9b5b9e9f9000d7cd11 100644 --- a/src/OpenFOAM/primitives/Vector/Vector.H +++ b/src/OpenFOAM/primitives/Vector/Vector.H @@ -81,6 +81,8 @@ public: static const char* componentNames[]; static const Vector zero; static const Vector one; + static const Vector max; + static const Vector min; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H index 496c44339298be985bfa3f7194b04e87c91ec979..392c5ba70bd147a9a0c5e132d5b1d304b56d3950 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.H @@ -71,6 +71,8 @@ public: static const char* componentNames[]; static const Vector2D zero; static const Vector2D one; + static const Vector2D max; + static const Vector2D min; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/diagTensor/diagTensor.C b/src/OpenFOAM/primitives/diagTensor/diagTensor.C index 3e95d75970123d53b2a2779aa0a0eef6fd4e90fc..7cc498b12c285d0b15cc50f7c4e084af45c609e4 100644 --- a/src/OpenFOAM/primitives/diagTensor/diagTensor.C +++ b/src/OpenFOAM/primitives/diagTensor/diagTensor.C @@ -48,6 +48,12 @@ const diagTensor diagTensor::zero(0, 0, 0); template<> const diagTensor diagTensor::one(1, 1, 1); +template<> +const diagTensor diagTensor::max(VGREAT, VGREAT, VGREAT); + +template<> +const diagTensor diagTensor::min(-VGREAT, -VGREAT, -VGREAT); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/label/label.C b/src/OpenFOAM/primitives/label/label.C index 5d4d7dd2bb63db7ddc649e92694bbfa43c9e2d3e..38217bd6b2e0e4a57fd813de35e206849b5f18a4 100644 --- a/src/OpenFOAM/primitives/label/label.C +++ b/src/OpenFOAM/primitives/label/label.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - - \*---------------------------------------------------------------------------*/ #include "error.H" @@ -40,6 +37,8 @@ namespace Foam const char* const pTraits<label>::typeName = "label"; const label pTraits<label>::zero = 0; const label pTraits<label>::one = 1; +const label pTraits<label>::max = labelMax; +const label pTraits<label>::min = labelMin; const char* pTraits<label>::componentNames[] = { "x" }; diff --git a/src/OpenFOAM/primitives/label/label.H b/src/OpenFOAM/primitives/label/label.H index d83cd7b08e9595b049f5afa7e1e58ddbda8a7437..f9c523be3df622871410f48b4cf2fd042db46141 100644 --- a/src/OpenFOAM/primitives/label/label.H +++ b/src/OpenFOAM/primitives/label/label.H @@ -150,6 +150,8 @@ public: static const char* componentNames[]; static const label zero; static const label one; + static const label max; + static const label min; // Constructors diff --git a/src/OpenFOAM/primitives/sphericalTensor/sphericalTensor.C b/src/OpenFOAM/primitives/sphericalTensor/sphericalTensor.C index 7943dea5ccf90fd009efc9862570b5937eb71809..2e74cb70ce728df1295f89e427614236273cb279 100644 --- a/src/OpenFOAM/primitives/sphericalTensor/sphericalTensor.C +++ b/src/OpenFOAM/primitives/sphericalTensor/sphericalTensor.C @@ -45,6 +45,12 @@ const sphericalTensor sphericalTensor::zero(0); template<> const sphericalTensor sphericalTensor::one(1); +template<> +const sphericalTensor sphericalTensor::max(VGREAT); + +template<> +const sphericalTensor sphericalTensor::min(-VGREAT); + template<> const sphericalTensor sphericalTensor::I(1); diff --git a/src/OpenFOAM/primitives/sphericalTensor2D/sphericalTensor2D.C b/src/OpenFOAM/primitives/sphericalTensor2D/sphericalTensor2D.C index 974aa6278bee6b283d8ab4fd2f9d646fca24641a..f5fa54eb2f1c4711cd4577bbfe2a57408eeef96b 100644 --- a/src/OpenFOAM/primitives/sphericalTensor2D/sphericalTensor2D.C +++ b/src/OpenFOAM/primitives/sphericalTensor2D/sphericalTensor2D.C @@ -45,6 +45,12 @@ const sphericalTensor2D sphericalTensor2D::zero(0); template<> const sphericalTensor2D sphericalTensor2D::one(1); +template<> +const sphericalTensor2D sphericalTensor2D::max(VGREAT); + +template<> +const sphericalTensor2D sphericalTensor2D::min(-VGREAT); + template<> const sphericalTensor2D sphericalTensor2D::I(1); diff --git a/src/OpenFOAM/primitives/symmTensor/symmTensor.C b/src/OpenFOAM/primitives/symmTensor/symmTensor.C index c9faf9aa1ef5b538bdddec5108c088aebf6fd7c7..f5a56a3d86ede938e0a5ff26526a3a5862969ac9 100644 --- a/src/OpenFOAM/primitives/symmTensor/symmTensor.C +++ b/src/OpenFOAM/primitives/symmTensor/symmTensor.C @@ -61,6 +61,22 @@ const symmTensor symmTensor::one 1 ); +template<> +const symmTensor symmTensor::max +( + VGREAT, VGREAT, VGREAT, + VGREAT, VGREAT, + VGREAT +); + +template<> +const symmTensor symmTensor::min +( + -VGREAT, -VGREAT, -VGREAT, + -VGREAT, -VGREAT, + -VGREAT +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/tensor/tensor.C b/src/OpenFOAM/primitives/tensor/tensor.C index d8236547b610458cd4d57bac160ef399329133b2..f36589312565a9fc26d72a16299371e1b5af59d0 100644 --- a/src/OpenFOAM/primitives/tensor/tensor.C +++ b/src/OpenFOAM/primitives/tensor/tensor.C @@ -61,6 +61,22 @@ const tensor tensor::one 1, 1, 1 ); +template<> +const tensor tensor::max +( + VGREAT, VGREAT, VGREAT, + VGREAT, VGREAT, VGREAT, + VGREAT, VGREAT, VGREAT +); + +template<> +const tensor tensor::min +( + -VGREAT, -VGREAT, -VGREAT, + -VGREAT, -VGREAT, -VGREAT, + -VGREAT, -VGREAT, -VGREAT +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/tensor2D/tensor2D.C b/src/OpenFOAM/primitives/tensor2D/tensor2D.C index 25f361f69588ba7de59cb91eb075ec0b6e7b4f84..e782cd0fea8d516c3ea07504b310cf06d2e368ba 100644 --- a/src/OpenFOAM/primitives/tensor2D/tensor2D.C +++ b/src/OpenFOAM/primitives/tensor2D/tensor2D.C @@ -58,6 +58,20 @@ const tensor2D tensor2D::one 1, 1 ); +template<> +const tensor2D tensor2D::max +( + VGREAT, VGREAT, + VGREAT, VGREAT +); + +template<> +const tensor2D tensor2D::min +( + -VGREAT, -VGREAT, + -VGREAT, -VGREAT +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/uLabel/uLabel.C b/src/OpenFOAM/primitives/uLabel/uLabel.C index b4e72c18a60d7c1c33665c740fbe1b19cc2ddb5a..b005ed9fbafc890f50936f36aad99af566615a96 100644 --- a/src/OpenFOAM/primitives/uLabel/uLabel.C +++ b/src/OpenFOAM/primitives/uLabel/uLabel.C @@ -37,6 +37,8 @@ namespace Foam const char* const pTraits<uLabel>::typeName = "uLabel"; const uLabel pTraits<uLabel>::zero = 0; const uLabel pTraits<uLabel>::one = 1; +const uLabel pTraits<uLabel>::max = uLabelMax; +const uLabel pTraits<uLabel>::min = uLabelMin; const char* pTraits<uLabel>::componentNames[] = { "x" }; @@ -46,9 +48,6 @@ pTraits<uLabel>::pTraits(Istream& is) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/primitives/uLabel/uLabel.H b/src/OpenFOAM/primitives/uLabel/uLabel.H index 7b99b79eb1f0d836e1e1ca36e0ef2de38412c81d..97bb3e5fa2a9113e1888966f9b440fbdf6ea6620 100644 --- a/src/OpenFOAM/primitives/uLabel/uLabel.H +++ b/src/OpenFOAM/primitives/uLabel/uLabel.H @@ -57,6 +57,7 @@ namespace Foam typedef unsigned int uLabel; static const uLabel uLabelMax = UINT_MAX; + static const uLabel uLabelMin = 0; inline uLabel readULabel(Istream& is) { @@ -77,7 +78,8 @@ namespace Foam { typedef unsigned long uLabel; - static const uLabel uLabelMax = LONG_MAX; + static const uLabel uLabelMax = ULONG_MAX; + static const uLabel uLabelMin = 0; inline uLabel readULabel(Istream& is) { @@ -130,6 +132,8 @@ public: static const char* componentNames[]; static const uLabel zero; static const uLabel one; + static const uLabel max; + static const uLabel min; // Constructors diff --git a/src/OpenFOAM/primitives/vector/vector.C b/src/OpenFOAM/primitives/vector/vector.C index 1864a7d8af66c752af200bd4f742cdb4882576de..7c2c84ae9a059872668dd3889040cde9b35d1ab4 100644 --- a/src/OpenFOAM/primitives/vector/vector.C +++ b/src/OpenFOAM/primitives/vector/vector.C @@ -48,6 +48,12 @@ const vector vector::zero(0, 0, 0); template<> const vector vector::one(1, 1, 1); +template<> +const vector vector::max(VGREAT, VGREAT, VGREAT); + +template<> +const vector vector::min(-VGREAT, -VGREAT, -VGREAT); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/primitives/vector2D/vector2D.C b/src/OpenFOAM/primitives/vector2D/vector2D.C index da5a2ec532035b59f9578c8723c3143aa5b4e7fe..cbe0d89d1e103e560187e88b3668eacc512a7310 100644 --- a/src/OpenFOAM/primitives/vector2D/vector2D.C +++ b/src/OpenFOAM/primitives/vector2D/vector2D.C @@ -48,6 +48,12 @@ const vector2D vector2D::zero(0, 0); template<> const vector2D vector2D::one(1, 1); +template<> +const vector2D vector2D::max(VGREAT, VGREAT); + +template<> +const vector2D vector2D::min(-VGREAT, -VGREAT); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam