foamDebugSwitches -> foamList -debug
This commit is contained in:
parent
603e34d514
commit
c8188265f1
@ -1,3 +0,0 @@
|
||||
foamDebugSwitches.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/foamDebugSwitches
|
3
applications/utilities/miscellaneous/foamList/Make/files
Normal file
3
applications/utilities/miscellaneous/foamList/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
foamList.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/foamList
|
@ -54,4 +54,7 @@ EXE_LIBS = \
|
||||
-ltriSurface \
|
||||
-lturbulenceModels \
|
||||
-ltwoPhaseProperties \
|
||||
-lutilityFunctionObjects
|
||||
-lutilityFunctionObjects \
|
||||
-lphaseCompressibleTurbulenceModels \
|
||||
-lcompressibleTwoPhaseSystem \
|
||||
-lcompressibleEulerianInterfacialModels
|
@ -22,15 +22,25 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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;
|
37
bin/foamDebugSwitches
Executable file
37
bin/foamDebugSwitches
Executable file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# 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"
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -182,6 +182,13 @@ Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
|
||||
}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
Foam::wordList Foam::DictionaryBase<IDLListType, T>::sortedToc() const
|
||||
{
|
||||
return hashedTs_.sortedToc();
|
||||
}
|
||||
|
||||
|
||||
template<class IDLListType, class T>
|
||||
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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<simpleObjectRegistryEntry>(nIoObjects)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user