Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
b90ab946
Commit
b90ab946
authored
Feb 05, 2015
by
Henry
Browse files
Rationalized handling of debug, info and opt switches
parent
1be29879
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C
View file @
b90ab946
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
4
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
5
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"
...
...
src/OpenFOAM/db/regIOobject/regIOobject.C
View file @
b90ab946
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
5
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 * * * * * * * * * * * * * //
...
...
src/OpenFOAM/db/typeInfo/className.H
View file @
b90ab946
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
5
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
...
...
src/OpenFOAM/
db/typeInfo/debugName
.H
→
src/OpenFOAM/
global/debug/defineDebugSwitch
.H
View file @
b90ab946
...
...
@@ -22,15 +22,14 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Macro definitions for debug s
ymbols etc
.
Macro definitions for debug s
witches
.
\*---------------------------------------------------------------------------*/
#ifndef de
bugName
_H
#define de
bugName
_H
#ifndef de
fineDebugSwitch
_H
#define de
fineDebugSwitch
_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)
//
f
or templated sub-classes
//
F
or templated sub-classes
//- Define the debug information for templates
// Useful with typedefs
...
...
@@ -206,7 +156,6 @@ public:
defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
...
...
src/OpenFOAM/global/debug/registerInfoSwitch.H
0 → 100644
View file @
b90ab946
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
src/OpenFOAM/global/debug/registerOptSwitch.H
0 → 100644
View file @
b90ab946
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
src/OpenFOAM/global/debug/simpleObjectRegistry.H
View file @
b90ab946
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-201
3
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-201
5
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"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment