mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
messageStream: Added support for suppressing the printing of log header
This generalizes and replaces the previous "noBanner" option provided by argList and is extended to include the messages printed by Time. Resolves bug-report https://bugs.openfoam.org/view.php?id=2782
This commit is contained in:
@ -26,7 +26,6 @@ Application
|
||||
|
||||
Description
|
||||
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
@ -62,7 +61,8 @@ void printCleaning(fileName& pathName)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
writeInfoHeader = false;
|
||||
|
||||
argList::noParallel();
|
||||
argList::validArgs.insert("fileName .. fileNameN");
|
||||
argList::addOption("istream", "file", "test Istream values");
|
||||
|
||||
@ -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-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,8 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
writeInfoHeader = false;
|
||||
|
||||
argList::noParallel();
|
||||
argList::validArgs.insert("file .. fileN");
|
||||
|
||||
|
||||
@ -238,9 +238,9 @@ void remove(dictionary& dict, const dictionary& removeDict)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote("manipulates dictionaries");
|
||||
writeInfoHeader = false;
|
||||
|
||||
argList::noBanner();
|
||||
argList::addNote("manipulates dictionaries");
|
||||
argList::validArgs.append("dictionary file");
|
||||
argList::addBoolOption("keywords", "list keywords");
|
||||
argList::addOption("entry", "name", "report/select the named entry");
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,10 +49,10 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote("List times using timeSelector");
|
||||
writeInfoHeader = false;
|
||||
|
||||
argList::addNote("List times using timeSelector");
|
||||
timeSelector::addOptions(true, true);
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -68,12 +68,13 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
writeInfoHeader = false;
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"information about surface meshes"
|
||||
);
|
||||
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::validArgs.append("surface file");
|
||||
|
||||
|
||||
@ -48,7 +48,8 @@ void Foam::Time::readDict()
|
||||
// Debug switches
|
||||
if (controlDict_.found("DebugSwitches"))
|
||||
{
|
||||
Info<< "Overriding DebugSwitches according to " << controlDict_.name()
|
||||
InfoHeader
|
||||
<< "Overriding DebugSwitches according to " << controlDict_.name()
|
||||
<< endl;
|
||||
|
||||
simpleObjectRegistry& objects = debug::debugObjects();
|
||||
@ -61,7 +62,7 @@ void Foam::Time::readDict()
|
||||
|
||||
if (objPtr)
|
||||
{
|
||||
Info<< " " << iter() << endl;
|
||||
InfoHeader << " " << iter() << endl;
|
||||
|
||||
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||
|
||||
@ -89,7 +90,8 @@ void Foam::Time::readDict()
|
||||
// Optimisation Switches
|
||||
if (controlDict_.found("OptimisationSwitches"))
|
||||
{
|
||||
Info<< "Overriding OptimisationSwitches according to "
|
||||
InfoHeader
|
||||
<< "Overriding OptimisationSwitches according to "
|
||||
<< controlDict_.name() << endl;
|
||||
|
||||
simpleObjectRegistry& objects = debug::optimisationObjects();
|
||||
@ -105,7 +107,7 @@ void Foam::Time::readDict()
|
||||
|
||||
if (objPtr)
|
||||
{
|
||||
Info<< " " << iter() << endl;
|
||||
InfoHeader << " " << iter() << endl;
|
||||
|
||||
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||
|
||||
@ -150,7 +152,8 @@ void Foam::Time::readDict()
|
||||
controlDict_.watchIndices().clear();
|
||||
|
||||
// Installing the new handler
|
||||
Info<< "Overriding fileHandler to " << fileHandlerName << endl;
|
||||
InfoHeader
|
||||
<< "Overriding fileHandler to " << fileHandlerName << endl;
|
||||
|
||||
autoPtr<fileOperation> handler
|
||||
(
|
||||
@ -172,7 +175,8 @@ void Foam::Time::readDict()
|
||||
// the 'unitSet' might be changed and the individual values
|
||||
if (controlDict_.found("DimensionedConstants"))
|
||||
{
|
||||
Info<< "Overriding DimensionedConstants according to "
|
||||
InfoHeader
|
||||
<< "Overriding DimensionedConstants according to "
|
||||
<< controlDict_.name() << endl;
|
||||
|
||||
// Change in-memory
|
||||
@ -194,9 +198,13 @@ void Foam::Time::readDict()
|
||||
{
|
||||
objects[i]->readData(dummyIs);
|
||||
|
||||
Info<< " ";
|
||||
objects[i]->writeData(Info);
|
||||
Info<< endl;
|
||||
if (writeInfoHeader)
|
||||
{
|
||||
|
||||
Info<< " ";
|
||||
objects[i]->writeData(Info);
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,7 +213,8 @@ void Foam::Time::readDict()
|
||||
// Dimension sets
|
||||
if (controlDict_.found("DimensionSets"))
|
||||
{
|
||||
Info<< "Overriding DimensionSets according to "
|
||||
InfoHeader
|
||||
<< "Overriding DimensionSets according to "
|
||||
<< controlDict_.name() << endl;
|
||||
|
||||
dictionary dict(Foam::dimensionSystems());
|
||||
@ -217,7 +226,7 @@ void Foam::Time::readDict()
|
||||
|
||||
if (objPtr)
|
||||
{
|
||||
Info<< controlDict_.subDict("DimensionSets") << endl;
|
||||
InfoHeader << controlDict_.subDict("DimensionSets") << endl;
|
||||
|
||||
const List<simpleRegIOobject*>& objects = *objPtr;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -254,5 +254,6 @@ Foam::messageStream Foam::Warning
|
||||
|
||||
Foam::messageStream Foam::Info("", messageStream::INFO);
|
||||
|
||||
bool Foam::writeInfoHeader = true;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -206,6 +206,7 @@ public:
|
||||
extern messageStream SeriousError;
|
||||
extern messageStream Warning;
|
||||
extern messageStream Info;
|
||||
extern bool writeInfoHeader;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -281,6 +282,10 @@ extern messageStream Info;
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
#define InfoInFunction InfoIn(FUNCTION_NAME)
|
||||
|
||||
//- Report write to Foam::Info if the local log switch is true
|
||||
#define InfoHeader \
|
||||
if (::Foam::writeInfoHeader) Info
|
||||
|
||||
//- Report write to Foam::Info if the local log switch is true
|
||||
#define Log \
|
||||
if (log) Info
|
||||
|
||||
@ -39,7 +39,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::argList::bannerEnabled = true;
|
||||
Foam::SLList<Foam::string> Foam::argList::validArgs;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
||||
@ -145,12 +144,6 @@ void Foam::argList::removeOption(const word& opt)
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::noBanner()
|
||||
{
|
||||
bannerEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::noParallel()
|
||||
{
|
||||
removeOption("parallel");
|
||||
@ -557,7 +550,7 @@ void Foam::argList::parse
|
||||
string timeString = clock::clockTime();
|
||||
|
||||
// Print the banner once only for parallel runs
|
||||
if (Pstream::master() && bannerEnabled)
|
||||
if (Pstream::master() && writeInfoHeader)
|
||||
{
|
||||
IOobject::writeBanner(Info, true)
|
||||
<< "Build : " << Foam::FOAMbuild << nl
|
||||
@ -615,7 +608,7 @@ void Foam::argList::parse
|
||||
fileOperation::New
|
||||
(
|
||||
handlerType,
|
||||
bannerEnabled
|
||||
writeInfoHeader
|
||||
)
|
||||
);
|
||||
Foam::fileHandler(handler);
|
||||
@ -867,7 +860,7 @@ void Foam::argList::parse
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::master() && bannerEnabled)
|
||||
if (Pstream::master() && writeInfoHeader)
|
||||
{
|
||||
Info<< "Case : " << (rootPath_/globalCase_).c_str() << nl
|
||||
<< "nProcs : " << nProcs << endl;
|
||||
@ -906,12 +899,12 @@ void Foam::argList::parse
|
||||
|
||||
// Switch on signal trapping. We have to wait until after Pstream::init
|
||||
// since this sets up its own ones.
|
||||
sigFpe_.set(bannerEnabled);
|
||||
sigInt_.set(bannerEnabled);
|
||||
sigQuit_.set(bannerEnabled);
|
||||
sigSegv_.set(bannerEnabled);
|
||||
sigFpe_.set(writeInfoHeader);
|
||||
sigInt_.set(writeInfoHeader);
|
||||
sigQuit_.set(writeInfoHeader);
|
||||
sigSegv_.set(writeInfoHeader);
|
||||
|
||||
if (bannerEnabled)
|
||||
if (writeInfoHeader)
|
||||
{
|
||||
Info<< "fileModificationChecking : "
|
||||
<< "Monitoring run-time modified files using "
|
||||
@ -948,7 +941,7 @@ void Foam::argList::parse
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master() && bannerEnabled)
|
||||
if (Pstream::master() && writeInfoHeader)
|
||||
{
|
||||
Info<< endl;
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
@ -104,8 +104,6 @@ class argList
|
||||
{
|
||||
// Private data
|
||||
|
||||
static bool bannerEnabled;
|
||||
|
||||
//- Switch on/off parallel mode. Has to be first to be constructed
|
||||
// so destructor is done last.
|
||||
ParRunControl parRunControl_;
|
||||
@ -357,9 +355,6 @@ public:
|
||||
//- Remove option from validOptions and from optionUsage
|
||||
static void removeOption(const word& opt);
|
||||
|
||||
//- Disable emitting the banner information
|
||||
static void noBanner();
|
||||
|
||||
//- Remove the parallel options
|
||||
static void noParallel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user