ENH: argList option to remove the noFunctionObjects option (issue #352)

This commit is contained in:
Mark Olesen
2016-12-19 20:08:58 +01:00
parent c2b0531081
commit f45db9cec9
2 changed files with 35 additions and 8 deletions

View File

@ -158,6 +158,21 @@ void Foam::argList::noBanner()
}
void Foam::argList::noFunctionObjects(bool addWithOption)
{
removeOption("noFunctionObjects");
if (addWithOption)
{
addBoolOption
(
"withFunctionObjects",
"execute functionObjects"
);
}
}
void Foam::argList::noParallel()
{
removeOption("parallel");
@ -459,6 +474,9 @@ Foam::argList::argList
)
)
{
// If the option is known to require an argument,
// get it or emit a FatalError.
++argI;
if (argI >= args_.size())
{
@ -475,6 +493,9 @@ Foam::argList::argList
}
else
{
// All other options (including unknown ones) are simply
// registered as existing.
options_.insert(optionName, "");
}
}
@ -527,29 +548,31 @@ void Foam::argList::parse
// -help print the usage
// -doc display application documentation in browser
// -srcDoc display source code in browser
if
(
options_.found("help")
|| options_.found("doc")
|| options_.found("srcDoc")
)
{
bool quickExit = false;
if (options_.found("help"))
{
printUsage();
quickExit = true;
}
// Only display one or the other
if (options_.found("srcDoc"))
{
displayDoc(true);
quickExit = true;
}
else if (options_.found("doc"))
{
displayDoc(false);
quickExit = true;
}
::exit(0);
if (quickExit)
{
::exit(0);
}
}
// Print the usage message and exit if the number of arguments is incorrect

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -348,6 +348,10 @@ public:
//- Disable emitting the banner information
static void noBanner();
//- Remove the 'noFunctionObjects' option,
// optionally adding a 'withFunctionObjects' option instead
static void noFunctionObjects(bool addWithOption = false);
//- Remove the parallel options
static void noParallel();