Commit f86636ed authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge commit 'OpenCFD/master' into olesenm

parents 3684da1b 55c48861
......@@ -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* 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* Foam::pTraits<Foam::Scalar>::componentNames[] = { "x" };
const char* pTraits<Scalar>::componentNames[] = { "x" };
Foam::pTraits<Foam::Scalar>::pTraits(Istream& is)
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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment