diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/files b/applications/utilities/miscellaneous/foamDebugSwitches/Make/files
deleted file mode 100644
index c7d11dc828..0000000000
--- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-foamDebugSwitches.C
-
-EXE = $(FOAM_APPBIN)/foamDebugSwitches
diff --git a/applications/utilities/miscellaneous/foamList/Make/files b/applications/utilities/miscellaneous/foamList/Make/files
new file mode 100644
index 0000000000..92bda5e256
--- /dev/null
+++ b/applications/utilities/miscellaneous/foamList/Make/files
@@ -0,0 +1,3 @@
+foamList.C
+
+EXE = $(FOAM_APPBIN)/foamList
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamList/Make/options
similarity index 89%
rename from applications/utilities/miscellaneous/foamDebugSwitches/Make/options
rename to applications/utilities/miscellaneous/foamList/Make/options
index 331b481dff..ffba48c3f8 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
+++ b/applications/utilities/miscellaneous/foamList/Make/options
@@ -54,4 +54,7 @@ EXE_LIBS = \
-ltriSurface \
-lturbulenceModels \
-ltwoPhaseProperties \
- -lutilityFunctionObjects
+ -lutilityFunctionObjects \
+ -lphaseCompressibleTurbulenceModels \
+ -lcompressibleTwoPhaseSystem \
+ -lcompressibleEulerianInterfacialModels
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamList/foamList.C
similarity index 52%
rename from applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
rename to applications/utilities/miscellaneous/foamList/foamList.C
index 25c3fafebb..ff7c99593b 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
+++ b/applications/utilities/miscellaneous/foamList/foamList.C
@@ -22,15 +22,25 @@ License
along with OpenFOAM. If not, see .
Application
- foamDebugSwitches
+ foamList
Description
- Write out all library debug switches.
+ Print the table of contents of selectable switches, classes etc. in the
+ OpenFOAM libraries
+
+ \par Command-line options
+ \param -debug \n
+ Print the DebugSwitches, InfoSwitches and OptimisationSwitches
+ \param -unset \n
+ print switches declared in libraries but not set in etc/controlDict
+ \param -redundant \n
+ print switches not declared in libraries but set in etc/controlDict
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "dictionary.H"
+#include "simpleObjectRegistry.H"
#include "IFstream.H"
#include "IOobject.H"
#include "HashSet.H"
@@ -38,31 +48,14 @@ Description
using namespace Foam;
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-int main(int argc, char *argv[])
+void listDebug(const argList& args)
{
- argList::noParallel();
- argList::addBoolOption
- (
- "new",
- "output switches that are known from the libraries "
- "but that do not seem to be known in the current etc/controlDict"
- );
- argList::addBoolOption
- (
- "old",
- "output switches that appear to be unknown in "
- "the current etc/controlDict"
- );
+ // Switches declared in libraries
+ wordList libDebug(debug::debugObjects().sortedToc());
+ wordList libInfo(debug::infoObjects().sortedToc());
+ wordList libOpt(debug::optimisationObjects().sortedToc());
- argList args(argc, argv);
-
- wordList currDebug(debug::debugSwitches().toc());
- wordList currInfo(debug::infoSwitches().toc());
- wordList currOpt(debug::optimisationSwitches().toc());
-
- if (args.optionFound("old") || args.optionFound("new"))
+ if (args.optionFound("redundant") || args.optionFound("unset"))
{
fileNameList controlDictFiles = findEtcFiles("controlDict", true);
dictionary controlDict;
@@ -71,17 +64,17 @@ int main(int argc, char *argv[])
controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])()));
}
- wordHashSet oldDebug
+ wordHashSet controlDictDebug
(
controlDict.subDict("DebugSwitches").toc()
);
- wordHashSet oldInfo
+ wordHashSet controlDictInfo
(
controlDict.subDict("InfoSwitches").toc()
);
- wordHashSet oldOpt
+ wordHashSet controlDictOpt
(
controlDict.subDict("OptimisationSwitches").toc()
);
@@ -91,72 +84,101 @@ int main(int argc, char *argv[])
wordList listing;
- // list old switches - but this can't work since the (old) inserted
- // switches are in both sets
- // Workaround:
- // 1. run without any options (get complete list)
- // 2. comment out DebugSwitches, run again with -new to find new ones
- // and do a diff
- if (args.optionFound("old"))
+ // List redundant switches
+ if (args.optionFound("redundant"))
{
IOobject::writeDivider(Info);
- hashset = oldDebug;
- hashset -= currDebug;
+ hashset = controlDictDebug;
+ hashset -= libDebug;
listing = hashset.toc();
sort(listing);
- Info<< "old DebugSwitches: " << listing << endl;
+ Info<< "Redundant DebugSwitches: " << listing << endl;
- hashset = oldInfo;
- hashset -= currInfo;
+ hashset = controlDictInfo;
+ hashset -= libInfo;
listing = hashset.toc();
sort(listing);
- Info<< "old InfoSwitches: " << listing << endl;
+ Info<< "Redundant InfoSwitches: " << listing << endl;
- hashset = oldOpt;
- hashset -= currOpt;
+ hashset = controlDictOpt;
+ hashset -= libOpt;
listing = hashset.toc();
sort(listing);
- Info<< "old OptimisationSwitches: " << listing << endl;
+ Info<< "Redundant OptimisationSwitches: " << listing << endl;
}
- // list new switches
- if (args.optionFound("new"))
+ // List unset switches
+ if (args.optionFound("unset"))
{
IOobject::writeDivider(Info);
- hashset = currDebug;
- hashset -= oldDebug;
+ hashset = libDebug;
+ hashset -= controlDictDebug;
listing = hashset.toc();
sort(listing);
- Info<< "new DebugSwitches: " << listing << endl;
+ Info<< "Unset DebugSwitches: " << listing << endl;
- hashset = currInfo;
- hashset -= oldInfo;
+ hashset = libInfo;
+ hashset -= controlDictInfo;
listing = hashset.toc();
sort(listing);
- Info<< "new InfoSwitches: " << listing << endl;
+ Info<< "Unset InfoSwitches: " << listing << endl;
- hashset = currOpt;
- hashset -= oldOpt;
+ hashset = libOpt;
+ hashset -= controlDictOpt;
listing = hashset.toc();
sort(listing);
- Info<< "new OptimisationSwitches: " << listing << endl;
+ Info<< "Unset OptimisationSwitches: " << listing << endl;
}
}
else
{
IOobject::writeDivider(Info);
- sort(currDebug);
- Info<< "DebugSwitches: " << currDebug << endl;
+ sort(libDebug);
+ Info<< "DebugSwitches: " << libDebug << endl;
- sort(currInfo);
- Info<< "InfoSwitches: " << currInfo << endl;
+ sort(libInfo);
+ Info<< "InfoSwitches: " << libInfo << endl;
- sort(currOpt);
- Info<< "OptimisationSwitches: " << currOpt << endl;
+ sort(libOpt);
+ Info<< "OptimisationSwitches: " << libOpt << endl;
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+ argList::noParallel();
+ argList::addBoolOption
+ (
+ "debug",
+ "switches declared in libraries but not set in etc/controlDict"
+ );
+ argList::addBoolOption
+ (
+ "unset",
+ "switches declared in libraries but not set in etc/controlDict"
+ );
+ argList::addBoolOption
+ (
+ "redundant",
+ "switches not declared in libraries but set in etc/controlDict"
+ );
+
+ argList args(argc, argv);
+
+ if (!args.options().size())
+ {
+ args.printUsage();
+ }
+ else if (args.optionFound("debug"))
+ {
+ listDebug(args);
}
Info<< "done" << endl;
diff --git a/bin/foamDebugSwitches b/bin/foamDebugSwitches
new file mode 100755
index 0000000000..a8b1a6f670
--- /dev/null
+++ b/bin/foamDebugSwitches
@@ -0,0 +1,37 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
+# \\/ M anipulation |
+#-------------------------------------------------------------------------------
+# License
+# This file is part of OpenFOAM.
+#
+# OpenFOAM is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenFOAM. If not, see .
+#
+# Script
+# foamDebugSwitches
+#
+# Description
+# Script to suggest using the new "foamList" utility.
+#
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+echo $Script "has been superceded by the foamList utility:"
+echo "foamList -debug"
+
+#------------------------------------------------------------------------------
diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C
index 9693eb9488..2d6149dd0b 100644
--- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C
+++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C
@@ -182,6 +182,13 @@ Foam::wordList Foam::DictionaryBase::toc() const
}
+template
+Foam::wordList Foam::DictionaryBase::sortedToc() const
+{
+ return hashedTs_.sortedToc();
+}
+
+
template
void Foam::DictionaryBase::insert(const word& keyword, T* tPtr)
{
diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
index 9b85e01594..5676dfc16d 100644
--- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
+++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
@@ -128,6 +128,9 @@ public:
//- Return the table of contents
wordList toc() const;
+ //- Return the table of contents as a sorted list
+ wordList sortedToc() const;
+
// Editing
diff --git a/src/OpenFOAM/global/debug/simpleObjectRegistry.H b/src/OpenFOAM/global/debug/simpleObjectRegistry.H
index ecf9a5844c..b994a08bff 100644
--- a/src/OpenFOAM/global/debug/simpleObjectRegistry.H
+++ b/src/OpenFOAM/global/debug/simpleObjectRegistry.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -77,7 +77,6 @@ public:
:
Dictionary(nIoObjects)
{}
-
};