controlSwitches: - Improved handling of the control switch description

- Added a few switch descriptions.
This commit is contained in:
Martin Beaudoin 2015-05-10 09:18:46 -04:00
parent 23f4d5cb81
commit bd947865f2
14 changed files with 94 additions and 45 deletions

View file

@ -260,7 +260,8 @@ const Foam::debug::optimisationSwitch
Foam::Pstream::defaultCommsType
(
"commsType",
"blocking"
"blocking",
"blocking, nonBlocking, scheduled"
);
// ************************************************************************* //

View file

@ -133,24 +133,24 @@ public: \
//- Define the debug information, lookup as @a Name
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
#define defineDebugSwitchWithName(Type, Name, DebugSwitch, SwitchDescr) \
::Foam::debug::debugSwitch \
Type::debug(std::string(Name), DebugSwitch)
Type::debug(std::string(Name), DebugSwitch, SwitchDescr)
//- Define the debug information
#define defineDebugSwitch(Type, DebugSwitch) \
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch);
#define defineDebugSwitch(Type, DebugSwitch, SwitchDescr) \
defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch, SwitchDescr);
#ifdef __INTEL_COMPILER
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
defineDebugSwitchWithName(Type, Name, DebugSwitch);
defineDebugSwitchWithName(Type, Name, DebugSwitch, "");
#else
//- Define the debug information for templates, lookup as @a Name
# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \
template<> \
defineDebugSwitchWithName(Type, Name, DebugSwitch);
defineDebugSwitchWithName(Type, Name, DebugSwitch, "");
#endif
//- Define the debug information for templates
@ -172,7 +172,12 @@ public: \
//- Define the typeName and debug information
#define defineTypeNameAndDebug(Type, DebugSwitch) \
defineTypeName(Type); \
defineDebugSwitch(Type, DebugSwitch)
defineDebugSwitch(Type, DebugSwitch, "")
//- Define the typeName and debug information + description
#define defineTypeNameAndDebugWithDescription(Type, DebugSwitch, SwitchDescr) \
defineTypeName(Type); \
defineDebugSwitch(Type, DebugSwitch, SwitchDescr)
//- Define the typeName and debug information, lookup as @a Name
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \

View file

@ -61,13 +61,15 @@ public:
constantsSwitch
(
const std::string& switchName,
const Foam::scalar& switchValue
const Foam::scalar& switchValue,
const std::string& switchDescription = ""
)
:
controlSwitches<Foam::scalar>
(
switchName,
debug::constantsFromDict(switchName.c_str(), switchValue),
switchDescription,
debug::DIMENSIONEDCONSTANTS,
&constantsSwitchValues_
)

View file

@ -41,7 +41,8 @@ namespace debug
template<class Type>
Foam::debug::controlSwitches<Type>::controlSwitches()
:
switchValue_(Type(0))
switchValue_(Type(0)),
switchDescription_("")
{
}
@ -57,13 +58,15 @@ Foam::debug::controlSwitches<T>::controlSwitches
(
const std::string& switchName,
const T& switchValue,
const std::string& switchDescription,
globalControlDictSwitchSet switchSet,
std::map<std::string, std::list<controlSwitches<T> *> >** switchValuesTable
)
:
switchSet_(switchSet),
switchName_(switchName),
switchValue_(switchValue)
switchValue_(switchValue),
switchDescription_(switchDescription)
{
// Register the switch in its list
if (*switchValuesTable == NULL)
@ -92,7 +95,8 @@ template<class T>
Foam::debug::controlSwitches<T>::controlSwitches(const Foam::debug::controlSwitches<T>& csw)
:
switchName_(csw.switchName_),
switchValue_(csw.switchValue_)
switchValue_(csw.switchValue_),
switchDescription_(csw.switchDescription_)
{}
@ -134,6 +138,7 @@ void Foam::debug::controlSwitches<T>::operator=(const Foam::debug::controlSwitch
else
{
switchValue_ = rhs.switchValue_;
switchDescription_ = rhs.switchDescription_;
}
}
@ -208,11 +213,32 @@ void printControlSwitches
std::cout << value() << ";";
}
std::string swDescr = value.switchDescription();
// Now, for the switch description, since numerous switches might
// be defined with identical names, but different descriptions
// eg: ggi debugSwitch, we will concatenate all the non-empty
// switches descriptions for a given switch
if( !swDescr.empty() )
std::string switchDescription("");
typename std::list<Foam::debug::controlSwitches<T> *>::iterator itL;
for (itL = swList.begin(); itL != swList.end(); itL++)
{
std::cout << " // " << swDescr;
Foam::debug::controlSwitches<T>& sw = *(*itL);
std::string thisSwitchDescr = sw.switchDescription();
if
(
!thisSwitchDescr.empty() &&
switchDescription.find(thisSwitchDescr) == std::string::npos
)
{
switchDescription += thisSwitchDescr + ". ";
}
}
if (!switchDescription.empty())
{
std::cout << "\t// " << switchDescription;
}
std::cout << std::endl;
}

View file

@ -90,12 +90,12 @@ class controlSwitches
//- Switch name
std::string switchName_;
//- Switch Description
std::string switchDescription_;
//- Switch value
T switchValue_;
//- Switch Description
std::string switchDescription_;
//- Handle to runTime switches list
std::map<std::string, std::list<controlSwitches<T> *> >* switchValuesTable_ ;
@ -115,6 +115,7 @@ public:
(
const std::string& switchName,
const T& switchValue,
const std::string& switchDescription,
globalControlDictSwitchSet switchSet,
std::map<std::string, std::list<controlSwitches<T> *> >** switchesValues
);

View file

@ -60,13 +60,15 @@ public:
debugSwitch
(
const std::string& switchName,
const int& switchValue
const int& switchValue,
const std::string& switchDescription = ""
)
:
controlSwitches<int>
(
switchName,
debug::debugSwitchFromDict(switchName.c_str(), switchValue),
switchDescription,
debug::DEBUGSWITCHES,
&debugSwitchValues_
)

View file

@ -59,13 +59,15 @@ public:
infoSwitch
(
const std::string& switchName,
const int& switchValue
const int& switchValue,
const std::string& switchDescription = ""
)
:
controlSwitches<int>
(
switchName,
debug::infoSwitchFromDict(switchName.c_str(), switchValue),
switchDescription,
debug::INFOSWITCHES,
&infoSwitchValues_
)

View file

@ -60,13 +60,15 @@ public:
optimisationSwitch
(
const std::string& switchName,
const int& switchValue
const int& switchValue,
const std::string& switchDescription = ""
)
:
controlSwitches<int>
(
switchName,
debug::optimisationSwitchFromDict(switchName.c_str(), switchValue),
switchDescription,
debug::OPTIMISATIONSWITCHES,
&optimisationSwitchValues_
)
@ -77,13 +79,15 @@ public:
optimisationSwitch
(
const std::string& switchName,
const std::string& switchValue
const std::string& switchValue,
const std::string& switchDescription = ""
)
:
controlSwitches<int>
(
switchName,
debug::optimisationSwitchFromDict(switchName, switchValue),
switchDescription,
debug::OPTIMISATIONSWITCHES,
&optimisationSwitchValues_
)
@ -103,17 +107,6 @@ public:
{
return controlSwitches<int>::operator==(rhs);
}
#if 0
// Cannot use a conversion operator for Pstream::commsTypes
// since including Pstream.H generates compilation errors.
// MB 06/2014
operator Pstream::commsTypes () const
{
return static_cast<Pstream::commsTypes>(operator()());
}
#endif
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -60,13 +60,15 @@ public:
tolerancesSwitch
(
const std::string& switchName,
const Foam::scalar& switchValue
const Foam::scalar& switchValue,
const std::string& switchDescription = ""
)
:
controlSwitches<Foam::scalar>
(
switchName,
debug::tolerancesFromDict(switchName.c_str(), switchValue),
switchDescription,
debug::TOLERANCES,
&tolerancesSwitchValues_
)

View file

@ -48,7 +48,8 @@ const Foam::debug::tolerancesSwitch
GGIInterpolation<MasterPatch, SlavePatch>::faceBoundBoxExtendSpanFraction_
(
"GGIFaceBoundBoxExtendSpanFraction",
1.0e-2
1.0e-2,
"GGI faces bounding box expansion factor. Add robustness for quick-search algo. Keep it to a few percent."
);
template<class MasterPatch, class SlavePatch>
@ -56,7 +57,8 @@ const Foam::debug::optimisationSwitch
GGIInterpolation<MasterPatch, SlavePatch>::octreeSearchMinNLevel_
(
"GGIOctreeSearchMinNLevel",
3
3,
"GGI neighbouring facets octree-based search: minNlevel parameter for octree"
);
template<class MasterPatch, class SlavePatch>
@ -64,7 +66,8 @@ const Foam::debug::optimisationSwitch
GGIInterpolation<MasterPatch, SlavePatch>::octreeSearchMaxLeafRatio_
(
"GGIOctreeSearchMaxLeafRatio",
3
3,
"GGI neighbouring facets octree-based search: maxLeafRatio parameter for octree"
);
template<class MasterPatch, class SlavePatch>
@ -72,7 +75,8 @@ const Foam::debug::optimisationSwitch
GGIInterpolation<MasterPatch, SlavePatch>::octreeSearchMaxShapeRatio_
(
"GGIOctreeSearchMaxShapeRatio",
1
1,
"GGI neighbouring facets octree-based search: maxShapeRatio parameter for octree"
);

View file

@ -51,7 +51,8 @@ const Foam::debug::tolerancesSwitch
GGIInterpolation<MasterPatch, SlavePatch>::areaErrorTol_
(
"GGIAreaErrorTol",
1.0e-8
1.0e-8,
"Minimum GGI face to face intersection area. The smallest accepted GGI weighting factor."
);
template<class MasterPatch, class SlavePatch>
@ -59,7 +60,8 @@ const Foam::debug::tolerancesSwitch
GGIInterpolation<MasterPatch, SlavePatch>::featureCosTol_
(
"GGIFeatureCosTol",
0.8
0.8,
"Minimum cosine value between 2 GGI patch neighbouring facet normals."
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View file

@ -43,7 +43,12 @@ Contributor
namespace Foam
{
defineTypeNameAndDebug(ggiPolyPatch, 0);
defineTypeNameAndDebugWithDescription
(
ggiPolyPatch,
0,
"If value > 1, write uncovered GGI patch facets to VTK file"
);
addToRunTimeSelectionTable(polyPatch, ggiPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, ggiPolyPatch, dictionary);

View file

@ -33,7 +33,8 @@ const Foam::debug::constantsSwitch
Foam::radiation::sigmaSB_
(
"sigmaSB",
5.670E-08
5.670E-08,
"Stefan-Boltzmann constant [J/(K4 m2 s)]"
);
const Foam::dimensionedScalar Foam::radiation::sigmaSB

View file

@ -37,7 +37,8 @@ const Foam::debug::constantsSwitch
Foam::specie::RR
(
"R",
8314.51
8314.51,
"Universal gas constant [J/(kmol K)]"
);
@ -46,7 +47,8 @@ const Foam::debug::constantsSwitch
Foam::specie::Pstd
(
"Pstd",
1.0e5
1.0e5,
"Standard pressure [Pa]"
);
//- Standard temperature (default in [K])
@ -54,7 +56,8 @@ const Foam::debug::constantsSwitch
Foam::specie::Tstd
(
"Tstd",
298.15
298.15,
"Standard temperature [K]"
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //