56 dictionary* optimisationDefaultSwitchesPtr_(
nullptr);
60 if (!debugDefaultSwitchesPtr_)
65 return *debugDefaultSwitchesPtr_;
70 if (!infoDefaultSwitchesPtr_)
75 return *infoDefaultSwitchesPtr_;
80 if (!optimisationDefaultSwitchesPtr_)
82 optimisationDefaultSwitchesPtr_ =
new dictionary();
85 return *optimisationDefaultSwitchesPtr_;
90 class deleteControlDictPtr
94 deleteControlDictPtr()
97 ~deleteControlDictPtr()
103 debugSwitchesPtr_ =
nullptr;
104 infoSwitchesPtr_ =
nullptr;
105 optimisationSwitchesPtr_ =
nullptr;
111 deleteControlDictPtr deleteControlDictPtr_;
122 if (!controlDictPtr_)
124 string controlDictString(
getEnv(
"FOAM_CONTROLDICT"));
125 if (!controlDictString.empty())
137 IFstream ifs(controlDictFiles[cdfi]);
144 "Cannot open controlDict" 159 return *controlDictPtr_;
165 const char* subDictName,
173 subDictName,
false,
false 176 if (!ePtr || !ePtr->
isDict())
178 cerr<<
"debug::switchSet(const char*, dictionary*&):\n" 179 <<
" Cannot find " << subDictName <<
" in dictionary " 186 subDictPtr = &ePtr->
dict();
195 return switchSet(
"DebugSwitches", debugSwitchesPtr_);
201 return switchSet(
"InfoSwitches", infoSwitchesPtr_);
207 return switchSet(
"OptimisationSwitches", optimisationSwitchesPtr_);
215 debugDefaultSwitches().
found(name)
216 && debugDefaultSwitches().lookup<int>(name) != defaultValue
220 <<
"Multiple defaults set for debug switch " << name
224 debugDefaultSwitches().set(name, defaultValue);
228 name, defaultValue,
false,
false 237 infoDefaultSwitches().
found(name)
238 && infoDefaultSwitches().lookup<int>(name) != defaultValue
242 <<
"Multiple defaults set for info switch " << name
246 infoDefaultSwitches().set(name, defaultValue);
250 name, defaultValue,
false,
false 259 optimisationDefaultSwitches().
found(name)
260 && optimisationDefaultSwitches().lookup<int>(name) != defaultValue
264 <<
"Multiple defaults set for optimisation switch " << name
268 optimisationDefaultSwitches().set(name, defaultValue);
272 name, defaultValue,
false,
false 280 const float defaultValue
285 optimisationDefaultSwitches().
found(name)
286 && optimisationDefaultSwitches().lookup<float>(name) != defaultValue
293 optimisationDefaultSwitches().set(name, defaultValue);
297 name, defaultValue,
false,
false 305 const word& defaultValue
310 optimisationDefaultSwitches().
found(name)
311 && optimisationDefaultSwitches().lookup<word>(name) != defaultValue
318 optimisationDefaultSwitches().set(name, defaultValue);
322 name, defaultValue,
false,
false 369 hashset -= controlDictDebug;
373 hashset -= controlDictInfo;
376 hashset = optSwitches;
377 hashset -= controlDictOpt;
383 Info<<
"DebugSwitches" << debugSwitches <<
endl;
384 Info<<
"InfoSwitches" << infoSwitches <<
endl;
385 Info<<
"OptimisationSwitches" << optSwitches <<
endl;
403 const word& name = iter().keyword();
405 const bool hasDefault = defaultSwitches.
found(name);
407 const bool isDefault =
409 && defaultSwitches.
lookupEntry(name,
false,
false) == iter();
419 nonDefaultSet.
insert(name);
424 noDefaultSet.
insert(name);
428 auto print = [&](
const char* heading,
const wordList& names)
443 "Switches with default values",
449 "Switches with non-default values",
455 "Switches without defaults",
473 debug::debugDefaultSwitches()
481 debug::infoDefaultSwitches()
487 "OptimisationSwitches",
489 debug::optimisationDefaultSwitches()
string getEnv(const word &)
Return environment variable of given name.
A HashTable with keys but without contents.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
Ostream & indent(Ostream &os)
Indent stream.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
float floatOptimisationSwitch(const char *name, const float defaultValue=0)
Lookup optimisation switch or add default value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T lookupOrAddDefault(const word &, const T &, bool recursive=false, bool patternMatch=true)
Find and return a T, if not found return the given.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
const entry & lookupEntry(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present otherwise error.
bool insert(const Key &key)
Insert a new entry.
void listSwitches()
List debug switches.
bool good() const
Return true if next operation might succeed.
int infoSwitch(const char *name, const int defaultValue=0)
Lookup info switch or add default value.
fileNameList findEtcFiles(const fileName &, bool mandatory=false, bool findFirst=false)
Search for files from user/group/shipped directories.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
static int disableFunctionEntries
const fileName & name() const
Return the dictionary name.
A class for handling words, derived from string.
Functions to search 'etc' directories for configuration files etc.
dictionary & infoSwitches()
The InfoSwitches sub-dictionary in the central controlDict.
int debugSwitch(const char *name, const int defaultValue=0)
Lookup debug switch or add default value.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
virtual bool isDict() const
Return true if this entry is a dictionary.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Template functions to aid in the implementation of demand driven data.
Input from memory buffer stream.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
bool merge(const dictionary &)
Merge entries from the given dictionary.
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict.
const word wordOptimisationSwitch(const char *name, const word &defaultValue)
Lookup optimisation switch or add default value.
dictionary & debugSwitches()
The DebugSwitches sub-dictionary in the central controlDict.
dictionary & controlDict()
The central control dictionary.
void deleteDemandDrivenData(DataPtr &dataPtr)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
wordList sortedToc() const
Return the sorted table of contents.
A keyword and a list of tokens is an 'entry'.
#define SafeFatalIOErrorInFunction(ios, msg)
Report an error message using Foam::FatalIOError.