Commit f5795afa authored by Andrew Heather's avatar Andrew Heather
Browse files

STYLE: More use of constexpr for namespace variables

parent 46e85436
......@@ -329,8 +329,8 @@ inline Ostream& endEntry(Ostream& os)
// Useful aliases for tab and newline characters
static const char tab = '\t';
static const char nl = '\n';
constexpr char tab = '\t';
constexpr char nl = '\n';
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -45,7 +45,7 @@ namespace mathematical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static const char* const group = "mathematical";
constexpr const char* const group = "mathematical";
constexpr scalar e(M_E);
constexpr scalar pi(M_PI);
......
......@@ -51,13 +51,13 @@ typedef double doubleScalar;
// Largest and smallest scalar values allowed in certain parts of the code.
// (15 is the number of significant figures in an
// IEEE double precision number. See limits.h or float.h)
static const doubleScalar doubleScalarGREAT = 1.0e+15;
static const doubleScalar doubleScalarVGREAT = 1.0e+300;
static const doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
static const doubleScalar doubleScalarSMALL = 1.0e-15;
static const doubleScalar doubleScalarROOTSMALL = 3.0e-8;
static const doubleScalar doubleScalarVSMALL = 1.0e-300;
static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
constexpr doubleScalar doubleScalarGREAT = 1.0e+15;
constexpr doubleScalar doubleScalarVGREAT = 1.0e+300;
constexpr doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
constexpr doubleScalar doubleScalarSMALL = 1.0e-15;
constexpr doubleScalar doubleScalarROOTSMALL = 3.0e-8;
constexpr doubleScalar doubleScalarVSMALL = 1.0e-300;
constexpr doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
#define Scalar doubleScalar
......
......@@ -51,13 +51,13 @@ typedef float floatScalar;
// Largest and smallest scalar values allowed in certain parts of the code.
// (6 is the number of significant figures in an
// IEEE single precision number. See limits.h or float.h)
static const floatScalar floatScalarGREAT = 1.0e+6;
static const floatScalar floatScalarVGREAT = 1.0e+37;
static const floatScalar floatScalarROOTVGREAT = 1.0e+18;
static const floatScalar floatScalarSMALL = 1.0e-6;
static const floatScalar floatScalarROOTSMALL = 1.0e-3;
static const floatScalar floatScalarVSMALL = 1.0e-37;
static const floatScalar floatScalarROOTVSMALL = 1.0e-18;
constexpr floatScalar floatScalarGREAT = 1.0e+6;
constexpr floatScalar floatScalarVGREAT = 1.0e+37;
constexpr floatScalar floatScalarROOTVGREAT = 1.0e+18;
constexpr floatScalar floatScalarSMALL = 1.0e-6;
constexpr floatScalar floatScalarROOTSMALL = 1.0e-3;
constexpr floatScalar floatScalarVSMALL = 1.0e-37;
constexpr floatScalar floatScalarROOTVSMALL = 1.0e-18;
#define Scalar floatScalar
......
......@@ -49,13 +49,13 @@ namespace Foam
{
typedef floatScalar scalar;
static const scalar GREAT = floatScalarGREAT;
static const scalar VGREAT = floatScalarVGREAT;
static const scalar ROOTVGREAT = floatScalarROOTVGREAT;
static const scalar SMALL = floatScalarSMALL;
static const scalar ROOTSMALL = floatScalarROOTSMALL;
static const scalar VSMALL = floatScalarVSMALL;
static const scalar ROOTVSMALL = floatScalarROOTVSMALL;
constexpr scalar GREAT = floatScalarGREAT;
constexpr scalar VGREAT = floatScalarVGREAT;
constexpr scalar ROOTVGREAT = floatScalarROOTVGREAT;
constexpr scalar SMALL = floatScalarSMALL;
constexpr scalar ROOTSMALL = floatScalarROOTSMALL;
constexpr scalar VSMALL = floatScalarVSMALL;
constexpr scalar ROOTVSMALL = floatScalarROOTVSMALL;
scalar readScalar(Istream& is);
......@@ -73,13 +73,13 @@ namespace Foam
{
typedef doubleScalar scalar;
static const scalar GREAT = doubleScalarGREAT;
static const scalar VGREAT = doubleScalarVGREAT;
static const scalar ROOTVGREAT = doubleScalarROOTVGREAT;
static const scalar SMALL = doubleScalarSMALL;
static const scalar ROOTSMALL = doubleScalarROOTSMALL;
static const scalar VSMALL = doubleScalarVSMALL;
static const scalar ROOTVSMALL = doubleScalarROOTVSMALL;
constexpr scalar GREAT = doubleScalarGREAT;
constexpr scalar VGREAT = doubleScalarVGREAT;
constexpr scalar ROOTVGREAT = doubleScalarROOTVGREAT;
constexpr scalar SMALL = doubleScalarSMALL;
constexpr scalar ROOTSMALL = doubleScalarROOTSMALL;
constexpr scalar VSMALL = doubleScalarVSMALL;
constexpr scalar ROOTVSMALL = doubleScalarROOTVSMALL;
scalar readScalar(Istream& is);
......
......@@ -58,8 +58,8 @@ namespace Foam
typedef INT_SIZE(int, _t) label;
static const label labelMin = INT_SIZE(INT, _MIN);
static const label labelMax = INT_SIZE(INT, _MAX);
constexpr label labelMin = INT_SIZE(INT, _MIN);
constexpr label labelMax = INT_SIZE(INT, _MAX);
//- Read label from stream.
// Uses readInt32 or readInt64 according to WM_LABEL_SIZE
......
......@@ -58,7 +58,7 @@ namespace Foam
typedef UINT_SIZE(uint, _t) uLabel;
static const uLabel uLabelMax = UINT_SIZE(UINT, _MAX);
constexpr uLabel uLabelMax = UINT_SIZE(UINT, _MAX);
//- Read uLabel from stream.
// Uses readUint32 or readUint64 according to WM_LABEL_SIZE
......
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