controlSwitches: - Addition of the command-line option -dumpControlSwitches
- Display at the console all the controlSwitches for a given application. - Getting rid of the application foamDebugSwitches - Some code cleanup.
This commit is contained in:
parent
473f85c949
commit
23f4d5cb81
15 changed files with 472 additions and 307 deletions
|
@ -1,3 +0,0 @@
|
||||||
foamDebugSwitches.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/foamDebugSwitches
|
|
|
@ -1,46 +0,0 @@
|
||||||
EXE_LIBS = \
|
|
||||||
-lbasicThermophysicalModels \
|
|
||||||
-lchemistryModel \
|
|
||||||
-lreactionThermophysicalModels \
|
|
||||||
-lcompressibleLESModels \
|
|
||||||
-ldecompositionMethods \
|
|
||||||
-ldieselSpray \
|
|
||||||
-ldynamicFvMesh \
|
|
||||||
-ldynamicMesh \
|
|
||||||
-ledgeMesh \
|
|
||||||
-lengine \
|
|
||||||
-lerrorEstimation \
|
|
||||||
-lfiniteVolume \
|
|
||||||
-lfiniteArea \
|
|
||||||
-lfoam \
|
|
||||||
-ltetFiniteElement \
|
|
||||||
-ltetMotionSolver \
|
|
||||||
-lforces \
|
|
||||||
-lfvMotionSolver \
|
|
||||||
-lincompressibleLESModels \
|
|
||||||
-lincompressibleTransportModels \
|
|
||||||
-lcompressibleRASModels \
|
|
||||||
-lincompressibleRASModels \
|
|
||||||
-linterfaceProperties \
|
|
||||||
-llagrangianIntermediate \
|
|
||||||
-llagrangian \
|
|
||||||
-llaminarFlameSpeedModels \
|
|
||||||
-lLESdeltas \
|
|
||||||
-lLESfilters \
|
|
||||||
-lliquidMixture \
|
|
||||||
-lliquids \
|
|
||||||
-lmeshTools \
|
|
||||||
-lODE \
|
|
||||||
-lpdf \
|
|
||||||
-lphaseModel \
|
|
||||||
-lradiation \
|
|
||||||
-lrandomProcesses \
|
|
||||||
-lsampling \
|
|
||||||
-lsolidMixture \
|
|
||||||
-lsolids \
|
|
||||||
-lspecie \
|
|
||||||
-lthermophysicalFunctions \
|
|
||||||
-ltopoChangerFvMesh \
|
|
||||||
-ltriSurface \
|
|
||||||
-lautoMesh \
|
|
||||||
-L$(MESQUITE_LIB_DIR) -lmesquite
|
|
|
@ -1,242 +0,0 @@
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | foam-extend: Open Source CFD
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | For copyright notice see file Copyright
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of foam-extend.
|
|
||||||
|
|
||||||
foam-extend 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.
|
|
||||||
|
|
||||||
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
|
||||||
Write out all library debug switches
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "argList.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
#include "IFstream.H"
|
|
||||||
#include "IOobject.H"
|
|
||||||
#include "HashSet.H"
|
|
||||||
|
|
||||||
using namespace Foam;
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
// Main program:
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
argList::noParallel();
|
|
||||||
argList::validOptions.insert("new", "");
|
|
||||||
argList::validOptions.insert("old", "");
|
|
||||||
|
|
||||||
Foam::argList args(argc, argv);
|
|
||||||
|
|
||||||
wordList currDebug(debug::debugSwitches().toc());
|
|
||||||
wordList currInfo(debug::infoSwitches().toc());
|
|
||||||
wordList currOpt(debug::optimisationSwitches().toc());
|
|
||||||
wordList currTol(debug::tolerances().toc());
|
|
||||||
wordList currConst(debug::constants().toc());
|
|
||||||
|
|
||||||
if (args.optionFound("old") || args.optionFound("new"))
|
|
||||||
{
|
|
||||||
dictionary controlDict(IFstream(findEtcFile("controlDict", true))());
|
|
||||||
|
|
||||||
wordHashSet oldDebug
|
|
||||||
(
|
|
||||||
controlDict.subDict("DebugSwitches").toc()
|
|
||||||
);
|
|
||||||
|
|
||||||
wordHashSet oldInfo
|
|
||||||
(
|
|
||||||
controlDict.subDict("InfoSwitches").toc()
|
|
||||||
);
|
|
||||||
|
|
||||||
wordHashSet oldOpt
|
|
||||||
(
|
|
||||||
controlDict.subDict("OptimisationSwitches").toc()
|
|
||||||
);
|
|
||||||
|
|
||||||
wordHashSet oldTol
|
|
||||||
(
|
|
||||||
controlDict.subDict("Tolerances").toc()
|
|
||||||
);
|
|
||||||
|
|
||||||
wordHashSet oldConst
|
|
||||||
(
|
|
||||||
controlDict.subDict("DimensionedConstants").toc()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
wordHashSet hashset;
|
|
||||||
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"))
|
|
||||||
{
|
|
||||||
IOobject::writeDivider(Info);
|
|
||||||
|
|
||||||
hashset = wordHashSet(oldDebug);
|
|
||||||
hashset -= wordHashSet(currDebug);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "old DebugSwitches: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(oldInfo);
|
|
||||||
hashset -= wordHashSet(currInfo);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "old InfoSwitches: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(oldOpt);
|
|
||||||
hashset -= wordHashSet(currOpt);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "old OptimisationSwitches: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(oldTol);
|
|
||||||
hashset -= wordHashSet(currTol);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "old Tolerances: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(oldConst);
|
|
||||||
hashset -= wordHashSet(currConst);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "old DimensionedConstants: " << listing << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// list new switches
|
|
||||||
if (args.optionFound("new"))
|
|
||||||
{
|
|
||||||
IOobject::writeDivider(Info);
|
|
||||||
|
|
||||||
hashset = wordHashSet(currDebug);
|
|
||||||
hashset -= wordHashSet(oldDebug);
|
|
||||||
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "new DebugSwitches: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(currInfo);
|
|
||||||
hashset -= wordHashSet(oldInfo);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "new InfoSwitches: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(currOpt);
|
|
||||||
hashset -= wordHashSet(oldOpt);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "new OptimisationSwitches: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(currTol);
|
|
||||||
hashset -= wordHashSet(oldTol);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "new Tolerances: " << listing << endl;
|
|
||||||
|
|
||||||
hashset = wordHashSet(currConst);
|
|
||||||
hashset -= wordHashSet(oldConst);
|
|
||||||
listing = hashset.toc();
|
|
||||||
sort(listing);
|
|
||||||
Info<< "new DimensionedConstants: " << listing << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//IOobject::writeDivider(Info);
|
|
||||||
|
|
||||||
sort(currDebug);
|
|
||||||
|
|
||||||
Info << endl << "DebugSwitches: " << endl;
|
|
||||||
forAll(currDebug, dI)
|
|
||||||
{
|
|
||||||
Info << " "
|
|
||||||
<< currDebug[dI]
|
|
||||||
<< " : "
|
|
||||||
<< debug::debugSwitchFromDict(currDebug[dI].c_str(), 0)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
sort(currInfo);
|
|
||||||
Info << endl << "InfoSwitches: " << endl;
|
|
||||||
forAll(currInfo, iI)
|
|
||||||
{
|
|
||||||
Info << " "
|
|
||||||
<< currInfo[iI]
|
|
||||||
<< " : "
|
|
||||||
<< debug::infoSwitchFromDict(currInfo[iI].c_str(), 0)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
sort(currOpt);
|
|
||||||
Info << endl << "OptimisationSwitches: " << endl;
|
|
||||||
forAll(currOpt, oI)
|
|
||||||
{
|
|
||||||
if (currOpt[oI] == "commsType")
|
|
||||||
{
|
|
||||||
token commsTypeValue;
|
|
||||||
debug::optimisationSwitches().lookup("commsType", false, false).read(commsTypeValue);
|
|
||||||
Info << " " << "commsType : " << commsTypeValue << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info << " "
|
|
||||||
<< currOpt[oI]
|
|
||||||
<< " : "
|
|
||||||
<< debug::optimisationSwitchFromDict(currOpt[oI].c_str(), 0)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort(currTol);
|
|
||||||
Info << endl << "Tolerances: " << endl;
|
|
||||||
forAll(currTol, tI)
|
|
||||||
{
|
|
||||||
Info << " "
|
|
||||||
<< currTol[tI]
|
|
||||||
<< " : "
|
|
||||||
<< debug::tolerancesFromDict(currTol[tI].c_str(), 0)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
sort(currConst);
|
|
||||||
Info << endl << "Dimensioned Constants: " << endl;
|
|
||||||
forAll(currConst, tI)
|
|
||||||
{
|
|
||||||
Info << " "
|
|
||||||
<< currConst[tI]
|
|
||||||
<< " : "
|
|
||||||
<< debug::constantsFromDict(currConst[tI].c_str(), 0)
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Info << endl << "Done." << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
|
@ -3,6 +3,12 @@ global/dimensionedConstants/dimensionedConstants.C
|
||||||
global/argList/argList.C
|
global/argList/argList.C
|
||||||
global/clock/clock.C
|
global/clock/clock.C
|
||||||
|
|
||||||
|
global/controlSwitches/debugSwitch.C
|
||||||
|
global/controlSwitches/infoSwitch.C
|
||||||
|
global/controlSwitches/optimisationSwitch.C
|
||||||
|
global/controlSwitches/tolerancesSwitch.C
|
||||||
|
global/controlSwitches/constantsSwitch.C
|
||||||
|
|
||||||
global/profiling/profilingInfo.C
|
global/profiling/profilingInfo.C
|
||||||
global/profiling/profilingPool.C
|
global/profiling/profilingPool.C
|
||||||
global/profiling/profilingStack.C
|
global/profiling/profilingStack.C
|
||||||
|
|
|
@ -67,6 +67,8 @@ Foam::argList::initValidTables::initValidTables()
|
||||||
validOptions.set(switchSetName, "key1=val1,key2=val2,...");
|
validOptions.set(switchSetName, "key1=val1,key2=val2,...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validOptions.set("dumpControlSwitches", "");
|
||||||
|
|
||||||
Pstream::addValidParOptions(validParOptions);
|
Pstream::addValidParOptions(validParOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,6 +573,21 @@ Foam::argList::argList
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( optionFound("dumpControlSwitches") )
|
||||||
|
{
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
// Dumping the application's control switches.
|
||||||
|
// We dump the full information to the console using a standard
|
||||||
|
// dictionary format, so one can copy/paste this information directly
|
||||||
|
// into a case's system/controlDict file to override some switches
|
||||||
|
// values without having to always use the command-line options.
|
||||||
|
Foam::debug::dumpControlSwitchesToConsole();
|
||||||
|
}
|
||||||
|
|
||||||
|
::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
wordList slaveProcs;
|
wordList slaveProcs;
|
||||||
|
|
||||||
// collect slave machine/pid
|
// collect slave machine/pid
|
||||||
|
|
56
src/foam/global/controlSwitches/constantsSwitch.C
Normal file
56
src/foam/global/controlSwitches/constantsSwitch.C
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | For copyright notice see file Copyright
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "constantsSwitch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace debug
|
||||||
|
{
|
||||||
|
// Hashtables to static class attributes addresses holding the
|
||||||
|
// runtime constantsSwitch values.
|
||||||
|
// This needs to go on the heap so the destructor will not get
|
||||||
|
// called before the objects' destructor it is overseeing
|
||||||
|
ListConstantsControlSwitches* constantsSwitchValues_(NULL);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -27,6 +27,7 @@ Author
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "controlSwitches.H"
|
#include "controlSwitches.H"
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -136,10 +137,101 @@ void Foam::debug::controlSwitches<T>::operator=(const Foam::debug::controlSwitch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void printControlSwitches
|
||||||
|
(
|
||||||
|
const std::string& dictName,
|
||||||
|
const std::map
|
||||||
|
<
|
||||||
|
std::string,
|
||||||
|
std::list<Foam::debug::controlSwitches<T> *>
|
||||||
|
>* mapListSwitchesPtr,
|
||||||
|
const char* commsTypesNames[]
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::cout << dictName << "\n{\n";
|
||||||
|
|
||||||
|
if (mapListSwitchesPtr)
|
||||||
|
{
|
||||||
|
const std::map
|
||||||
|
<
|
||||||
|
std::string,
|
||||||
|
std::list<Foam::debug::controlSwitches<T> *>
|
||||||
|
>& mapListSwitches = *mapListSwitchesPtr;
|
||||||
|
|
||||||
|
typename std::map
|
||||||
|
<
|
||||||
|
std::string,
|
||||||
|
std::list<Foam::debug::controlSwitches<T> *>
|
||||||
|
>::const_iterator it;
|
||||||
|
|
||||||
|
// Compute the maximum length of the switches names.
|
||||||
|
// Trying to make things pretty with std::setw by lining-up the values.
|
||||||
|
// Useful for the debugSwitches because non-zero flags will be much
|
||||||
|
// easier to spot.
|
||||||
|
std::size_t maxLengthKey = 0;
|
||||||
|
for (it = mapListSwitches.begin(); it != mapListSwitches.end(); it++)
|
||||||
|
{
|
||||||
|
std::string switchName = it->first;
|
||||||
|
maxLengthKey = std::max(maxLengthKey, switchName.length());
|
||||||
|
}
|
||||||
|
// Still, we clip at 60 characters max.
|
||||||
|
maxLengthKey = std::min(maxLengthKey, size_t(60));
|
||||||
|
|
||||||
|
for (it = mapListSwitches.begin(); it != mapListSwitches.end(); it++)
|
||||||
|
{
|
||||||
|
// Switch name
|
||||||
|
std::string switchName = it->first;
|
||||||
|
|
||||||
|
// Switches list, all identical values, but from different instances.
|
||||||
|
// So we only need to echo the first switch of the list.
|
||||||
|
std::list<Foam::debug::controlSwitches<T> *> swList = it->second;
|
||||||
|
Foam::debug::controlSwitches<T>& value = *(swList.front());
|
||||||
|
|
||||||
|
std::cout << " "
|
||||||
|
<< std::left
|
||||||
|
<< std::setw(maxLengthKey)
|
||||||
|
<< switchName
|
||||||
|
<< " ";
|
||||||
|
|
||||||
|
// Special handling for commsTypes from optimisationSwitches
|
||||||
|
if (commsTypesNames && switchName.compare("commsType") == 0)
|
||||||
|
{
|
||||||
|
int valEnumAsIndex = value();
|
||||||
|
|
||||||
|
std::cout << commsTypesNames[valEnumAsIndex] << ";";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << value() << ";";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string swDescr = value.switchDescription();
|
||||||
|
|
||||||
|
if( !swDescr.empty() )
|
||||||
|
{
|
||||||
|
std::cout << " // " << swDescr;
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << " // No switches of this type for this application"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace debug
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
|
|
|
@ -178,6 +178,24 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Print the content of a controlSwitches list to the console.
|
||||||
|
// We are forced to pass the string descriptions of the Pstream::commsTypes
|
||||||
|
// when dealing with the optimisationSwitches group because this switch is in
|
||||||
|
// fact an enum but we need to specify its corresponding string equivalent in
|
||||||
|
// a controlDict dictionary. And at the low level we are playing, including
|
||||||
|
// Pstream.H is out of the question.
|
||||||
|
// MB 2015
|
||||||
|
template<class T>
|
||||||
|
void printControlSwitches
|
||||||
|
(
|
||||||
|
const std::string&,
|
||||||
|
const std::map<std::string, std::list<debug::controlSwitches<T> *> >*,
|
||||||
|
const char* commsTypesNames[] = NULL
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace debug
|
} // End namespace debug
|
||||||
|
|
55
src/foam/global/controlSwitches/debugSwitch.C
Normal file
55
src/foam/global/controlSwitches/debugSwitch.C
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | For copyright notice see file Copyright
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "debugSwitch.H"
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace debug
|
||||||
|
{
|
||||||
|
// Hashtables to static class attributes addresses holding the
|
||||||
|
// runtime debug values.
|
||||||
|
// This needs to go on the heap so the destructor will not get
|
||||||
|
// called before the objects' destructor it is overseeing
|
||||||
|
ListDebugControlSwitches* debugSwitchValues_(NULL);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -84,14 +84,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace debug
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
55
src/foam/global/controlSwitches/infoSwitch.C
Normal file
55
src/foam/global/controlSwitches/infoSwitch.C
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | For copyright notice see file Copyright
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "infoSwitch.H"
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace debug
|
||||||
|
{
|
||||||
|
// Hashtables to static class attributes addresses holding the
|
||||||
|
// runtime InfoSwitches values.
|
||||||
|
// This needs to go on the heap so the destructor will not get
|
||||||
|
// called before the objects' destructor it is overseeing
|
||||||
|
ListInfoControlSwitches* infoSwitchValues_(NULL);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
56
src/foam/global/controlSwitches/optimisationSwitch.C
Normal file
56
src/foam/global/controlSwitches/optimisationSwitch.C
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | For copyright notice see file Copyright
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "optimisationSwitch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace debug
|
||||||
|
{
|
||||||
|
// Hashtables to static class attributes addresses holding the
|
||||||
|
// runtime optimisationSwitch values.
|
||||||
|
// This needs to go on the heap so the destructor will not get
|
||||||
|
// called before the objects' destructor it is overseeing
|
||||||
|
ListOptimisationControlSwitches* optimisationSwitchValues_(NULL);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
56
src/foam/global/controlSwitches/tolerancesSwitch.C
Normal file
56
src/foam/global/controlSwitches/tolerancesSwitch.C
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | For copyright notice see file Copyright
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Martin Beaudoin, Hydro-Quebec, 2015. All rights reserved
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "tolerancesSwitch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace debug
|
||||||
|
{
|
||||||
|
// Hashtables to static class attributes addresses holding the
|
||||||
|
// runtime tolerancesSwitch values.
|
||||||
|
// This needs to go on the heap so the destructor will not get
|
||||||
|
// called before the objects' destructor it is overseeing
|
||||||
|
ListTolerancesControlSwitches* tolerancesSwitchValues_(NULL);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -39,6 +39,7 @@ Description
|
||||||
#include "constantsSwitch.H"
|
#include "constantsSwitch.H"
|
||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
#include "NamedEnum.H"
|
#include "NamedEnum.H"
|
||||||
|
#include "Pstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -71,17 +72,6 @@ dictionary* optimisationSwitchesPtr_(NULL);
|
||||||
dictionary* tolerancesPtr_(NULL);
|
dictionary* tolerancesPtr_(NULL);
|
||||||
dictionary* constantsPtr_(NULL);
|
dictionary* constantsPtr_(NULL);
|
||||||
|
|
||||||
// Hashtables to static class attributes addresses holding the
|
|
||||||
// runtime debug/info/optimisation/tolerances values
|
|
||||||
// This needs to go on the heap so the destructor will not get
|
|
||||||
// called before the object's destructor it is overseeing
|
|
||||||
ListDebugControlSwitches* debugSwitchValues_(NULL);
|
|
||||||
ListInfoControlSwitches* infoSwitchValues_(NULL);
|
|
||||||
ListOptimisationControlSwitches* optimisationSwitchValues_(NULL);
|
|
||||||
ListTolerancesControlSwitches* tolerancesSwitchValues_(NULL);
|
|
||||||
ListConstantsControlSwitches* constantsSwitchValues_(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
// to ensure controlDictPtr_ is deleted at the end of the run
|
// to ensure controlDictPtr_ is deleted at the end of the run
|
||||||
class deleteControlDictPtr
|
class deleteControlDictPtr
|
||||||
{
|
{
|
||||||
|
@ -871,4 +861,58 @@ void Foam::debug::updateCentralDictVars
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Foam::debug::dumpControlSwitchesToConsole()
|
||||||
|
{
|
||||||
|
const Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::debug::globalControlDictSwitchSet,
|
||||||
|
DIM_GLOBALCONTROLDICTSWITCHSET
|
||||||
|
>
|
||||||
|
globalControlDictSwitchSetNames;
|
||||||
|
|
||||||
|
Info << endl;
|
||||||
|
|
||||||
|
debug::printControlSwitches
|
||||||
|
(
|
||||||
|
globalControlDictSwitchSetNames[debug::DEBUGSWITCHES],
|
||||||
|
debug::debugSwitchValues_
|
||||||
|
);
|
||||||
|
|
||||||
|
debug::printControlSwitches
|
||||||
|
(
|
||||||
|
globalControlDictSwitchSetNames[debug::INFOSWITCHES],
|
||||||
|
debug::infoSwitchValues_
|
||||||
|
);
|
||||||
|
|
||||||
|
// We are forced to pass the string descriptions of the Pstream::commsTypes
|
||||||
|
// for the optimisationSwitches group because this switch is in fact an enum
|
||||||
|
// but we need to specify its corresponding string equivalent in a controlDict
|
||||||
|
// dictionary. And at the low level we are playing, including Pstream.H is out
|
||||||
|
// of the question.
|
||||||
|
// MB 2015
|
||||||
|
debug::printControlSwitches
|
||||||
|
(
|
||||||
|
globalControlDictSwitchSetNames[debug::OPTIMISATIONSWITCHES],
|
||||||
|
debug::optimisationSwitchValues_,
|
||||||
|
Foam::Pstream::commsTypeNames.names
|
||||||
|
);
|
||||||
|
|
||||||
|
debug::printControlSwitches
|
||||||
|
(
|
||||||
|
globalControlDictSwitchSetNames[debug::TOLERANCES],
|
||||||
|
debug::tolerancesSwitchValues_
|
||||||
|
);
|
||||||
|
|
||||||
|
debug::printControlSwitches
|
||||||
|
(
|
||||||
|
globalControlDictSwitchSetNames[debug::DIMENSIONEDCONSTANTS],
|
||||||
|
debug::constantsSwitchValues_
|
||||||
|
);
|
||||||
|
|
||||||
|
Info << endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -121,6 +121,11 @@ namespace debug
|
||||||
const bool verbose=true
|
const bool verbose=true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Dump the central controlDict variables to the console using a standard
|
||||||
|
// dictionary format. If a description is available for a given switch, a
|
||||||
|
// comment will be added just besides the switch name and value.
|
||||||
|
void dumpControlSwitchesToConsole();
|
||||||
|
|
||||||
} // End namespace debug
|
} // End namespace debug
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue