Commit ba1bca6c authored by mattijs's avatar mattijs
Browse files

ENH: pTraits: added rootMin, rootMax for use in e.g. minMagSqr

parent 71c0a5d1
......@@ -379,7 +379,7 @@ Type maxMagSqr(const UList<Type>& f)
}
else
{
return pTraits<Type>::min;
return pTraits<Type>::zero;
}
}
......@@ -406,7 +406,7 @@ Type minMagSqr(const UList<Type>& f)
}
else
{
return pTraits<Type>::max;
return pTraits<Type>::rootMax;
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -35,6 +35,8 @@ const Scalar pTraits<Scalar>::zero = 0.0;
const Scalar pTraits<Scalar>::one = 1.0;
const Scalar pTraits<Scalar>::min = -ScalarVGREAT;
const Scalar pTraits<Scalar>::max = ScalarVGREAT;
const Scalar pTraits<Scalar>::rootMin = -ScalarROOTVGREAT;
const Scalar pTraits<Scalar>::rootMax = ScalarROOTVGREAT;
const char* pTraits<Scalar>::componentNames[] = { "x" };
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -62,6 +62,8 @@ public:
static const Scalar one;
static const Scalar max;
static const Scalar min;
static const Scalar rootMax;
static const Scalar rootMin;
// Constructors
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -33,11 +33,15 @@ License
#define Scalar doubleScalar
#define ScalarVGREAT doubleScalarVGREAT
#define ScalarVSMALL doubleScalarVSMALL
#define ScalarROOTVGREAT doubleScalarROOTVGREAT
#define ScalarROOTVSMALL doubleScalarROOTVSMALL
#define readScalar readDoubleScalar
#include "Scalar.C"
#undef Scalar
#undef ScalarVGREAT
#undef ScalarVSMALL
#undef ScalarROOTVGREAT
#undef ScalarROOTVSMALL
#undef readScalar
// ************************************************************************* //
......@@ -70,6 +70,8 @@ inline bool readScalar(const char* buf, doubleScalar& s)
#define Scalar doubleScalar
#define ScalarVGREAT doubleScalarVGREAT
#define ScalarVSMALL doubleScalarVSMALL
#define ScalarROOTVGREAT doubleScalarROOTVGREAT
#define ScalarROOTVSMALL doubleScalarROOTVSMALL
#define readScalar readDoubleScalar
inline Scalar mag(const Scalar s)
......@@ -108,6 +110,8 @@ inline Scalar yn(const int n, const Scalar s)
#undef Scalar
#undef ScalarVGREAT
#undef ScalarVSMALL
#undef ScalarROOTVGREAT
#undef ScalarROOTVSMALL
#undef readScalar
#undef transFunc
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -33,11 +33,15 @@ License
#define Scalar floatScalar
#define ScalarVGREAT floatScalarVGREAT
#define ScalarVSMALL floatScalarVSMALL
#define ScalarROOTVGREAT floatScalarROOTVGREAT
#define ScalarROOTVSMALL floatScalarROOTVSMALL
#define readScalar readFloatScalar
#include "Scalar.C"
#undef Scalar
#undef ScalarVSMALL
#undef ScalarVSMALL
#undef ScalarROOTVGREAT
#undef ScalarROOTVSMALL
#undef readScalar
// ************************************************************************* //
......@@ -70,6 +70,8 @@ inline bool readScalar(const char* buf, floatScalar& s)
#define Scalar floatScalar
#define ScalarVGREAT floatScalarVGREAT
#define ScalarVSMALL floatScalarVSMALL
#define ScalarROOTVGREAT floatScalarROOTVGREAT
#define ScalarROOTVSMALL floatScalarROOTVSMALL
#define readScalar readFloatScalar
inline Scalar mag(const Scalar s)
......@@ -108,6 +110,8 @@ inline Scalar yn(const int n, const Scalar s)
#undef Scalar
#undef ScalarVGREAT
#undef ScalarVSMALL
#undef ScalarROOTVGREAT
#undef ScalarROOTVSMALL
#undef readScalar
#undef transFunc
......
......@@ -82,6 +82,8 @@ public:
static const Vector one;
static const Vector max;
static const Vector min;
static const Vector rootMax;
static const Vector rootMin;
//- Component labeling enumeration
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -53,6 +53,12 @@ const vector vector::max(VGREAT, VGREAT, VGREAT);
template<>
const vector vector::min(-VGREAT, -VGREAT, -VGREAT);
template<>
const vector vector::rootMax(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT);
template<>
const vector vector::rootMin(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -38,6 +38,8 @@ const label pTraits<label>::zero = 0;
const label pTraits<label>::one = 1;
const label pTraits<label>::min = labelMin;
const label pTraits<label>::max = labelMax;
const label pTraits<label>::rootMin = pTraits<label>::min;
const label pTraits<label>::rootMax = pTraits<label>::max;
const char* pTraits<label>::componentNames[] = { "x" };
......@@ -59,6 +61,10 @@ const int pTraits<int>::zero = 0;
const int pTraits<int>::one = 1;
const int pTraits<int>::min = INT_MIN;
const int pTraits<int>::max = INT_MAX;
const int pTraits<int>::min = INT_MIN;
const int pTraits<int>::max = INT_MAX;
const int pTraits<int>::rootMin = pTraits<int>::min;
const int pTraits<int>::rootMax = pTraits<int>::max;
const char* pTraits<int>::componentNames[] = { "x" };
......
......@@ -179,6 +179,8 @@ public:
static const label one;
static const label min;
static const label max;
static const label rootMin;
static const label rootMax;
// Constructors
......@@ -237,6 +239,8 @@ public:
static const int one;
static const int min;
static const int max;
static const int rootMax;
static const int rootMin;
// Constructors
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -38,6 +38,8 @@ const uLabel pTraits<uLabel>::zero = 0;
const uLabel pTraits<uLabel>::one = 1;
const uLabel pTraits<uLabel>::min = uLabelMin;
const uLabel pTraits<uLabel>::max = uLabelMax;
const uLabel pTraits<uLabel>::rootMin = pTraits<uLabel>::min;
const uLabel pTraits<uLabel>::rootMax = pTraits<uLabel>::max;
const char* pTraits<uLabel>::componentNames[] = { "x" };
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -145,6 +145,8 @@ public:
static const uLabel one;
static const uLabel max;
static const uLabel min;
static const uLabel rootMax;
static const uLabel rootMin;
// Constructors
......
......@@ -66,6 +66,20 @@ const triad triad::min
vector(-VGREAT, -VGREAT, -VGREAT)
);
const triad triad::rootMax
(
vector(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT),
vector(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT),
vector(ROOTVGREAT, ROOTVGREAT, ROOTVGREAT)
);
const triad triad::rootMin
(
vector(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT),
vector(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT),
vector(-ROOTVGREAT, -ROOTVGREAT, -ROOTVGREAT)
);
const triad triad::I
(
vector(1, 0, 0),
......
......@@ -100,6 +100,8 @@ public:
static const triad one;
static const triad max;
static const triad min;
static const triad rootMax;
static const triad rootMin;
static const triad I;
static const triad unset;
......
Markdown is supported
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