Commit b90ab946 authored by Henry's avatar Henry
Browse files

Rationalized handling of debug, info and opt switches

parent 1be29879
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -25,6 +25,7 @@ License
#include "UPstream.H"
#include "debug.H"
#include "registerOptSwitch.H"
#include "dictionary.H"
#include "IOstreams.H"
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -26,6 +26,7 @@ License
#include "regIOobject.H"
#include "Time.H"
#include "polyMesh.H"
#include "registerOptSwitch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -29,9 +29,7 @@ Description
#ifndef className_H
#define className_H
#include "word.H"
#include "debug.H"
#include "debugName.H"
#include "defineDebugSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -39,7 +37,6 @@ Description
// declarations (without debug information)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//- Add typeName information from argument \a TypeNameString to a class.
// Without debug information
#define ClassNameNoDebug(TypeNameString) \
......@@ -63,12 +60,10 @@ public: \
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// declarations (with debug information)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//- Add typeName information from argument \a TypeNameString to a class.
// Also declares debug information.
#define ClassName(TypeNameString) \
......@@ -92,12 +87,10 @@ public: \
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// definitions (without debug information)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//- Define the typeName, with alternative lookup as \a Name
#define defineTypeNameWithName(Type, Name) \
const ::Foam::word Type::typeName(Name)
......@@ -133,12 +126,10 @@ public: \
defineTemplateTypeNameWithName(Type, Type::typeName_())
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// definitions (with debug information)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//- Define the typeName and debug information
#define defineTypeNameAndDebug(Type, DebugSwitch) \
defineTypeName(Type); \
......@@ -172,7 +163,6 @@ public: \
defineTemplate2TypeNameAndDebugWithName(Type, #Type, DebugSwitch)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
......
......@@ -22,15 +22,14 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Macro definitions for debug symbols etc.
Macro definitions for debug switches.
\*---------------------------------------------------------------------------*/
#ifndef debugName_H
#define debugName_H
#ifndef defineDebugSwitch_H
#define defineDebugSwitch_H
#include "simpleRegIOobject.H"
#include "word.H"
#include "debug.H"
#include "label.H"
......@@ -45,21 +44,21 @@ namespace Foam
//- Define the debug information, lookup as \a Name
template<class Type>
class AddToDebug
class RegisterDebugSwitch
:
public ::Foam::simpleRegIOobject
{
public:
//- The unique AddToDebug object
static const AddToDebug addToDebug;
//- The unique RegisterDebugSwitch object
static const RegisterDebugSwitch registerDebugSwitch;
AddToDebug(const char* name)
RegisterDebugSwitch(const char* name)
:
::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name)
{}
virtual ~AddToDebug()
virtual ~RegisterDebugSwitch()
{}
virtual void readData(Foam::Istream& is)
......@@ -77,7 +76,8 @@ public:
#define registerTemplateDebugSwitchWithName(Type,Name) \
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
......@@ -105,56 +105,6 @@ public:
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 defineDebugSwitchWithName(Type, Name, DebugSwitch) \
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch))
......@@ -194,7 +144,7 @@ public:
defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// for templated sub-classes
// For templated sub-classes
//- Define the debug information for templates
// Useful with typedefs
......@@ -206,7 +156,6 @@ public:
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -34,7 +34,6 @@ SourceFiles
#ifndef simpleObjectRegistry_H
#define simpleObjectRegistry_H
//#include "UPtrDictionary.H"
#include "Dictionary.H"
#include "simpleRegIOobject.H"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment