diff --git a/applications/test/foamVersion/Test-foamVersion.C b/applications/test/foamVersion/Test-foamVersion.C index 8f3e4128fdf7dc23ba7e0250254238e7a70c1f4a..9eeb08ef3b02a71bdaac157547a49da4c2fdd3ef 100644 --- a/applications/test/foamVersion/Test-foamVersion.C +++ b/applications/test/foamVersion/Test-foamVersion.C @@ -29,34 +29,48 @@ Description \*---------------------------------------------------------------------------*/ -#include <iostream> +#include <typeinfo> #include "foamVersion.H" +#include "IOstreams.H" using namespace Foam; int main() { - std::cout - << "\nVersion information (macros)\n" - << "version " << Foam::FOAMversion << '\n' - << "build " << Foam::FOAMbuild << '\n' - << "buildArch " << Foam::FOAMbuildArch << '\n'; - - std::cout - << "\nVersion information (namespace)\n" - << "version " << foamVersion::version << '\n' - << "build " << foamVersion::build << '\n' - << "buildArch " << foamVersion::buildArch << '\n'; - - std::cout - << "\nVerify memory addesses are identical:\n" - << "macro " << long(&(Foam::FOAMversion)) << '\n' - << "namespace " << long(&(foamVersion::version)) << '\n'; - - std::cout - << "\nEnd\n"; + Info + << "\nVersion information (function)" << nl; + foamVersion::printBuildInfo(); + + Info + << "\nVersion information (macros)" << nl + << "version " << Foam::FOAMversion << nl + << "build " << Foam::FOAMbuild << nl + << "buildArch " << Foam::FOAMbuildArch << nl; + + Info + << "\nVersion information (namespace)" << nl + << "api " << foamVersion::api << nl + << "version " << foamVersion::version << nl + << "build " << foamVersion::build << nl + << "buildArch " << foamVersion::buildArch << nl; + Info + << "\nTypes" << nl + << "version " << typeid(foamVersion::version).name() << nl + << "build " << typeid(foamVersion::build).name() << nl + << "buildArch " << typeid(foamVersion::buildArch).name() << nl + << "FOAMversion " << typeid(Foam::FOAMversion).name() << nl + << "FOAMbuild " << typeid(Foam::FOAMbuild).name() << nl; + + Info + << "\nVerify memory addesses are identical:" << nl + << "macro " << long(Foam::FOAMversion) << nl + << "namespace " << long(&(foamVersion::version[0])) << nl; + + Info + << "\nEnd\n" << endl; return 0; } + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_reader_release.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_reader_release.H index 0cccce10a372eb277f4a6fb698028a05699285b0..13c43b1b66ea60726e5cb646eaa5ec07f1035ad3 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_reader_release.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_reader_release.H @@ -8,7 +8,16 @@ int USERD_get_reader_release Info<< "Entering: USERD_get_reader_release" << endl; #endif - strncpy(release_number, foamVersion::build, Z_MAX_USERD_NAME); + strncpy + ( + release_number, + #if OPENFOAM + ("OpenFOAM-" + std::to_string(OPENFOAM)).c_str(), + #else + "OpenFOAM-unknown", + #endif + Z_MAX_USERD_NAME + ); #ifdef ENSIGHTDEBUG Info<< "Leaving: USERD_get_reader_release" << endl; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/libuserd.C b/applications/utilities/postProcessing/graphics/ensightFoamReader/libuserd.C index 54d230729f5d262a80ed34db126779480d4701d9..3da1b648d28bc8cb8515eab72e99d9fa0a61bca9 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/libuserd.C +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/libuserd.C @@ -36,7 +36,7 @@ Description \*---------------------------------------------------------------------------*/ -#include <stdio.h> +#include <cstdio> #include "fvCFD.H" #include "IOobjectList.H" @@ -45,7 +45,6 @@ Description #include "fvMesh.H" #include "cellModel.H" #include "globalFoam.H" -#include "foamVersion.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C b/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C index c970a49e3749c1861e17781b4e097dcc094e7727..19ea1f7b2f8c2e064cd7f152667b3940802f8a8a 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C +++ b/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C @@ -48,13 +48,15 @@ Foam::Ostream& Foam::IOobject::writeBanner(Ostream& os, bool noHint) if (!*paddedVersion) { // Populate: like strncpy but without trailing '\0' - const char *p = foamVersion::version; - memset(paddedVersion, ' ', 38); - for (int i = 0; *p && i < 38; ++i) + std::size_t len = foamVersion::version.length(); + if (len > 38) { - paddedVersion[i] = *p++; + len = 38; } + + std::memset(paddedVersion, ' ', 38); + std::memcpy(paddedVersion, foamVersion::version.c_str(), len); paddedVersion[38] = '\0'; } diff --git a/src/OpenFOAM/global/JobInfo/JobInfo.C b/src/OpenFOAM/global/JobInfo/JobInfo.C index bc0dbd147a589d00e08ec79eb9c6a7a3895020a9..348012c75f264600be46b996cee753dba1e91b20 100644 --- a/src/OpenFOAM/global/JobInfo/JobInfo.C +++ b/src/OpenFOAM/global/JobInfo/JobInfo.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,11 +30,22 @@ License #include "Pstream.H" #include "foamVersion.H" +// Fallback for job-control directory is in the user-directory +// ~/.OpenFOAM/jobControl + +#ifndef FOAM_RESOURCE_USER_CONFIG_DIRNAME +#define FOAM_RESOURCE_USER_CONFIG_DIRNAME ".OpenFOAM" +#elif defined FULLDEBUG + #warning FOAM_RESOURCE_USER_CONFIG_DIRNAME \ + is undefined (was this intentional?) +#endif + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // bool Foam::JobInfo::writeJobInfo(Foam::debug::infoSwitch("writeJobInfo", 0)); Foam::JobInfo Foam::jobInfo; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // bool Foam::JobInfo::write(Ostream& os) const @@ -51,10 +62,8 @@ bool Foam::JobInfo::write(Ostream& os) const return false; } } - else - { - return true; - } + + return true; } @@ -92,11 +101,10 @@ Foam::JobInfo::JobInfo() if (writeJobInfo && Pstream::master()) { - string jobDir = getEnv("FOAM_JOB_DIR"); + string jobDir = Foam::getEnv("FOAM_JOB_DIR"); if (jobDir.empty()) { - // Fallback: ~/.OpenFOAM/jobControl - jobDir = home()/WM_USER_RESOURCE_DIRNAME/"jobControl"; + jobDir = home()/FOAM_RESOURCE_USER_CONFIG_DIRNAME/"jobControl"; } jobFileName_ = hostName() + '.' + Foam::name(pid()); @@ -106,19 +114,19 @@ Foam::JobInfo::JobInfo() if (!isDir(jobDir) && !mkDir(jobDir)) { FatalErrorInFunction - << "No JobInfo directory: FOAM_JOB_DIR=" << jobDir + << "No JobInfo directory: " << jobDir << Foam::exit(FatalError); } if (!isDir(runningDir_) && !mkDir(runningDir_)) { FatalErrorInFunction - << "No JobInfo directory: " << runningDir_ + << "No JobInfo directory: " << runningDir_ << Foam::exit(FatalError); } if (!isDir(finishedDir_) && !mkDir(finishedDir_)) { FatalErrorInFunction - << "No JobInfo directory: " << finishedDir_ + << "No JobInfo directory: " << finishedDir_ << Foam::exit(FatalError); } } diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 6168c68a972f539bf3159e0a70dd31c5a0e925b8..4775db5220e45c3fa3c5e18666216972de97df5c 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -900,7 +900,7 @@ void Foam::argList::parse if (Pstream::master() && bannerEnabled()) { IOobject::writeBanner(Info, true) - << "Build : " << foamVersion::build + << "Build : " << foamVersion::build.c_str() #if OPENFOAM << " (OPENFOAM=" << OPENFOAM << ')' #endif @@ -1003,7 +1003,7 @@ void Foam::argList::parse Pstream::commsTypes::scheduled, Pstream::masterNo() ); - toMaster << string(foamVersion::build) << hostName() << pid(); + toMaster << foamVersion::build << hostName() << pid(); } } diff --git a/src/OpenFOAM/global/etcFiles/etcFiles.C b/src/OpenFOAM/global/etcFiles/etcFiles.C index ee15f6524f7ffcf36055a3f727abc664b84e6dac..6e23b80b34d46b85e4114ceccc4a57046acaf093 100644 --- a/src/OpenFOAM/global/etcFiles/etcFiles.C +++ b/src/OpenFOAM/global/etcFiles/etcFiles.C @@ -25,7 +25,6 @@ License #include "etcFiles.H" #include "foamVersion.H" -#include "macros.H" #include "OSspecific.H" // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // @@ -45,8 +44,21 @@ namespace // - ~/.OpenFOAM static inline bool userResourceDir(Foam::fileName& queried) { - queried = Foam::home()/WM_USER_RESOURCE_DIRNAME; - return Foam::isDir(queried); + #ifdef FOAM_RESOURCE_USER_CONFIG_DIRNAME + queried = Foam::home()/FOAM_RESOURCE_USER_CONFIG_DIRNAME; + if (Foam::isDir(queried)) + { + // If home() fails, it will have actually queried "./.OpenFOAM" + // instead. + // But we would have worse problems elsewhere if that were the case. + return true; + } + #elif defined FULLDEBUG + #warning FOAM_RESOURCE_USER_CONFIG_DIRNAME \ + is undefined (was this intentional?) + #endif + + return false; } @@ -59,22 +71,31 @@ static inline bool userResourceDir(Foam::fileName& queried) // - $WM_PROJECT_INST_DIR/site static inline bool groupResourceDir(Foam::fileName& queried) { - queried = Foam::getEnv("WM_PROJECT_SITE"); + #ifdef FOAM_RESOURCE_SITE_ENVNAME + queried = Foam::getEnv(FOAM_RESOURCE_SITE_ENVNAME); if (queried.size()) { return Foam::isDir(queried); } + #elif defined FULLDEBUG + #warning FOAM_RESOURCE_SITE_ENVNAME \ + is undefined (was this intentional?) + #endif // Fallback when WM_PROJECT_SITE is unset - queried = Foam::getEnv("WM_PROJECT_INST_DIR")/"site"; - return (queried.size() > 4 && Foam::isDir(queried)); + #ifdef FOAM_RESOURCE_SITE_FALLBACK_ENVNAME + queried = Foam::getEnv(FOAM_RESOURCE_SITE_FALLBACK_ENVNAME)/"site"; + if (queried.size() > 4) + { + return Foam::isDir(queried); + } + #elif defined FULLDEBUG + #warning FOAM_RESOURCE_SITE_FALLBACK_ENVNAME \ + is undefined (was this intentional?) + #endif - // NOTE: this alternative bit of code corresponds to how we patch things - // for spack (and EasyBuild?) to avoid leaking out to the parent directory - // - // queried = Foam::getEnv("WM_PROJECT_DIR")/"site"; - // return (queried.size() > 4 && Foam::isDir(queried)); + return false; } @@ -104,12 +125,13 @@ Foam::fileNameList searchEtc if (version.empty()) { #if OPENFOAM - version = STRING_QUOTE(OPENFOAM); + version.assign(std::to_string(OPENFOAM)); #else - version = foamVersion::version; + version.assign(foamVersion::version); #endif } + Foam::fileNameList list; Foam::fileName dir, candidate; @@ -180,7 +202,6 @@ Foam::fileNameList searchEtc // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - Foam::fileNameList Foam::findEtcDirs ( const fileName& name, @@ -233,15 +254,14 @@ Foam::fileNameList Foam::findEtcFiles Foam::fileName Foam::findEtcFile(const fileName& name, const bool mandatory) { - fileName file; - fileNameList list(findEtcFiles(name, mandatory, true)); + if (list.size()) { - file = std::move(list.first()); + return list.first(); } - return file; + return fileName(); } diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global.Cver index 177f809c5520fa9759c8b853cde9fd05e9a86910..6795b9e80b336523bbe4e8d99e3665d8dffb9595 100644 --- a/src/OpenFOAM/global/global.Cver +++ b/src/OpenFOAM/global/global.Cver @@ -38,8 +38,30 @@ Description // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const char* const Foam::foamVersion::version = "VERSION_STRING"; -const char* const Foam::foamVersion::build = "BUILD_STRING"; +// Value from OPENFOAM, defined in wmake rules +const int Foam::foamVersion::api +( + #if OPENFOAM + OPENFOAM + #else + 0 + #endif +); + + +// Value of VERSION\_STRING generated by the build-script +const std::string Foam::foamVersion::version +( + "VERSION_STRING" +); + + +// Value of the BUILD\_STRING generated by the build-script +const std::string Foam::foamVersion::build +( + "BUILD_STRING" +); + // Information about machine endian, label and scalar sizes const std::string Foam::foamVersion::buildArch diff --git a/src/OpenFOAM/global/profiling/profilingSysInfo.C b/src/OpenFOAM/global/profiling/profilingSysInfo.C index 125abecc50e8317e464e29c6bec4660850e86eb1..455d7792903f1a5ba465945a3e7bbc821f328e05 100644 --- a/src/OpenFOAM/global/profiling/profilingSysInfo.C +++ b/src/OpenFOAM/global/profiling/profilingSysInfo.C @@ -29,9 +29,12 @@ License #include "Ostream.H" #include "OSspecific.H" -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // -// file-scope function +namespace +{ + +// Write environment entry inline static void printEnv ( Foam::Ostream& os, @@ -46,6 +49,8 @@ inline static void printEnv } } +} // End anonymous namespace + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -58,8 +63,8 @@ Foam::Ostream& Foam::profilingSysInfo::write os.writeEntry("date", Foam::clock::dateTime()); // compile-time information - os.writeEntry("version", std::string(foamVersion::version)); - os.writeEntry("build", std::string(foamVersion::build)); + os.writeEntry("version", foamVersion::version); + os.writeEntry("build", foamVersion::build); printEnv(os, "arch", "WM_ARCH"); printEnv(os, "compilerType", "WM_COMPILER_TYPE"); diff --git a/src/OpenFOAM/global/version/foamVersion.C b/src/OpenFOAM/global/version/foamVersion.C index 6356eb357b3a39ca140e5760276a86565e7b7025..b9a387d1b52ac589576a1dddc64686dfff98fcb1 100644 --- a/src/OpenFOAM/global/version/foamVersion.C +++ b/src/OpenFOAM/global/version/foamVersion.C @@ -32,9 +32,12 @@ License void Foam::foamVersion::printBuildInfo(const bool full) { - Info<<"Using: OpenFOAM-" << foamVersion::version + // Can use #if OPENFOAM directly + + Info<<"Using: OpenFOAM-" << foamVersion::version.c_str() << " (see www.OpenFOAM.com)" << nl - << "Build: " << foamVersion::build + << "Build: " << foamVersion::build.c_str() + // The same as using foamVersion::api #if OPENFOAM << " (OPENFOAM=" << OPENFOAM << ')' #endif diff --git a/src/OpenFOAM/global/version/foamVersion.H b/src/OpenFOAM/global/version/foamVersion.H deleted file mode 100644 index 099e045ffced94d2d2eac71cb32772c5ff078ca2..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/global/version/foamVersion.H +++ /dev/null @@ -1,93 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Namespace - Foam::foamVersion - -Description - Namespace for OpenFOAM version information - -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 - foamVersion.C - global.Cver - -\*---------------------------------------------------------------------------*/ - -#ifndef foamVersion_H -#define foamVersion_H - -#include "stdFoam.H" -#include <string> - -// The directory name for user-resources (located in the HOME directory) -#define WM_USER_RESOURCE_DIRNAME ".OpenFOAM" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - //- Version information - namespace foamVersion - { - //- OpenFOAM version (number or name) as a static c-string. - extern const char* const version; - - //- OpenFOAM build information as a static c-string - extern const char* const build; - - //- OpenFOAM build architecture information - //- (machine endian, label/scalar sizes) as a static std::string - extern const std::string buildArch; - - //- Print information about version, build, arch to Info - // - // \verbatim - // Using: OpenFOAM-<VERSION> (see www.OpenFOAM.com) - // Build: <BUILD> (OPENFOAM=<API_LEVEL>) - // Arch: "<ARCH_INFO>" - // \endverbatim - // - // \param full includes Arch information - void printBuildInfo(const bool full=true); - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Compatibility names (1806 and earlier) - -#define FOAMversion foamVersion::version -#define FOAMbuild foamVersion::build -#define FOAMbuildArch foamVersion::buildArch - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/include/foamVersion.H b/src/OpenFOAM/include/foamVersion.H new file mode 100644 index 0000000000000000000000000000000000000000..37df0a8377c1fb0617870f3b94c323c44b28764d --- /dev/null +++ b/src/OpenFOAM/include/foamVersion.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Namespace + Foam::foamVersion + +Description + Namespace for OpenFOAM version information + +Note + Compile-time version information is conveyed by the \b OPENFOAM define + provided in the wmake rules "General/general". + The foamVersion.H file is located directly in the src/OpenFOAM/include + directory for easier use by external packages and to allow easier + modification during packaging. + + The \b OPENFOAM define is mirrored by the + \b OPENFOAM_COM and \b OPENFOAM_PLUS defines (in the stdFoam.H file). + The \b OPENFOAM_PLUS define was last used for 1712. + +SourceFiles + foamVersion.C + global.Cver + +\*---------------------------------------------------------------------------*/ + +#ifndef foamVersion_H +#define foamVersion_H + +#include "stdFoam.H" +#include <string> + +//- The directory name for user-resources within the HOME directory +// +// Default: ".OpenFOAM" +// Used by foamEtcFiles(), stringOps::expand(), Foam::JobInfo +#define FOAM_RESOURCE_USER_CONFIG_DIRNAME ".OpenFOAM" + +//- The env name for site-resources to obtain a site-resources directory. +// +// Default: "WM_PROJECT_SITE" +// Used by foamEtcFiles() and stringOps::expand() +#define FOAM_RESOURCE_SITE_ENVNAME "WM_PROJECT_SITE" + +//- The env name for determining a fallback directory name for site-resources +//- when the directory corresponding to FOAM_RESOURCE_SITE_ENVNAME is empty. +// The fallback search appends "/site" to the directory. +// +// Default: "WM_PROJECT_INST_DIR" +// +// \note If packaging OpenFOAM into a single directory (eg, spack, EasyBuild), +// this should be changed to "WM_PROJECT_DIR" to avoid searching within +// the prefix (parent) directory. +// +// Used by foamEtcFiles() and stringOps::expand() +#define FOAM_RESOURCE_SITE_FALLBACK_ENVNAME "WM_PROJECT_INST_DIR" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + //- Version information + namespace foamVersion + { + //- OpenFOAM api number (integer) corresponding to the value of OPENFOAM + //- at the time of compilation. + // The value is 0 if OPENFOAM was not defined. + extern const int api; + + //- OpenFOAM version (name or stringified number) as a std::string + extern const std::string version; + + //- OpenFOAM build information as a std::string + extern const std::string build; + + //- OpenFOAM build architecture information + //- (machine endian, label/scalar sizes) as a std::string + extern const std::string buildArch; + + + //- Print information about version, build, arch to Info + // + // Eg, + // \code + // Using: OpenFOAM-<VERSION> (see www.OpenFOAM.com) + // Build: <BUILD> (OPENFOAM=<API_LEVEL>) + // Arch: "<ARCH_INFO>" + // \endcode + // + // \param full includes Arch information + void printBuildInfo(const bool full=true); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Compatibility names (1806 and earlier). +// Historically assumed to be called within the Foam namespace, so they are +// defined without the Foam namespace qualifier. +// +// - FOAMversion: c-string +// - FOAMbuild: c-string +// - FOAMbuildArch: std::string + +#define FOAMversion foamVersion::version.c_str() +#define FOAMbuild foamVersion::build.c_str() +#define FOAMbuildArch foamVersion::buildArch + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C index 85dd6c0c580813c4b85854c29421726985a31be1..d66ebcb099be199467ac2ffcbf3293cfdd3bb3a0 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C +++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C @@ -455,7 +455,7 @@ Foam::string Foam::stringOps::getVariable } else if (allowEnvVars) { - value = getEnv(name); + value = Foam::getEnv(name); if (value.empty() && !name.empty()) { @@ -468,7 +468,7 @@ Foam::string Foam::stringOps::getVariable if (altType) { - value = getEnv + value = Foam::getEnv ( // var-name word(name.substr(0, altPos), false) @@ -872,7 +872,7 @@ void Foam::stringOps::inplaceExpand ); } - const string varValue = getEnv(varName); + const string varValue = Foam::getEnv(varName); if (varValue.size()) { if (altPos != std::string::npos && altType == '+') @@ -948,7 +948,7 @@ bool Foam::stringOps::inplaceReplaceVar(std::string& s, const word& varName) return false; } - const string content(getEnv(varName)); + const string content(Foam::getEnv(varName)); if (content.empty()) { return false; diff --git a/src/fileFormats/ensight/file/ensightGeoFile.C b/src/fileFormats/ensight/file/ensightGeoFile.C index 473585b5dbdf8a400fdf70682e7ca928d6ccdd2e..c31c8b2d9e8f35a551bb6432cf01acabafdac0b6 100644 --- a/src/fileFormats/ensight/file/ensightGeoFile.C +++ b/src/fileFormats/ensight/file/ensightGeoFile.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "ensightGeoFile.H" -#include "foamVersion.H" #include "macros.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -39,9 +38,9 @@ void Foam::ensightGeoFile::initialize() // Description line 2 #if OPENFOAM - write("Written by OpenFOAM-" STRING_QUOTE(OPENFOAM)); + write("Written by OpenFOAM " STRING_QUOTE(OPENFOAM)); #else - write(string("Written by OpenFOAM-" + string(foamVersion::version))); + write("Written by OpenFOAM"); #endif newline(); diff --git a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C index 1d88d286dcefc3bda85f81c859396bb76f20965e..2ba43de99d4ba43eb2ce76c920dc1d3b92e9ab2b 100644 --- a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C @@ -28,7 +28,6 @@ License #include "OFstream.H" #include "addToRunTimeSelectionTable.H" #include "IOmanip.H" -#include "foamVersion.H" #include "ensightPTraits.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -106,7 +105,7 @@ void Foam::ensightSetWriter<Type>::write // Write .mesh file { - string desc("Written by OpenFOAM-" + string(foamVersion::version)); + string desc("Written by OpenFOAM"); OFstream os(meshFile); os.setf(ios_base::scientific, ios_base::floatfield); os.precision(5); @@ -223,7 +222,7 @@ void Foam::ensightSetWriter<Type>::write // Write .mesh file { - string desc("Written by OpenFOAM-" + string(foamVersion::version)); + string desc("Written by OpenFOAM"); OFstream os(meshFile); os.setf(ios_base::scientific, ios_base::floatfield); os.precision(5);