debug.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Namespace
28 Foam::debug
29
30Description
31 Namespace for handling debugging switches.
32
33SourceFiles
34 debug.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef debug_H
39#define debug_H
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43namespace Foam
44{
45
46// Forward declarations
47class dictionary;
48class Istream;
49class Ostream;
50class simpleRegIOobject;
51class simpleObjectRegistry;
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace debug
56{
57 //- The central control dictionary, the contents of which are either
58 //- taken directly from the FOAM_CONTROLDICT environment variable,
59 //- or generated by merging the contents of user/group/other files.
60 //
61 // - ~/.OpenFOAM/{PROJECT_API}/controlDict
62 // - ~/.OpenFOAM/controlDict
63 // - $WM_PROJECT_SITE/{PROJECT_API}/etc/controlDict
64 // - $WM_PROJECT_SITE/etc/controlDict
65 // - $WM_PROJECT_DIR/etc/controlDict
66 //
67 // Where {PROJECT_API} corresponds to the foamVersion::api value.
68 //
69 // \sa Foam::findEtcFile()
70 dictionary& controlDict();
71
72 //- The DebugSwitches sub-dictionary in the central controlDict(s).
73 dictionary& debugSwitches();
74
75 //- The InfoSwitches sub-dictionary in the central controlDict(s).
76 dictionary& infoSwitches();
77
78 //- The OptimisationSwitches sub-dictionary in the central controlDict(s).
79 dictionary& optimisationSwitches();
80
81 //- Lookup debug switch or add default value.
82 int debugSwitch(const char* name, const int deflt = 0);
83
84 //- Lookup info switch or add default value.
85 int infoSwitch(const char* name, const int deflt = 0);
86
87 //- Lookup optimisation switch or add default value.
88 int optimisationSwitch(const char* name, const int deflt = 0);
89
90 //- Lookup optimisation switch or add default value.
91 float floatOptimisationSwitch(const char* name, const float deflt = 0);
92
93 //- Internal function to lookup a sub-dictionary from controlDict.
94 dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
95
96
97 // Registered debug switches
98
99 //- Register debug switch read/write object
100 void addDebugObject(const char* name, simpleRegIOobject* obj);
101
102 //- Register info switch read/write object
103 void addInfoObject(const char* name, simpleRegIOobject* obj);
104
105 //- Register optimisation switch read/write object
106 void addOptimisationObject(const char* name, simpleRegIOobject* obj);
107
108 //- Register DimensionSets read/write object
109 void addDimensionSetObject(const char* name, simpleRegIOobject* obj);
110
111 //- Register DimensionedConstant read/write object
112 void addDimensionedConstantObject(const char* name, simpleRegIOobject*);
113
114
115 //- Access to registered DebugSwitch objects
116 simpleObjectRegistry& debugObjects();
117
118 //- Access to registered InfoSwitch objects
119 simpleObjectRegistry& infoObjects();
120
121 //- Access to registered OptimisationSwitch objects
122 simpleObjectRegistry& optimisationObjects();
123
124 //- Access to registered DimensionSets objects
125 simpleObjectRegistry& dimensionSetObjects();
126
127 //- Access to registered DimensionedConstants objects
128 simpleObjectRegistry& dimensionedConstantObjects();
129
130
131 // List switches
132
133 //- List debug/info/optimisation switches
134 void listSwitches(const bool unset = false);
135
136 //- List debug switches
137 void listDebugSwitches(const bool unset = false);
138
139 //- List info switches
140 void listInfoSwitches(const bool unset = false);
141
142 //- List optimisation switches
143 void listOptimisationSwitches(const bool unset = false);
144
145
146 //- List registered debug/info/optimisation switches
147 void listRegisteredSwitches(const bool unset = false);
148
149 //- List debug switches
150 void listRegisteredDebugSwitches(const bool unset = false);
151
152 //- List info switches
153 void listRegisteredInfoSwitches(const bool unset = false);
154
155 //- List optimisation switches
156 void listRegisteredOptimisationSwitches(const bool unset = false);
157
158} // End namespace debug
159
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163} // End namespace Foam
164
165// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166
167#endif
168
169// ************************************************************************* //
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
Definition: debug.C:180
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
Definition: debug.C:231
void listDebugSwitches(const bool unset=false)
List debug switches.
Definition: debug.C:458
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
Definition: debug.C:225
void addDebugObject(const char *name, simpleRegIOobject *obj)
Register debug switch read/write object.
Definition: debug.C:249
void listSwitches(const bool unset=false)
List debug/info/optimisation switches.
Definition: debug.C:446
void listRegisteredOptimisationSwitches(const bool unset=false)
List optimisation switches.
Definition: debug.C:530
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
Definition: debug.C:302
simpleObjectRegistry & dimensionSetObjects()
Access to registered DimensionSets objects.
Definition: debug.C:324
float floatOptimisationSwitch(const char *name, const float deflt=0)
Lookup optimisation switch or add default value.
Definition: debug.C:243
void addDimensionedConstantObject(const char *name, simpleRegIOobject *)
Register DimensionedConstant read/write object.
Definition: debug.C:282
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
Definition: debug.C:335
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict(s).
Definition: debug.C:219
void listRegisteredSwitches(const bool unset=false)
List registered debug/info/optimisation switches.
Definition: debug.C:494
void listRegisteredDebugSwitches(const bool unset=false)
List debug switches.
Definition: debug.C:506
void addOptimisationObject(const char *name, simpleRegIOobject *obj)
Register optimisation switch read/write object.
Definition: debug.C:262
void listOptimisationSwitches(const bool unset=false)
List optimisation switches.
Definition: debug.C:482
void addInfoObject(const char *name, simpleRegIOobject *obj)
Register info switch read/write object.
Definition: debug.C:255
dictionary & controlDict()
Definition: debug.C:143
void listRegisteredInfoSwitches(const bool unset=false)
List info switches.
Definition: debug.C:518
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
Definition: debug.C:313
dictionary & infoSwitches()
The InfoSwitches sub-dictionary in the central controlDict(s).
Definition: debug.C:213
void listInfoSwitches(const bool unset=false)
List info switches.
Definition: debug.C:470
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
Definition: debug.C:291
int optimisationSwitch(const char *name, const int deflt=0)
Lookup optimisation switch or add default value.
Definition: debug.C:237
void addDimensionSetObject(const char *name, simpleRegIOobject *obj)
Register DimensionSets read/write object.
Definition: debug.C:272
dictionary & debugSwitches()
The DebugSwitches sub-dictionary in the central controlDict(s).
Definition: debug.C:207
int debug
Static debugging option.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59