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 | Copyright (C) 2011-2013 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  //- Internal function to lookup a sub-dictionary from controlDict.
78  dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
79 
80 
81 
82  // Registered debug switches
83 
84  //- Register debug switch read/write object
85  void addDebugObject(const char* name, simpleRegIOobject* obj);
86 
87  //- Register info switch read/write object
88  void addInfoObject(const char* name, simpleRegIOobject* obj);
89 
90  //- Register optimisation switch read/write object
91  void addOptimisationObject(const char* name, simpleRegIOobject* obj);
92 
93  //- Register DimensionSets read/write object
94  void addDimensionSetObject(const char* name, simpleRegIOobject* obj);
95 
96  //- Register DimensionedConstant read/write object
97  void addDimensionedConstantObject(const char* name, simpleRegIOobject*);
98 
99 
100  //- Get access to registered debug switch objects
101  simpleObjectRegistry& debugObjects();
102 
103  //- Get access to registered info switch objects
104  simpleObjectRegistry& infoObjects();
105 
106  //- Get access to registered optimisation switch objects
107  simpleObjectRegistry& optimisationObjects();
108 
109  //- Get access to registered dimensionSets switch objects
110  simpleObjectRegistry& dimensionSetObjects();
111 
112  //- Get access to registered dimensionedConstant switch objects
113  simpleObjectRegistry& dimensionedConstantObjects();
114 
115 } // End namespace debug
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
void addInfoObject(const char *name, simpleRegIOobject *obj)
Register info switch read/write object.
Definition: debug.C:214
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
Definition: debug.C:119
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
Definition: debug.C:184
simpleObjectRegistry & debugObjects()
Get access to registered debug switch objects.
Definition: debug.C:313
int infoSwitch(const char *name, const int defaultValue=0)
Lookup info switch or add default value.
Definition: debug.C:175
simpleObjectRegistry & optimisationObjects()
Get access to registered optimisation switch objects.
Definition: debug.C:335
void addDimensionedConstantObject(const char *name, simpleRegIOobject *)
Register DimensionedConstant read/write object.
Definition: debug.C:286
dictionary & infoSwitches()
The InfoSwitches sub-dictionary in the central controlDict.
Definition: debug.C:154
int debugSwitch(const char *name, const int defaultValue=0)
Lookup debug switch or add default value.
Definition: debug.C:166
simpleObjectRegistry & infoObjects()
Get access to registered info switch objects.
Definition: debug.C:324
simpleObjectRegistry & dimensionSetObjects()
Get access to registered dimensionSets switch objects.
Definition: debug.C:346
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:357
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict.
Definition: debug.C:160
void addDimensionSetObject(const char *name, simpleRegIOobject *obj)
Register DimensionSets read/write object.
Definition: debug.C:261
void addOptimisationObject(const char *name, simpleRegIOobject *obj)
Register optimisation switch read/write object.
Definition: debug.C:236
dictionary & debugSwitches()
The DebugSwitches sub-dictionary in the central controlDict.
Definition: debug.C:148
void addDebugObject(const char *name, simpleRegIOobject *obj)
Register debug switch read/write object.
Definition: debug.C:193
dictionary & controlDict()
The central control dictionary.
Definition: debug.C:92
Namespace for OpenFOAM.