diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 8066d1a83a5f5bd6d8bb09169b4a07cb05b19c97..87c8c30f03eba0aa22db99281531f8ebf4409f45 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -39,10 +39,6 @@ License #include "sigSegv.H" #include "foamVersion.H" -#include "simpleObjectRegistry.H" -#include "HashSet.H" -#include "etcFiles.H" - #include <cctype> // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -1298,88 +1294,6 @@ void Foam::argList::displayDoc(bool source) const } -void Foam::argList::listSwitches -( - const wordList& debugSwitches, - const wordList& infoSwitches, - const wordList& optSwitches, - const bool unset -) -{ - if (unset) - { - fileNameList controlDictFiles = findEtcFiles("controlDict", true); - dictionary controlDict; - forAllReverse(controlDictFiles, cdfi) - { - controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])())); - } - - wordHashSet controlDictDebug - ( - controlDict.subDict("DebugSwitches").sortedToc() - ); - - wordHashSet controlDictInfo - ( - controlDict.subDict("InfoSwitches").sortedToc() - ); - - wordHashSet controlDictOpt - ( - controlDict.subDict("OptimisationSwitches").sortedToc() - ); - - - IOobject::writeDivider(Info); - - wordHashSet hashset; - hashset = debugSwitches; - hashset -= controlDictDebug; - Info<< "Unset DebugSwitches" << hashset.sortedToc() << endl; - - hashset = infoSwitches; - hashset -= controlDictInfo; - Info<< "Unset InfoSwitches" << hashset.sortedToc() << endl; - - hashset = optSwitches; - hashset -= controlDictOpt; - Info<< "Unset OptimisationSwitches" << hashset.sortedToc() << endl; - } - else - { - IOobject::writeDivider(Info); - Info<< "DebugSwitches" << debugSwitches << endl; - Info<< "InfoSwitches" << infoSwitches << endl; - Info<< "OptimisationSwitches" << optSwitches << endl; - } -} - - -void Foam::argList::listSwitches(const bool unset) const -{ - listSwitches - ( - debug::debugSwitches().sortedToc(), - debug::infoSwitches().sortedToc(), - debug::optimisationSwitches().sortedToc(), - unset - ); -} - - -void Foam::argList::listRegisteredSwitches(const bool unset) const -{ - listSwitches - ( - debug::debugObjects().sortedToc(), - debug::infoObjects().sortedToc(), - debug::optimisationObjects().sortedToc(), - unset - ); -} - - bool Foam::argList::check(bool checkArgs, bool checkOpts) const { bool ok = true; diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index b76cdb1a04324201db5e05be2c83a467a9da7370..b60cd9fa135cb5064263bb9fac5a055019b73048 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -160,15 +160,6 @@ class argList // return true if any "(" ... ")" sequences were captured bool regroupArgv(int& argc, char**& argv); - //- List debug switches - static void listSwitches - ( - const wordList& debugSwitches, - const wordList& infoSwitches, - const wordList& optSwitches, - const bool unset - ); - public: @@ -430,12 +421,6 @@ public: // Optionally display the application source code void displayDoc(bool source=false) const; - //- List debug switches - void listSwitches(const bool unset) const; - - //- List registered debug switches - void listRegisteredSwitches(const bool unset) const; - // Check diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index bdf1698d07c08da045afec641a24c8dd81af8b15..bf5b90582ed987a4156b1db9f1f083ef6124d866 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.C @@ -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 @@ -33,6 +33,8 @@ Description #include "Ostream.H" #include "demandDrivenData.H" #include "simpleObjectRegistry.H" +#include "IOobject.H" +#include "HashSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -378,4 +380,91 @@ Foam::simpleObjectRegistry& Foam::debug::dimensionedConstantObjects() } +namespace Foam +{ + +void listSwitches +( + const wordList& debugSwitches, + const wordList& infoSwitches, + const wordList& optSwitches, + const bool unset +) +{ + if (unset) + { + fileNameList controlDictFiles = findEtcFiles("controlDict", true); + dictionary controlDict; + forAllReverse(controlDictFiles, cdfi) + { + controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])())); + } + + wordHashSet controlDictDebug + ( + controlDict.subDict("DebugSwitches").sortedToc() + ); + + wordHashSet controlDictInfo + ( + controlDict.subDict("InfoSwitches").sortedToc() + ); + + wordHashSet controlDictOpt + ( + controlDict.subDict("OptimisationSwitches").sortedToc() + ); + + + IOobject::writeDivider(Info); + + wordHashSet hashset; + hashset = debugSwitches; + hashset -= controlDictDebug; + Info<< "Unset DebugSwitches" << hashset.sortedToc() << endl; + + hashset = infoSwitches; + hashset -= controlDictInfo; + Info<< "Unset InfoSwitches" << hashset.sortedToc() << endl; + + hashset = optSwitches; + hashset -= controlDictOpt; + Info<< "Unset OptimisationSwitches" << hashset.sortedToc() << endl; + } + else + { + IOobject::writeDivider(Info); + Info<< "DebugSwitches" << debugSwitches << endl; + Info<< "InfoSwitches" << infoSwitches << endl; + Info<< "OptimisationSwitches" << optSwitches << endl; + } +} + +} + + +void Foam::debug::listSwitches(const bool unset) +{ + listSwitches + ( + debug::debugSwitches().sortedToc(), + debug::infoSwitches().sortedToc(), + debug::optimisationSwitches().sortedToc(), + unset + ); +} + + +void Foam::debug::listRegisteredSwitches(const bool unset) +{ + listSwitches + ( + debug::debugObjects().sortedToc(), + debug::infoObjects().sortedToc(), + debug::optimisationObjects().sortedToc(), + unset + ); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/global/debug/debug.H b/src/OpenFOAM/global/debug/debug.H index 190f73be3029b485e9947a1dc9615edd89134328..468415140b1d946a1f01b4db69d5dafe628f7115 100644 --- a/src/OpenFOAM/global/debug/debug.H +++ b/src/OpenFOAM/global/debug/debug.H @@ -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 @@ -84,6 +84,8 @@ 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 @@ -119,6 +121,9 @@ namespace debug //- Get access to registered dimensionedConstant switch objects simpleObjectRegistry& dimensionedConstantObjects(); + //- List registered debug switches + void listRegisteredSwitches(const bool unset); + } // End namespace debug diff --git a/src/OpenFOAM/include/listOutput.H b/src/OpenFOAM/include/listOutput.H index ca852a6b60e77b418a42bdea76a3b53e4380b675..876a52f67d7577c5e46c7beed823737046fb96ee 100644 --- a/src/OpenFOAM/include/listOutput.H +++ b/src/OpenFOAM/include/listOutput.H @@ -5,7 +5,7 @@ if args.optionFound("listSwitches") ) { - args.listSwitches(args.optionFound("includeUnsetSwitches")); + debug::listSwitches(args.optionFound("includeUnsetSwitches")); listOptions = true; } @@ -14,7 +14,7 @@ if args.optionFound("listRegisteredSwitches") ) { - args.listRegisteredSwitches(args.optionFound("includeUnsetSwitches")); + debug::listRegisteredSwitches(args.optionFound("includeUnsetSwitches")); listOptions = true; }