diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index da2edd5534..4030179c68 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.C @@ -37,6 +37,7 @@ Description #include "simpleObjectRegistry.H" #include "IOobject.H" #include "HashSet.H" +#include "nullObject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -341,6 +342,8 @@ Foam::simpleObjectRegistry& Foam::debug::dimensionedConstantObjects() } +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + namespace Foam { @@ -356,6 +359,8 @@ static void listSwitches const bool unset ) { + IOobject::writeDivider(Info); + if (unset) { fileNameList controlDictFiles = findEtcFiles("controlDict", true); @@ -367,49 +372,69 @@ static void listSwitches controlDict.merge(dictionary(is)); } - IOobject::writeDivider(Info); - // Use a HashSet to track switches that have not been set wordHashSet hashed; // DebugSwitches - hashed = debugSwitches; - hashed.unset(controlDict.subDict("DebugSwitches").toc()); - - Info<< "Unset DebugSwitches" - << flatOutput(hashed.sortedToc(), -1) << nl; + if (notNull(debugSwitches)) + { + hashed = debugSwitches; + hashed.unset(controlDict.subDict("DebugSwitches").toc()); + Info<< "Unset DebugSwitches" + << flatOutput(hashed.sortedToc(), -1) << nl; + } // InfoSwitches - hashed = infoSwitches; - hashed.unset(controlDict.subDict("InfoSwitches").toc()); - - Info<< "Unset InfoSwitches" - << flatOutput(hashed.sortedToc(), -1) << nl; + if (notNull(infoSwitches)) + { + hashed = infoSwitches; + hashed.unset(controlDict.subDict("InfoSwitches").toc()); + Info<< "Unset InfoSwitches" + << flatOutput(hashed.sortedToc(), -1) << nl; + } // OptimisationSwitches - hashed = optSwitches; - hashed.unset(controlDict.subDict("OptimisationSwitches").toc()); + if (notNull(optSwitches)) + { + hashed = optSwitches; + hashed.unset(controlDict.subDict("OptimisationSwitches").toc()); - Info<< "Unset OptimisationSwitches" - << flatOutput(hashed.sortedToc(), -1) << nl; + Info<< "Unset OptimisationSwitches" + << flatOutput(hashed.sortedToc(), -1) << nl; + } } else { - IOobject::writeDivider(Info); - Info<< "DebugSwitches" - << flatOutput(debugSwitches, -1) << nl - << "InfoSwitches" - << flatOutput(infoSwitches, -1) << nl - << "OptimisationSwitches" - << flatOutput(optSwitches, -1) << nl; + // DebugSwitches + if (notNull(debugSwitches)) + { + Info<< "DebugSwitches" + << flatOutput(debugSwitches, -1) << nl; + } + + // InfoSwitches + if (notNull(infoSwitches)) + { + Info<< "InfoSwitches" + << flatOutput(infoSwitches, -1) << nl; + } + + // OptimisationSwitches + if (notNull(optSwitches)) + { + Info<< "OptimisationSwitches" + << flatOutput(optSwitches, -1) << nl; + } } } } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + void Foam::debug::listSwitches(const bool unset) { listSwitches @@ -422,6 +447,42 @@ void Foam::debug::listSwitches(const bool unset) } +void Foam::debug::listDebugSwitches(const bool unset) +{ + listSwitches + ( + debug::debugSwitches().sortedToc(), + wordList::null(), + wordList::null(), + unset + ); +} + + +void Foam::debug::listInfoSwitches(const bool unset) +{ + listSwitches + ( + wordList::null(), + debug::infoObjects().sortedToc(), + wordList::null(), + unset + ); +} + + +void Foam::debug::listOptimisationSwitches(const bool unset) +{ + listSwitches + ( + wordList::null(), + wordList::null(), + debug::optimisationSwitches().sortedToc(), + unset + ); +} + + void Foam::debug::listRegisteredSwitches(const bool unset) { listSwitches @@ -434,4 +495,40 @@ void Foam::debug::listRegisteredSwitches(const bool unset) } +void Foam::debug::listRegisteredDebugSwitches(const bool unset) +{ + listSwitches + ( + debug::debugObjects().sortedToc(), + wordList::null(), + wordList::null(), + unset + ); +} + + +void Foam::debug::listRegisteredInfoSwitches(const bool unset) +{ + listSwitches + ( + wordList::null(), + debug::infoObjects().sortedToc(), + wordList::null(), + unset + ); +} + + +void Foam::debug::listRegisteredOptimisationSwitches(const bool unset) +{ + listSwitches + ( + wordList::null(), + wordList::null(), + debug::optimisationObjects().sortedToc(), + unset + ); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/global/debug/debug.H b/src/OpenFOAM/global/debug/debug.H index f77157c4f0..2757e31a71 100644 --- a/src/OpenFOAM/global/debug/debug.H +++ b/src/OpenFOAM/global/debug/debug.H @@ -92,9 +92,6 @@ namespace debug //- Internal function to lookup a sub-dictionary from controlDict. dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr); - //- List debug switches - void listSwitches(const bool unset); - // Registered debug switches @@ -129,8 +126,33 @@ namespace debug //- Access to registered DimensionedConstants objects simpleObjectRegistry& dimensionedConstantObjects(); - //- List registered debug/info/optimisation switches - void listRegisteredSwitches(const bool unset); + + // List switches + + //- List debug/info/optimisation switches + void listSwitches(const bool unset = false); + + //- List debug switches + void listDebugSwitches(const bool unset = false); + + //- List info switches + void listInfoSwitches(const bool unset = false); + + //- List optimisation switches + void listOptimisationSwitches(const bool unset = false); + + + //- List registered debug/info/optimisation switches + void listRegisteredSwitches(const bool unset = false); + + //- List debug switches + void listRegisteredDebugSwitches(const bool unset = false); + + //- List info switches + void listRegisteredInfoSwitches(const bool unset = false); + + //- List optimisation switches + void listRegisteredOptimisationSwitches(const bool unset = false); } // End namespace debug diff --git a/src/OpenFOAM/include/setRootCaseListOptions.H b/src/OpenFOAM/include/setRootCaseListOptions.H index d7343c94b8..853cf8ebbd 100644 --- a/src/OpenFOAM/include/setRootCaseListOptions.H +++ b/src/OpenFOAM/include/setRootCaseListOptions.H @@ -7,19 +7,21 @@ argList::addBoolOption ( "listSwitches", - "List switches declared in libraries but not set in etc/controlDict", + "List switches declared in libraries" + " (see -listUnsetSwitches option)", true // advanced ); argList::addBoolOption ( "listRegisteredSwitches", - "List switches registered for run-time modification", + "List switches registered for run-time modification" + " (see -listUnsetSwitches option)", true // advanced ); argList::addBoolOption ( "listUnsetSwitches", - "List switches declared in libraries but not set in etc/controlDict", + "Modifies switch listing to display values not set in etc/controlDict", true // advanced ); diff --git a/src/OpenFOAM/include/setRootCaseListOutput.H b/src/OpenFOAM/include/setRootCaseListOutput.H index 0b8907d343..3943f6f2e2 100644 --- a/src/OpenFOAM/include/setRootCaseListOutput.H +++ b/src/OpenFOAM/include/setRootCaseListOutput.H @@ -9,13 +9,13 @@ if (args.found("listSwitches")) { - debug::listSwitches(args.found("includeUnsetSwitches")); + debug::listSwitches(args.found("listUnsetSwitches")); listOptions = true; } if (args.found("listRegisteredSwitches")) { - debug::listRegisteredSwitches(args.found("includeUnsetSwitches")); + debug::listRegisteredSwitches(args.found("listUnsetSwitches")); listOptions = true; }