mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge commit 'OpenCFD/master' into olesenm
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -26,13 +26,20 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::pTraits<Foam::Scalar>::typeName = "scalar";
|
||||
const Foam::Scalar Foam::pTraits<Foam::Scalar>::zero(0.0);
|
||||
const Foam::Scalar Foam::pTraits<Foam::Scalar>::one(1.0);
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
const char* Foam::pTraits<Foam::Scalar>::componentNames[] = { "x" };
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pTraits<Foam::Scalar>::pTraits(Istream& is)
|
||||
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" };
|
||||
|
||||
pTraits<Scalar>::pTraits(Istream& is)
|
||||
{
|
||||
is >> p_;
|
||||
}
|
||||
@ -40,26 +47,26 @@ Foam::pTraits<Foam::Scalar>::pTraits(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::name(const Scalar s)
|
||||
word name(const Scalar s)
|
||||
{
|
||||
std::ostringstream buf;
|
||||
buf << s;
|
||||
return buf.str();
|
||||
std::ostringstream osBuffer;
|
||||
osBuffer << s;
|
||||
return osBuffer.str();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Scalar Foam::readScalar(Istream& is)
|
||||
Scalar readScalar(Istream& is)
|
||||
{
|
||||
Scalar val;
|
||||
is >> val;
|
||||
Scalar rs;
|
||||
is >> rs;
|
||||
|
||||
return val;
|
||||
return rs;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, Scalar& s)
|
||||
Istream& operator>>(Istream& is, Scalar& s)
|
||||
{
|
||||
token t(is);
|
||||
|
||||
@ -90,7 +97,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Scalar& s)
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const Scalar s)
|
||||
Ostream& operator<<(Ostream& os, const Scalar s)
|
||||
{
|
||||
os.write(s);
|
||||
os.check("Ostream& operator<<(Ostream&, const Scalar&)");
|
||||
@ -98,4 +105,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Scalar s)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -78,6 +78,8 @@ public:
|
||||
|
||||
static const SymmTensor zero;
|
||||
static const SymmTensor one;
|
||||
static const SymmTensor max;
|
||||
static const SymmTensor min;
|
||||
|
||||
|
||||
//- Component labeling enumeration
|
||||
|
||||
@ -79,6 +79,8 @@ public:
|
||||
|
||||
static const Tensor zero;
|
||||
static const Tensor one;
|
||||
static const Tensor max;
|
||||
static const Tensor min;
|
||||
|
||||
|
||||
//- Component labeling enumeration
|
||||
|
||||
@ -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 };
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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"
|
||||
@ -38,8 +35,10 @@ 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>::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" };
|
||||
|
||||
@ -48,6 +47,7 @@ pTraits<label>::pTraits(Istream& is)
|
||||
is >> p_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Raise one label to the power of another (overloaded function call)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -29,17 +29,27 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::pTraits<Foam::uLabel>::typeName = "uLabel";
|
||||
const Foam::uLabel Foam::pTraits<Foam::uLabel>::zero(0);
|
||||
const Foam::uLabel Foam::pTraits<Foam::uLabel>::one(1);
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
const char* Foam::pTraits<Foam::uLabel>::componentNames[] = { "x" };
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pTraits<Foam::uLabel>::pTraits(Istream& is)
|
||||
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" };
|
||||
|
||||
pTraits<uLabel>::pTraits(Istream& is)
|
||||
{
|
||||
is >> p_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user