Rationalized handling of debug, info and opt switches
This commit is contained in:
@ -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) 2011-2014 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "UPstream.H"
|
#include "UPstream.H"
|
||||||
#include "debug.H"
|
#include "debug.H"
|
||||||
|
#include "registerOptSwitch.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
|
|||||||
@ -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) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
#include "registerOptSwitch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -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) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,9 +29,7 @@ Description
|
|||||||
#ifndef className_H
|
#ifndef className_H
|
||||||
#define className_H
|
#define className_H
|
||||||
|
|
||||||
#include "word.H"
|
#include "defineDebugSwitch.H"
|
||||||
#include "debug.H"
|
|
||||||
#include "debugName.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -39,7 +37,6 @@ Description
|
|||||||
// declarations (without debug information)
|
// declarations (without debug information)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
//- Add typeName information from argument \a TypeNameString to a class.
|
//- Add typeName information from argument \a TypeNameString to a class.
|
||||||
// Without debug information
|
// Without debug information
|
||||||
#define ClassNameNoDebug(TypeNameString) \
|
#define ClassNameNoDebug(TypeNameString) \
|
||||||
@ -63,12 +60,10 @@ public: \
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// declarations (with debug information)
|
// declarations (with debug information)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
//- Add typeName information from argument \a TypeNameString to a class.
|
//- Add typeName information from argument \a TypeNameString to a class.
|
||||||
// Also declares debug information.
|
// Also declares debug information.
|
||||||
#define ClassName(TypeNameString) \
|
#define ClassName(TypeNameString) \
|
||||||
@ -92,12 +87,10 @@ public: \
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// definitions (without debug information)
|
// definitions (without debug information)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
//- Define the typeName, with alternative lookup as \a Name
|
//- Define the typeName, with alternative lookup as \a Name
|
||||||
#define defineTypeNameWithName(Type, Name) \
|
#define defineTypeNameWithName(Type, Name) \
|
||||||
const ::Foam::word Type::typeName(Name)
|
const ::Foam::word Type::typeName(Name)
|
||||||
@ -133,12 +126,10 @@ public: \
|
|||||||
defineTemplateTypeNameWithName(Type, Type::typeName_())
|
defineTemplateTypeNameWithName(Type, Type::typeName_())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// definitions (with debug information)
|
// definitions (with debug information)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
//- Define the typeName and debug information
|
//- Define the typeName and debug information
|
||||||
#define defineTypeNameAndDebug(Type, DebugSwitch) \
|
#define defineTypeNameAndDebug(Type, DebugSwitch) \
|
||||||
defineTypeName(Type); \
|
defineTypeName(Type); \
|
||||||
@ -172,7 +163,6 @@ public: \
|
|||||||
defineTemplate2TypeNameAndDebugWithName(Type, #Type, DebugSwitch)
|
defineTemplate2TypeNameAndDebugWithName(Type, #Type, DebugSwitch)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -22,15 +22,14 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Macro definitions for debug symbols etc.
|
Macro definitions for debug switches.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef debugName_H
|
#ifndef defineDebugSwitch_H
|
||||||
#define debugName_H
|
#define defineDebugSwitch_H
|
||||||
|
|
||||||
#include "simpleRegIOobject.H"
|
#include "simpleRegIOobject.H"
|
||||||
#include "word.H"
|
|
||||||
#include "debug.H"
|
#include "debug.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
|
|
||||||
@ -45,21 +44,21 @@ namespace Foam
|
|||||||
|
|
||||||
//- Define the debug information, lookup as \a Name
|
//- Define the debug information, lookup as \a Name
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class AddToDebug
|
class RegisterDebugSwitch
|
||||||
:
|
:
|
||||||
public ::Foam::simpleRegIOobject
|
public ::Foam::simpleRegIOobject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- The unique AddToDebug object
|
//- The unique RegisterDebugSwitch object
|
||||||
static const AddToDebug addToDebug;
|
static const RegisterDebugSwitch registerDebugSwitch;
|
||||||
|
|
||||||
AddToDebug(const char* name)
|
RegisterDebugSwitch(const char* name)
|
||||||
:
|
:
|
||||||
::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name)
|
::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~AddToDebug()
|
virtual ~RegisterDebugSwitch()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void readData(Foam::Istream& is)
|
virtual void readData(Foam::Istream& is)
|
||||||
@ -77,7 +76,8 @@ public:
|
|||||||
|
|
||||||
#define registerTemplateDebugSwitchWithName(Type,Name) \
|
#define registerTemplateDebugSwitchWithName(Type,Name) \
|
||||||
template<> \
|
template<> \
|
||||||
const Foam::AddToDebug<Type> Foam::AddToDebug<Type>::addToDebug(Name)
|
const Foam::RegisterDebugSwitch<Type> \
|
||||||
|
Foam::RegisterDebugSwitch<Type>::registerDebugSwitch(Name)
|
||||||
|
|
||||||
|
|
||||||
//- Define the debug information, lookup as \a Name
|
//- Define the debug information, lookup as \a Name
|
||||||
@ -105,56 +105,6 @@ public:
|
|||||||
add##Tag##ToDebug add##Tag##ToDebug_(Name)
|
add##Tag##ToDebug add##Tag##ToDebug_(Name)
|
||||||
|
|
||||||
|
|
||||||
//- Register info switch (if int), lookup as \a Name
|
|
||||||
#define registerInfoSwitchWithName(Switch,Tag,Name) \
|
|
||||||
class add##Tag##ToInfo \
|
|
||||||
: \
|
|
||||||
public ::Foam::simpleRegIOobject \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
add##Tag##ToInfo(const char* name) \
|
|
||||||
: \
|
|
||||||
::Foam::simpleRegIOobject(Foam::debug::addInfoObject, name) \
|
|
||||||
{} \
|
|
||||||
virtual ~add##Tag##ToInfo() \
|
|
||||||
{} \
|
|
||||||
virtual void readData(Foam::Istream& is) \
|
|
||||||
{ \
|
|
||||||
Switch = readLabel(is); \
|
|
||||||
} \
|
|
||||||
virtual void writeData(Foam::Ostream& os) const \
|
|
||||||
{ \
|
|
||||||
os << Switch; \
|
|
||||||
} \
|
|
||||||
}; \
|
|
||||||
add##Tag##ToInfo add##Tag##ToInfo_(Name)
|
|
||||||
|
|
||||||
|
|
||||||
//- Register optimisation switch (if int), lookup as \a Name
|
|
||||||
#define registerOptSwitchWithName(Switch,Tag,Name) \
|
|
||||||
class add##Tag##ToOpt \
|
|
||||||
: \
|
|
||||||
public ::Foam::simpleRegIOobject \
|
|
||||||
{ \
|
|
||||||
public: \
|
|
||||||
add##Tag##ToOpt(const char* name) \
|
|
||||||
: \
|
|
||||||
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject,name)\
|
|
||||||
{} \
|
|
||||||
virtual ~add##Tag##ToOpt() \
|
|
||||||
{} \
|
|
||||||
virtual void readData(Foam::Istream& is) \
|
|
||||||
{ \
|
|
||||||
Switch = readLabel(is); \
|
|
||||||
} \
|
|
||||||
virtual void writeData(Foam::Ostream& os) const \
|
|
||||||
{ \
|
|
||||||
os << Switch; \
|
|
||||||
} \
|
|
||||||
}; \
|
|
||||||
add##Tag##ToOpt add##Tag##ToOpt_(Name)
|
|
||||||
|
|
||||||
|
|
||||||
//- Define the debug information, lookup as \a Name
|
//- Define the debug information, lookup as \a Name
|
||||||
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \
|
||||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
|
||||||
@ -194,7 +144,7 @@ public:
|
|||||||
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||||
|
|
||||||
|
|
||||||
// for templated sub-classes
|
// For templated sub-classes
|
||||||
|
|
||||||
//- Define the debug information for templates
|
//- Define the debug information for templates
|
||||||
// Useful with typedefs
|
// Useful with typedefs
|
||||||
@ -206,7 +156,6 @@ public:
|
|||||||
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
65
src/OpenFOAM/global/debug/registerInfoSwitch.H
Normal file
65
src/OpenFOAM/global/debug/registerInfoSwitch.H
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012-2015 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/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Macro definitions for info switches.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef registerInfoSwitch_H
|
||||||
|
#define registerInfoSwitch_H
|
||||||
|
|
||||||
|
#include "simpleRegIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Register info switch (if int), lookup as \a Name
|
||||||
|
#define registerInfoSwitchWithName(Switch,Tag,Name) \
|
||||||
|
class add##Tag##ToInfo \
|
||||||
|
: \
|
||||||
|
public ::Foam::simpleRegIOobject \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
add##Tag##ToInfo(const char* name) \
|
||||||
|
: \
|
||||||
|
::Foam::simpleRegIOobject(Foam::debug::addInfoObject, name) \
|
||||||
|
{} \
|
||||||
|
virtual ~add##Tag##ToInfo() \
|
||||||
|
{} \
|
||||||
|
virtual void readData(Foam::Istream& is) \
|
||||||
|
{ \
|
||||||
|
Switch = readLabel(is); \
|
||||||
|
} \
|
||||||
|
virtual void writeData(Foam::Ostream& os) const \
|
||||||
|
{ \
|
||||||
|
os << Switch; \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
add##Tag##ToInfo add##Tag##ToInfo_(Name)
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
65
src/OpenFOAM/global/debug/registerOptSwitch.H
Normal file
65
src/OpenFOAM/global/debug/registerOptSwitch.H
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012-2015 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/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Macro definitions for optimization switches.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef registerOptSwitch_H
|
||||||
|
#define registerOptSwitch_H
|
||||||
|
|
||||||
|
#include "simpleRegIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Register optimisation switch (if int), lookup as \a Name
|
||||||
|
#define registerOptSwitchWithName(Switch,Tag,Name) \
|
||||||
|
class add##Tag##ToOpt \
|
||||||
|
: \
|
||||||
|
public ::Foam::simpleRegIOobject \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
add##Tag##ToOpt(const char* name) \
|
||||||
|
: \
|
||||||
|
::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject,name)\
|
||||||
|
{} \
|
||||||
|
virtual ~add##Tag##ToOpt() \
|
||||||
|
{} \
|
||||||
|
virtual void readData(Foam::Istream& is) \
|
||||||
|
{ \
|
||||||
|
Switch = readLabel(is); \
|
||||||
|
} \
|
||||||
|
virtual void writeData(Foam::Ostream& os) const \
|
||||||
|
{ \
|
||||||
|
os << Switch; \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
add##Tag##ToOpt add##Tag##ToOpt_(Name)
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,7 +34,6 @@ SourceFiles
|
|||||||
#ifndef simpleObjectRegistry_H
|
#ifndef simpleObjectRegistry_H
|
||||||
#define simpleObjectRegistry_H
|
#define simpleObjectRegistry_H
|
||||||
|
|
||||||
//#include "UPtrDictionary.H"
|
|
||||||
#include "Dictionary.H"
|
#include "Dictionary.H"
|
||||||
#include "simpleRegIOobject.H"
|
#include "simpleRegIOobject.H"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user