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"
154 entry::disableFunctionEntries =
true;
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_);
216 && debugDefaultSwitches().lookup<int>(
name) != defaultValue
220 <<
"Multiple defaults set for debug switch " <<
name
224 debugDefaultSwitches().set(
name, defaultValue);
228 name, defaultValue,
false,
false
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
361 controlDict.subDict(
"OptimisationSwitches").sortedToc()
369 hashset -= controlDictDebug;
373 hashset -= controlDictInfo;
376 hashset = optSwitches;
377 hashset -= controlDictOpt;
385 Info<<
"OptimisationSwitches" << optSwitches <<
endl;
403 const word&
name = iter().keyword();
405 const bool hasDefault = defaultSwitches.
found(
name);
407 const bool isDefault =
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()
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
bool good() const
Return true if next operation might succeed.
Input from memory buffer stream.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const entry & lookupEntry(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present otherwise error.
T lookupOrAddDefault(const word &, const T &, bool recursive=false, bool patternMatch=true)
Find and return a T, if not found return the given.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
A keyword and a list of tokens is an 'entry'.
virtual bool isDict() const
Return true if this entry is a dictionary.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
A class for handling words, derived from string.
Template functions to aid in the implementation of demand driven data.
#define SafeFatalIOErrorInFunction(ios, msg)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Functions to search 'etc' directories for configuration files etc.
dictionary & switchSet(const char *subDictName, dictionary *&subDictPtr)
Internal function to lookup a sub-dictionary from controlDict.
float floatOptimisationSwitch(const char *name, const float defaultValue=0)
Lookup optimisation switch or add default value.
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict.
int debugSwitch(const char *name, const int defaultValue=0)
Lookup debug switch or add default value.
int infoSwitch(const char *name, const int defaultValue=0)
Lookup info switch or add default value.
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
dictionary & controlDict()
The central control dictionary.
void listSwitches()
List debug switches.
dictionary & infoSwitches()
The InfoSwitches 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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
void deleteDemandDrivenData(DataType *&dataPtr)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
void listSwitches(const wordList &debugSwitches, const wordList &infoSwitches, const wordList &optSwitches, const bool unset)
void listSwitches(const word &name, const dictionary &switches, const dictionary &defaultSwitches)
string getEnv(const word &)
Return environment variable of given name.
fileNameList findEtcFiles(const fileName &, bool mandatory=false, bool findFirst=false)
Search for files from user/group/shipped directories.
Ostream & indent(Ostream &os)
Indent stream.
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep