mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
foamDebugSwitches -> foamList -debug
This commit is contained in:
@ -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 \
|
-ltriSurface \
|
||||||
-lturbulenceModels \
|
-lturbulenceModels \
|
||||||
-ltwoPhaseProperties \
|
-ltwoPhaseProperties \
|
||||||
-lutilityFunctionObjects
|
-lutilityFunctionObjects \
|
||||||
|
-lphaseCompressibleTurbulenceModels \
|
||||||
|
-lcompressibleTwoPhaseSystem \
|
||||||
|
-lcompressibleEulerianInterfacialModels
|
||||||
@ -22,15 +22,25 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
foamDebugSwitches
|
foamList
|
||||||
|
|
||||||
Description
|
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 "argList.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
#include "simpleObjectRegistry.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "IOobject.H"
|
#include "IOobject.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -38,31 +48,14 @@ Description
|
|||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
void listDebug(const argList& args)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
argList::noParallel();
|
// Switches declared in libraries
|
||||||
argList::addBoolOption
|
wordList libDebug(debug::debugObjects().sortedToc());
|
||||||
(
|
wordList libInfo(debug::infoObjects().sortedToc());
|
||||||
"new",
|
wordList libOpt(debug::optimisationObjects().sortedToc());
|
||||||
"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"
|
|
||||||
);
|
|
||||||
|
|
||||||
argList args(argc, argv);
|
if (args.optionFound("redundant") || args.optionFound("unset"))
|
||||||
|
|
||||||
wordList currDebug(debug::debugSwitches().toc());
|
|
||||||
wordList currInfo(debug::infoSwitches().toc());
|
|
||||||
wordList currOpt(debug::optimisationSwitches().toc());
|
|
||||||
|
|
||||||
if (args.optionFound("old") || args.optionFound("new"))
|
|
||||||
{
|
{
|
||||||
fileNameList controlDictFiles = findEtcFiles("controlDict", true);
|
fileNameList controlDictFiles = findEtcFiles("controlDict", true);
|
||||||
dictionary controlDict;
|
dictionary controlDict;
|
||||||
@ -71,17 +64,17 @@ int main(int argc, char *argv[])
|
|||||||
controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])()));
|
controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])()));
|
||||||
}
|
}
|
||||||
|
|
||||||
wordHashSet oldDebug
|
wordHashSet controlDictDebug
|
||||||
(
|
(
|
||||||
controlDict.subDict("DebugSwitches").toc()
|
controlDict.subDict("DebugSwitches").toc()
|
||||||
);
|
);
|
||||||
|
|
||||||
wordHashSet oldInfo
|
wordHashSet controlDictInfo
|
||||||
(
|
(
|
||||||
controlDict.subDict("InfoSwitches").toc()
|
controlDict.subDict("InfoSwitches").toc()
|
||||||
);
|
);
|
||||||
|
|
||||||
wordHashSet oldOpt
|
wordHashSet controlDictOpt
|
||||||
(
|
(
|
||||||
controlDict.subDict("OptimisationSwitches").toc()
|
controlDict.subDict("OptimisationSwitches").toc()
|
||||||
);
|
);
|
||||||
@ -91,72 +84,101 @@ int main(int argc, char *argv[])
|
|||||||
wordList listing;
|
wordList listing;
|
||||||
|
|
||||||
|
|
||||||
// list old switches - but this can't work since the (old) inserted
|
// List redundant switches
|
||||||
// switches are in both sets
|
if (args.optionFound("redundant"))
|
||||||
// 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"))
|
|
||||||
{
|
{
|
||||||
IOobject::writeDivider(Info);
|
IOobject::writeDivider(Info);
|
||||||
|
|
||||||
hashset = oldDebug;
|
hashset = controlDictDebug;
|
||||||
hashset -= currDebug;
|
hashset -= libDebug;
|
||||||
listing = hashset.toc();
|
listing = hashset.toc();
|
||||||
sort(listing);
|
sort(listing);
|
||||||
Info<< "old DebugSwitches: " << listing << endl;
|
Info<< "Redundant DebugSwitches: " << listing << endl;
|
||||||
|
|
||||||
hashset = oldInfo;
|
hashset = controlDictInfo;
|
||||||
hashset -= currInfo;
|
hashset -= libInfo;
|
||||||
listing = hashset.toc();
|
listing = hashset.toc();
|
||||||
sort(listing);
|
sort(listing);
|
||||||
Info<< "old InfoSwitches: " << listing << endl;
|
Info<< "Redundant InfoSwitches: " << listing << endl;
|
||||||
|
|
||||||
hashset = oldOpt;
|
hashset = controlDictOpt;
|
||||||
hashset -= currOpt;
|
hashset -= libOpt;
|
||||||
listing = hashset.toc();
|
listing = hashset.toc();
|
||||||
sort(listing);
|
sort(listing);
|
||||||
Info<< "old OptimisationSwitches: " << listing << endl;
|
Info<< "Redundant OptimisationSwitches: " << listing << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// list new switches
|
// List unset switches
|
||||||
if (args.optionFound("new"))
|
if (args.optionFound("unset"))
|
||||||
{
|
{
|
||||||
IOobject::writeDivider(Info);
|
IOobject::writeDivider(Info);
|
||||||
|
|
||||||
hashset = currDebug;
|
hashset = libDebug;
|
||||||
hashset -= oldDebug;
|
hashset -= controlDictDebug;
|
||||||
|
|
||||||
listing = hashset.toc();
|
listing = hashset.toc();
|
||||||
sort(listing);
|
sort(listing);
|
||||||
Info<< "new DebugSwitches: " << listing << endl;
|
Info<< "Unset DebugSwitches: " << listing << endl;
|
||||||
|
|
||||||
hashset = currInfo;
|
hashset = libInfo;
|
||||||
hashset -= oldInfo;
|
hashset -= controlDictInfo;
|
||||||
listing = hashset.toc();
|
listing = hashset.toc();
|
||||||
sort(listing);
|
sort(listing);
|
||||||
Info<< "new InfoSwitches: " << listing << endl;
|
Info<< "Unset InfoSwitches: " << listing << endl;
|
||||||
|
|
||||||
hashset = currOpt;
|
hashset = libOpt;
|
||||||
hashset -= oldOpt;
|
hashset -= controlDictOpt;
|
||||||
listing = hashset.toc();
|
listing = hashset.toc();
|
||||||
sort(listing);
|
sort(listing);
|
||||||
Info<< "new OptimisationSwitches: " << listing << endl;
|
Info<< "Unset OptimisationSwitches: " << listing << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IOobject::writeDivider(Info);
|
IOobject::writeDivider(Info);
|
||||||
|
|
||||||
sort(currDebug);
|
sort(libDebug);
|
||||||
Info<< "DebugSwitches: " << currDebug << endl;
|
Info<< "DebugSwitches: " << libDebug << endl;
|
||||||
|
|
||||||
sort(currInfo);
|
sort(libInfo);
|
||||||
Info<< "InfoSwitches: " << currInfo << endl;
|
Info<< "InfoSwitches: " << libInfo << endl;
|
||||||
|
|
||||||
sort(currOpt);
|
sort(libOpt);
|
||||||
Info<< "OptimisationSwitches: " << currOpt << endl;
|
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;
|
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>
|
template<class IDLListType, class T>
|
||||||
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,6 +128,9 @@ public:
|
|||||||
//- Return the table of contents
|
//- Return the table of contents
|
||||||
wordList toc() const;
|
wordList toc() const;
|
||||||
|
|
||||||
|
//- Return the table of contents as a sorted list
|
||||||
|
wordList sortedToc() const;
|
||||||
|
|
||||||
|
|
||||||
// Editing
|
// Editing
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -77,7 +77,6 @@ public:
|
|||||||
:
|
:
|
||||||
Dictionary<simpleObjectRegistryEntry>(nIoObjects)
|
Dictionary<simpleObjectRegistryEntry>(nIoObjects)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user