debug.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Namespace
25  Foam::debug
26 
27 Description
28  Namespace for handling debugging switches.
29 
30 SourceFiles
31  debug.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef debug_H
36 #define debug_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 // Forward declaration of classes
44 class dictionary;
45 class Istream;
46 class Ostream;
47 class simpleRegIOobject;
48 class simpleObjectRegistry;
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace debug
53 {
54  //- The central control dictionary.
55  // Located in ~/.OpenFOAM/VERSION or $WM_PROJECT_DIR/etc
56  // \sa Foam::findEtcFile()
57  dictionary& controlDict();
58 
59  //- The DebugSwitches sub-dictionary in the central controlDict.
60  dictionary& debugSwitches();
61 
62  //- The InfoSwitches sub-dictionary in the central controlDict.
63  dictionary& infoSwitches();
64 
65  //- The OptimisationSwitches sub-dictionary in the central controlDict.
66  dictionary& optimisationSwitches();
67 
68  //- Lookup debug switch or add default value.
69  int debugSwitch(const char* name, const int defaultValue=0);
70 
71  //- Lookup info switch or add default value.
72  int infoSwitch(const char* name, const int defaultValue=0);
73 
74  //- Lookup optimisation switch or add default value.
75  int optimisationSwitch(const char* name, const int defaultValue=0);
76 
77  //- Lookup optimisation switch or add default value.
79  (
80  const char* name,
81  const float defaultValue=0
82  );
83 
84  //- Internal function to lookup a sub-dictionary from controlDict.
85  dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
86 
87  //- List debug switches
88  void listSwitches(const bool unset);
89 
90 
91  // Registered debug switches
92 
93  //- Register debug switch read/write object
94  void addDebugObject(const char* name, simpleRegIOobject* obj);
95 
96  //- Register info switch read/write object
97  void addInfoObject(const char* name, simpleRegIOobject* obj);
98 
99  //- Register optimisation switch read/write object
100  void addOptimisationObject(const char* name, simpleRegIOobject* obj);
101 
102  //- Register DimensionSets read/write object
103  void addDimensionSetObject(const char* name, simpleRegIOobject* obj);
104 
105  //- Register DimensionedConstant read/write object
106  void addDimensionedConstantObject(const char* name, simpleRegIOobject*);
107 
108 
109  //- Get access to registered debug switch objects
110  simpleObjectRegistry& debugObjects();
111 
112  //- Get access to registered info switch objects
113  simpleObjectRegistry& infoObjects();
114 
115  //- Get access to registered optimisation switch objects
116  simpleObjectRegistry& optimisationObjects();
117 
118  //- Get access to registered dimensionSets switch objects
119  simpleObjectRegistry& dimensionSetObjects();
120 
121  //- Get access to registered dimensionedConstant switch objects
122  simpleObjectRegistry& dimensionedConstantObjects();
123 
124  //- List registered debug switches
125  void listRegisteredSwitches(const bool unset);
126 
127 } // End namespace debug
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
void addInfoObject(const char *name, simpleRegIOobject *obj)
Register info switch read/write object.
Definition: debug.C:239
float floatOptimisationSwitch(const char *name, const float defaultValue=0)
Lookup optimisation switch or add default value.
Definition: debug.C:206
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
Definition: debug.C:131
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
Definition: debug.C:196
simpleObjectRegistry & debugObjects()
Get access to registered debug switch objects.
Definition: debug.C:338
int infoSwitch(const char *name, const int defaultValue=0)
Lookup info switch or add default value.
Definition: debug.C:187
simpleObjectRegistry & optimisationObjects()
Get access to registered optimisation switch objects.
Definition: debug.C:360
void addDimensionedConstantObject(const char *name, simpleRegIOobject *)
Register DimensionedConstant read/write object.
Definition: debug.C:311
dictionary & infoSwitches()
The InfoSwitches sub-dictionary in the central controlDict.
Definition: debug.C:166
int debugSwitch(const char *name, const int defaultValue=0)
Lookup debug switch or add default value.
Definition: debug.C:178
void listSwitches(const bool unset)
List debug switches.
Definition: debug.C:456
void listRegisteredSwitches(const bool unset)
List registered debug switches.
Definition: debug.C:468
simpleObjectRegistry & infoObjects()
Get access to registered info switch objects.
Definition: debug.C:349
simpleObjectRegistry & dimensionSetObjects()
Get access to registered dimensionSets switch objects.
Definition: debug.C:371
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
simpleObjectRegistry & dimensionedConstantObjects()
Get access to registered dimensionedConstant switch objects.
Definition: debug.C:382
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict.
Definition: debug.C:172
void addDimensionSetObject(const char *name, simpleRegIOobject *obj)
Register DimensionSets read/write object.
Definition: debug.C:286
void addOptimisationObject(const char *name, simpleRegIOobject *obj)
Register optimisation switch read/write object.
Definition: debug.C:261
dictionary & debugSwitches()
The DebugSwitches sub-dictionary in the central controlDict.
Definition: debug.C:160
void addDebugObject(const char *name, simpleRegIOobject *obj)
Register debug switch read/write object.
Definition: debug.C:218
dictionary & controlDict()
The central control dictionary.
Definition: debug.C:94
Namespace for OpenFOAM.