Commit 497dde2b authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: bump API version number to 1804 to account for bitSet

- since PackedBoolList is now a compatibility typedef for bitSet,
  it is useful to have an additional means of distinction.

STYLE: simplify internal version tests and compiler defines.

- the API version is now conveyed via the OPENFOAM define directly.
  The older OPENFOAM_PLUS define is provided for existing code.
parent ebfe4650
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -27,27 +27,19 @@ License
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam
namespace
{
// Should issue warning if there is +ve versioning (+ve version number)
// and if this version number is not in the future (ie, version > current).
// No warning for 0 (unversioned) or -ve values (silent versioning)
// and the this version number is older than the current OpenFOAM version
// as conveyed by the OPENFOAM compiler define.
static inline constexpr bool shouldWarnVersion(const int version)
{
return
(
version > 0
&&
(
(OPENFOAM_PLUS > 1700) // Guard against bad #define value
? (OPENFOAM_PLUS > version)
: true
)
);
return (version > 0 && version < OPENFOAM);
}
} // End namespace Foam
} // End anonymous namespace
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -33,30 +33,27 @@ License
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
void Foam::error::warnAboutAge
(
const char* what,
const int oldVersion
)
void Foam::error::warnAboutAge(const char* what, const int version)
{
if (oldVersion <= 0)
if (version <= 0)
{
// No warning for 0 (unversioned) or -ve values (silent versioning)
}
else if (oldVersion < 1000)
else if (version < 1000)
{
// Emit warning
// Warning for things that predate the YYMM versioning
// (eg, 240 for version 2.4)
std::cerr
<< " This " << what << " is considered to be VERY old!\n"
<< std::endl;
}
else if (OPENFOAM_PLUS > oldVersion)
else if (version < OPENFOAM)
{
const int months =
(
// YYMM -> months
(12 * (OPENFOAM_PLUS/100) + (OPENFOAM_PLUS % 100))
- (12 * (oldVersion/100) + (oldVersion % 100))
(12 * (OPENFOAM/100) + (OPENFOAM % 100))
- (12 * (version/100) + (version % 100))
);
std::cerr
......@@ -64,13 +61,8 @@ void Foam::error::warnAboutAge
<< " months old.\n"
<< std::endl;
}
///// Uncertain if this is desirable
/// else if (OPENFOAM_PLUS < oldVersion)
/// {
/// std::cerr
/// << " This " << what << " appears to be a future option\n"
/// << std::endl;
/// }
// No warning for (OPENFOAM < version).
// We use this to denote future expiry dates of transition features.
}
......
......@@ -104,9 +104,10 @@ public:
//- Emit warning on stderr about something being old.
// \param what description for the warning
// \param oldVersion is a YYMM version value for determining the
// age in months.
static void warnAboutAge(const char* what, const int oldVersion);
// \param version is the old version (YYMM) for determining the
// age in months compared to the current OpenFOAM version
// as conveyed by the \c OPENFOAM compiler define.
static void warnAboutAge(const char* what, const int version);
// Member functions
......
......@@ -111,6 +111,21 @@ Foam::argList::initValidTables dummyInitValidTables;
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace
{
// Should issue warning if there is +ve versioning (+ve version number)
// and the this version number is older than the current OpenFOAM version
// as conveyed by the OPENFOAM compiler define.
static inline constexpr bool shouldWarnVersion(const int version)
{
return (version > 0 && version < OPENFOAM);
}
} // End anonymous namespace
namespace Foam
{
......@@ -168,24 +183,6 @@ static void printBuildInfo(const bool full=true)
}
}
// Should issue warning if there is +ve versioning (+ve version number)
// and if this version number is not in the future (ie, version > current).
// No warning for 0 (unversioned) or -ve values (silent versioning)
static inline constexpr bool shouldWarnVersion(const int version)
{
return
(
version > 0
&&
(
(OPENFOAM_PLUS > 1700) // Guard against bad #define value
? (OPENFOAM_PLUS > version)
: true
)
);
}
} // End namespace Foam
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -46,6 +46,13 @@ Description
OpenFOAM build architecture information (endian, label/scalar sizes)
as a static string
Note
Compile-time version information is conveyed by the \b OPENFOAM define
provided in the wmake rules "General/general".
This value is mirrored by the \b OPENFOAM_COM and \b OPENFOAM_PLUS defines
provided via the stdFoam.H file.
The OPENFOAM_PLUS define was last used for 1712.
SourceFiles
global.Cver
......@@ -67,6 +74,9 @@ namespace Foam
extern const char* const FOAMbuild;
extern const std::string FOAMbuildArch;
//- Implementation details of various OpenFOAM classes
namespace Detail {}
//- Additional OpenFOAM modules
namespace Module {}
}
......
......@@ -47,6 +47,18 @@ SeeAlso
#include <initializer_list>
#include <utility>
// Mirror OPENFOAM define in other variants
#ifdef OPENFOAM
// Code base from www.openfoam.com
# ifndef OPENFOAM_COM
# define OPENFOAM_COM OPENFOAM
# endif
// Older name (prior to 1806)
# ifndef OPENFOAM_PLUS
# define OPENFOAM_PLUS OPENFOAM
# endif
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace stdFoam
......@@ -80,7 +92,7 @@ constexpr auto cbegin(const C& c) -> decltype(c.begin())
return c.begin();
}
//- Return iterator to the end of the container \a c array.
//- Return iterator to the end of the container \a c.
// Definition as per std::end C++17
template<class C>
constexpr auto end(C& c) -> decltype(c.end())
......@@ -88,7 +100,7 @@ constexpr auto end(C& c) -> decltype(c.end())
return c.end();
}
//- Return const_iterator to the end of the container \a c array.
//- Return const_iterator to the end of the container \a c.
// Definition as per std::end C++17
template<class C>
constexpr auto end(const C& c) -> decltype(c.end())
......@@ -176,8 +188,7 @@ constexpr inline const T& max(const T& a, const T& b)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Iterate across all elements in the \a container object of type
// \a Container.
//- Iterate across all elements in the \a container object.
// \par Usage
// \code
// forAllIters(container, iter)
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -42,13 +42,13 @@ void Foam::ensightGeoFile::initialize()
newline();
// Description line 2
#ifdef OPENFOAM_PLUS
write(string("Written by OpenFOAM-" STRING_QUOTE(OPENFOAM_PLUS)));
#if OPENFOAM
write("Written by OpenFOAM-" STRING_QUOTE(OPENFOAM));
#else
write(string("Written by OpenFOAM-" + string(Foam::FOAMversion)));
#endif
newline();
write("node id assign");
newline();
......
#-------------------------------*- makefile -*---------------------------------
WM_VERSION = OPENFOAM_PLUS=1803
WM_VERSION = OPENFOAM=1804
AR = ar
ARFLAGS = cr
......
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