mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: consolidate arch and version strings (issue #513)
- make some IOobject writing routines non-templated. - relocate more IOobject methods into the IOobjectI.H (generally cleanup the main header).
This commit is contained in:
@ -45,6 +45,7 @@ Description
|
||||
#include "fvMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "globalFoam.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -351,6 +351,12 @@ const Foam::Time& Foam::IOobject::time() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::IOobject::rootPath() const
|
||||
{
|
||||
return time().rootPath();
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::IOobject::caseName() const
|
||||
{
|
||||
return time().caseName();
|
||||
@ -387,12 +393,6 @@ Foam::word Foam::IOobject::member() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::fileName& Foam::IOobject::rootPath() const
|
||||
{
|
||||
return time().rootPath();
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::IOobject::path() const
|
||||
{
|
||||
if (instance().isAbsolute())
|
||||
@ -617,6 +617,8 @@ void Foam::IOobject::setBad(const string& s)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::IOobject::operator=(const IOobject& io)
|
||||
{
|
||||
name_ = io.name_;
|
||||
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -191,6 +191,12 @@ public:
|
||||
TypeName("IOobject");
|
||||
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Type of file modification checking
|
||||
static fileCheckTypes fileModificationChecking;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Split path into instance, local, name components
|
||||
@ -202,11 +208,9 @@ public:
|
||||
word& name
|
||||
);
|
||||
|
||||
template<class Name>
|
||||
static inline word groupName(Name name, const word& group);
|
||||
|
||||
//- Type of file modification checking
|
||||
static fileCheckTypes fileModificationChecking;
|
||||
//- Create dot-delimited name.group
|
||||
template<class StringType>
|
||||
static inline word groupName(StringType name, const word& group);
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -282,35 +286,23 @@ public:
|
||||
|
||||
// General access
|
||||
|
||||
//- Return time
|
||||
const Time& time() const;
|
||||
|
||||
//- Return the local objectRegistry
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return time
|
||||
const Time& time() const;
|
||||
|
||||
//- Return name
|
||||
const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
inline const word& name() const;
|
||||
|
||||
//- Return name of the class name read from header
|
||||
const word& headerClassName() const
|
||||
{
|
||||
return headerClassName_;
|
||||
}
|
||||
|
||||
//- Return non-constant access to the optional note
|
||||
string& note()
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
inline const word& headerClassName() const;
|
||||
|
||||
//- Return the optional note
|
||||
const string& note() const
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
inline const string& note() const;
|
||||
|
||||
//- Return non-constant access to the optional note
|
||||
inline string& note();
|
||||
|
||||
//- Rename
|
||||
virtual void rename(const word& newName)
|
||||
@ -319,51 +311,31 @@ public:
|
||||
}
|
||||
|
||||
//- Register object created from this IOobject with registry if true
|
||||
bool& registerObject()
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
inline bool registerObject() const;
|
||||
|
||||
//- Register object created from this IOobject with registry if true
|
||||
bool registerObject() const
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
inline bool& registerObject();
|
||||
|
||||
//- Is object same for all processors
|
||||
bool& globalObject()
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
inline bool globalObject() const;
|
||||
|
||||
//- Is object same for all processors
|
||||
bool globalObject() const
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
inline bool& globalObject();
|
||||
|
||||
|
||||
// Read/write options
|
||||
|
||||
readOption readOpt() const
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
//- The read option
|
||||
inline readOption readOpt() const;
|
||||
|
||||
readOption& readOpt()
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
//- Non-constant access to the read option
|
||||
inline readOption& readOpt();
|
||||
|
||||
writeOption writeOpt() const
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
//- The write option
|
||||
inline writeOption writeOpt() const;
|
||||
|
||||
writeOption& writeOpt()
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
//- Non-constant access to the write option
|
||||
inline writeOption& writeOpt();
|
||||
|
||||
|
||||
// Path components
|
||||
@ -378,20 +350,11 @@ public:
|
||||
|
||||
const fileName& caseName() const;
|
||||
|
||||
const fileName& instance() const
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
inline const fileName& instance() const;
|
||||
|
||||
fileName& instance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
inline fileName& instance();
|
||||
|
||||
const fileName& local() const
|
||||
{
|
||||
return local_;
|
||||
}
|
||||
inline const fileName& local() const;
|
||||
|
||||
//- Return complete path
|
||||
fileName path() const;
|
||||
@ -404,10 +367,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Return complete path + object name
|
||||
fileName objectPath() const
|
||||
{
|
||||
return path()/name();
|
||||
}
|
||||
inline fileName objectPath() const;
|
||||
|
||||
//- Helper for filePath that searches locally.
|
||||
// When search is false, simply use the current instance,
|
||||
@ -423,7 +383,7 @@ public:
|
||||
// Reading
|
||||
|
||||
//- Read header
|
||||
bool readHeader(Istream&);
|
||||
bool readHeader(Istream& is);
|
||||
|
||||
//- Read header (uses typeFilePath to find file) and check its info.
|
||||
// Optionally checks headerClassName against the type-name.
|
||||
@ -440,39 +400,31 @@ public:
|
||||
template<class Type>
|
||||
void warnNoRereading() const;
|
||||
|
||||
|
||||
// Writing
|
||||
|
||||
//- Write the standard OpenFOAM file/dictionary banner
|
||||
// Optionally without -*- C++ -*- editor hint (eg, for logs)
|
||||
template<class Stream>
|
||||
static inline Stream& writeBanner(Stream& os, bool noHint=false);
|
||||
static Ostream& writeBanner(Ostream& os, bool noHint=false);
|
||||
|
||||
//- Write the standard file section divider
|
||||
template<class Stream>
|
||||
static inline Stream& writeDivider(Stream& os);
|
||||
static Ostream& writeDivider(Ostream& os);
|
||||
|
||||
//- Write the standard end file divider
|
||||
template<class Stream>
|
||||
static inline Stream& writeEndDivider(Stream& os);
|
||||
static Ostream& writeEndDivider(Ostream& os);
|
||||
|
||||
//- Write header
|
||||
bool writeHeader(Ostream&) const;
|
||||
bool writeHeader(Ostream& os) const;
|
||||
|
||||
//- Write header. Allow override of type
|
||||
bool writeHeader(Ostream&, const word& objectType) const;
|
||||
bool writeHeader(Ostream& os, const word& objectType) const;
|
||||
|
||||
|
||||
// Error Handling
|
||||
|
||||
bool good() const
|
||||
{
|
||||
return objState_ == GOOD;
|
||||
}
|
||||
inline bool good() const;
|
||||
|
||||
bool bad() const
|
||||
{
|
||||
return objState_ == BAD;
|
||||
}
|
||||
inline bool bad() const;
|
||||
|
||||
|
||||
// Info
|
||||
@ -487,7 +439,7 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
void operator=(const IOobject&);
|
||||
void operator=(const IOobject& io);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,95 +23,137 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "foamVersion.H"
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Name>
|
||||
inline Foam::word Foam::IOobject::groupName(Name name, const word& group)
|
||||
template<class StringType>
|
||||
inline Foam::word Foam::IOobject::groupName(StringType name, const word& group)
|
||||
{
|
||||
if (group != word::null)
|
||||
{
|
||||
return name + ('.' + group);
|
||||
}
|
||||
else
|
||||
if (group.empty())
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||
{
|
||||
static bool spacesSet(false);
|
||||
static char spaces[40];
|
||||
|
||||
if (!spacesSet)
|
||||
{
|
||||
memset(spaces, ' ', 40);
|
||||
|
||||
size_t len = strlen(Foam::FOAMversion);
|
||||
if (len < 38)
|
||||
{
|
||||
spaces[38 - len] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
spaces[0] = '\0';
|
||||
return name + ('.' + group);
|
||||
}
|
||||
spacesSet = true;
|
||||
}
|
||||
|
||||
if (noHint)
|
||||
{
|
||||
os <<
|
||||
"/*--------------------------------------"
|
||||
"-------------------------------------*\\\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
os <<
|
||||
"/*--------------------------------*- C++ "
|
||||
"-*----------------------------------*\\\n";
|
||||
}
|
||||
|
||||
os <<
|
||||
"| ========= |"
|
||||
" |\n"
|
||||
"| \\\\ / F ield |"
|
||||
" OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||
"| \\\\ / O peration |"
|
||||
" Version: " << FOAMversion << spaces << "|\n"
|
||||
"| \\\\ / A nd |"
|
||||
" Web: www.OpenFOAM.com |\n"
|
||||
"| \\\\/ M anipulation |"
|
||||
" |\n"
|
||||
"\\*-----------------------------------------"
|
||||
"----------------------------------*/\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
template<class Stream>
|
||||
inline Stream& Foam::IOobject::writeDivider(Stream& os)
|
||||
{
|
||||
os <<
|
||||
"// * * * * * * * * * * * * * * * * * "
|
||||
"* * * * * * * * * * * * * * * * * * * * //\n";
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
return os;
|
||||
// General access
|
||||
|
||||
inline const Foam::word& Foam::IOobject::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
template<class Stream>
|
||||
inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
|
||||
{
|
||||
os << "\n\n"
|
||||
"// *****************************************"
|
||||
"******************************** //\n";
|
||||
|
||||
return os;
|
||||
inline const Foam::word& Foam::IOobject::headerClassName() const
|
||||
{
|
||||
return headerClassName_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::string& Foam::IOobject::note() const
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::string& Foam::IOobject::note()
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobject::registerObject() const
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
|
||||
|
||||
inline bool& Foam::IOobject::registerObject()
|
||||
{
|
||||
return registerObject_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobject::globalObject() const
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
|
||||
|
||||
inline bool& Foam::IOobject::globalObject()
|
||||
{
|
||||
return globalObject_;
|
||||
}
|
||||
|
||||
|
||||
// Read/write options
|
||||
|
||||
inline Foam::IOobject::readOption Foam::IOobject::readOpt() const
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOobject::readOption& Foam::IOobject::readOpt()
|
||||
{
|
||||
return rOpt_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOobject::writeOption Foam::IOobject::writeOpt() const
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOobject::writeOption& Foam::IOobject::writeOpt()
|
||||
{
|
||||
return wOpt_;
|
||||
}
|
||||
|
||||
|
||||
// Path components
|
||||
|
||||
inline const Foam::fileName& Foam::IOobject::instance() const
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName& Foam::IOobject::instance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fileName& Foam::IOobject::local() const
|
||||
{
|
||||
return local_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::fileName Foam::IOobject::objectPath() const
|
||||
{
|
||||
return path()/name();
|
||||
}
|
||||
|
||||
|
||||
// Error Handling
|
||||
|
||||
inline bool Foam::IOobject::good() const
|
||||
{
|
||||
return objState_ == GOOD;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobject::bad() const
|
||||
{
|
||||
return objState_ == BAD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -116,9 +116,8 @@ void Foam::IOobject::warnNoRereading() const
|
||||
{
|
||||
WarningInFunction
|
||||
<< Type::typeName << ' ' << name()
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
|
||||
" but " << Type::typeName
|
||||
<< " does not support automatic rereading."
|
||||
<< " constructed with IOobject::MUST_READ_IF_MODIFIED but "
|
||||
<< Type::typeName << " does not support automatic rereading."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,29 +29,91 @@ Description
|
||||
|
||||
#include "IOobject.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "endian.H"
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// file-scope
|
||||
// Hint about machine endian, OpenFOAM label and scalar sizes
|
||||
static const std::string archHint =
|
||||
(
|
||||
#ifdef WM_LITTLE_ENDIAN
|
||||
"LSB"
|
||||
#elif defined (WM_BIG_ENDIAN)
|
||||
"MSB"
|
||||
#else
|
||||
"???"
|
||||
#endif
|
||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
||||
);
|
||||
// A banner corresponding to this:
|
||||
//
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: VERSION |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
Foam::Ostream& Foam::IOobject::writeBanner(Ostream& os, bool noHint)
|
||||
{
|
||||
// The version padded with spaces to fit after "Version: "
|
||||
// - initialized with zero-length string to detect if it has been populated
|
||||
static char paddedVersion[39] = "";
|
||||
|
||||
if (!*paddedVersion)
|
||||
{
|
||||
// Populate: like strncpy but without trailing '\0'
|
||||
const char *p = Foam::FOAMversion;
|
||||
|
||||
memset(paddedVersion, ' ', 38);
|
||||
for (int i = 0; *p && i < 38; ++i)
|
||||
{
|
||||
paddedVersion[i] = *p++;
|
||||
}
|
||||
paddedVersion[38] = '\0';
|
||||
}
|
||||
|
||||
os <<
|
||||
"/*--------------------------------";
|
||||
|
||||
if (noHint)
|
||||
{
|
||||
// Without syntax hint
|
||||
os << "---------";
|
||||
}
|
||||
else
|
||||
{
|
||||
// With syntax hint
|
||||
os << "*- C++ -*";
|
||||
}
|
||||
|
||||
os <<
|
||||
"----------------------------------*\\\n"
|
||||
"| ========= |"
|
||||
" |\n"
|
||||
"| \\\\ / F ield |"
|
||||
" OpenFOAM: The Open Source CFD Toolbox |\n"
|
||||
"| \\\\ / O peration |"
|
||||
" Version: " << paddedVersion << "|\n"
|
||||
"| \\\\ / A nd |"
|
||||
" Web: www.OpenFOAM.com |\n"
|
||||
"| \\\\/ M anipulation |"
|
||||
" |\n"
|
||||
"\\*-----------------------------------------"
|
||||
"----------------------------------*/\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Foam::Ostream& Foam::IOobject::writeDivider(Ostream& os)
|
||||
{
|
||||
os <<
|
||||
"// * * * * * * * * * * * * * * * * * "
|
||||
"* * * * * * * * * * * * * * * * * * * * //\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::IOobject::writeEndDivider(Ostream& os)
|
||||
{
|
||||
os << "\n\n"
|
||||
"// *****************************************"
|
||||
"******************************** //\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOobject::writeHeader(Ostream& os, const word& type) const
|
||||
{
|
||||
@ -72,7 +134,7 @@ bool Foam::IOobject::writeHeader(Ostream& os, const word& type) const
|
||||
|
||||
if (os.format() == IOstream::BINARY)
|
||||
{
|
||||
os << " arch " << archHint << ";\n";
|
||||
os << " arch " << Foam::FOAMbuildArch << ";\n";
|
||||
}
|
||||
|
||||
if (!note().empty())
|
||||
|
||||
@ -37,7 +37,7 @@ License
|
||||
#include "sigInt.H"
|
||||
#include "sigQuit.H"
|
||||
#include "sigSegv.H"
|
||||
#include "endian.H"
|
||||
#include "foamVersion.H"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
@ -54,22 +54,6 @@ Foam::string::size_type Foam::argList::usageMin = 20;
|
||||
Foam::string::size_type Foam::argList::usageMax = 80;
|
||||
Foam::word Foam::argList::postProcessOptionName("postProcess");
|
||||
|
||||
// file-scope
|
||||
// Hint about machine endian, OpenFOAM label and scalar sizes
|
||||
static const std::string archHint =
|
||||
(
|
||||
#ifdef WM_LITTLE_ENDIAN
|
||||
"LSB"
|
||||
#elif defined (WM_BIG_ENDIAN)
|
||||
"MSB"
|
||||
#else
|
||||
"???"
|
||||
#endif
|
||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
||||
);
|
||||
|
||||
|
||||
Foam::argList::initValidTables::initValidTables()
|
||||
{
|
||||
argList::addOption
|
||||
@ -639,7 +623,7 @@ void Foam::argList::parse
|
||||
{
|
||||
IOobject::writeBanner(Info, true)
|
||||
<< "Build : " << Foam::FOAMbuild << nl
|
||||
<< "Arch : " << archHint << nl
|
||||
<< "Arch : " << Foam::FOAMbuildArch << nl
|
||||
<< "Exec : " << argListStr_.c_str() << nl
|
||||
<< "Date : " << dateString.c_str() << nl
|
||||
<< "Time : " << timeString.c_str() << nl
|
||||
@ -650,7 +634,7 @@ void Foam::argList::parse
|
||||
jobInfo.add("startDate", dateString);
|
||||
jobInfo.add("startTime", timeString);
|
||||
jobInfo.add("userName", userName());
|
||||
jobInfo.add("foamVersion", word(FOAMversion));
|
||||
jobInfo.add("foamVersion", word(Foam::FOAMversion));
|
||||
jobInfo.add("code", executable_);
|
||||
jobInfo.add("argList", argListStr_);
|
||||
jobInfo.add("currentDir", cwd());
|
||||
@ -660,10 +644,10 @@ void Foam::argList::parse
|
||||
// Add build information - only use the first word
|
||||
{
|
||||
std::string build(Foam::FOAMbuild);
|
||||
std::string::size_type found = build.find(' ');
|
||||
if (found != std::string::npos)
|
||||
std::string::size_type space = build.find(' ');
|
||||
if (space != std::string::npos)
|
||||
{
|
||||
build.resize(found);
|
||||
build.resize(space);
|
||||
}
|
||||
jobInfo.add("foamBuild", build);
|
||||
}
|
||||
@ -1247,7 +1231,7 @@ void Foam::argList::printUsage() const
|
||||
<<"Using: OpenFOAM-" << Foam::FOAMversion
|
||||
<< " (see www.OpenFOAM.com)" << nl
|
||||
<< "Build: " << Foam::FOAMbuild << nl
|
||||
<< "Arch: " << archHint << nl
|
||||
<< "Arch: " << Foam::FOAMbuildArch << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -32,13 +32,20 @@ Global
|
||||
Foam::FOAMversion
|
||||
|
||||
Description
|
||||
OpenFOAM version number static string.
|
||||
OpenFOAM version number as a static string.
|
||||
|
||||
Global
|
||||
Foam::FOAMbuild
|
||||
|
||||
Description
|
||||
OpenFOAM version number static string with build information
|
||||
OpenFOAM build information as a static string
|
||||
|
||||
Global
|
||||
Foam::FOAMbuildArch
|
||||
|
||||
Description
|
||||
OpenFOAM build architecture information (endian, label/scalar sizes)
|
||||
as a static string
|
||||
|
||||
SourceFiles
|
||||
global.Cver
|
||||
@ -48,6 +55,8 @@ SourceFiles
|
||||
#ifndef foamVersion_H
|
||||
#define foamVersion_H
|
||||
|
||||
#include <string>
|
||||
|
||||
// The directory name for user-resources (located in the HOME directory)
|
||||
#define WM_USER_RESOURCE_DIRNAME ".OpenFOAM"
|
||||
|
||||
@ -57,6 +66,7 @@ namespace Foam
|
||||
{
|
||||
extern const char* const FOAMversion;
|
||||
extern const char* const FOAMbuild;
|
||||
extern const std::string FOAMbuildArch;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,10 +33,30 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#include "foamVersion.H"
|
||||
#include "endian.H"
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const char* const Foam::FOAMversion = "VERSION_STRING";
|
||||
const char* const Foam::FOAMbuild = "BUILD_STRING";
|
||||
|
||||
// Information about machine endian, label and scalar sizes
|
||||
const std::string Foam::FOAMbuildArch =
|
||||
(
|
||||
#ifdef WM_LITTLE_ENDIAN
|
||||
"LSB"
|
||||
#elif defined (WM_BIG_ENDIAN)
|
||||
"MSB"
|
||||
#else
|
||||
"???"
|
||||
#endif
|
||||
";label=" + std::to_string(8*sizeof(Foam::label))
|
||||
+ ";scalar=" + std::to_string(8*sizeof(Foam::scalar))
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Setup an error handler for the global new operator
|
||||
|
||||
|
||||
Reference in New Issue
Block a user