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);
235 && infoDefaultSwitches().lookup<int>(
name) != defaultValue
239 <<
"Multiple defaults set for info switch " <<
name
243 infoDefaultSwitches().set(
name, defaultValue);
253 optimisationDefaultSwitches().
found(
name)
254 && optimisationDefaultSwitches().lookup<int>(
name) != defaultValue
258 <<
"Multiple defaults set for optimisation switch " <<
name
262 optimisationDefaultSwitches().set(
name, defaultValue);
271 const float defaultValue
276 optimisationDefaultSwitches().
found(
name)
277 && optimisationDefaultSwitches().lookup<float>(
name) != defaultValue
284 optimisationDefaultSwitches().set(
name, defaultValue);
293 const word& defaultValue
298 optimisationDefaultSwitches().
found(
name)
299 && optimisationDefaultSwitches().lookup<word>(
name) != defaultValue
306 optimisationDefaultSwitches().set(
name, defaultValue);
346 controlDict.subDict(
"OptimisationSwitches").sortedToc()
354 hashset -= controlDictDebug;
358 hashset -= controlDictInfo;
361 hashset = optSwitches;
362 hashset -= controlDictOpt;
370 Info<<
"OptimisationSwitches" << optSwitches <<
endl;
388 const word&
name = iter().keyword();
390 const bool hasDefault = defaultSwitches.
found(
name);
392 const bool isDefault =
413 auto print = [&](
const char* heading,
const wordList& names)
428 "Switches with default values",
434 "Switches with non-default values",
440 "Switches without defaults",
458 debug::debugDefaultSwitches()
466 debug::infoDefaultSwitches()
472 "OptimisationSwitches",
474 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrAddDefault(const word &, const T &)
Find and return a T, if not found return the given.
const entry & lookupEntry(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present otherwise error.
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.
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.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & indent(Ostream &os)
Indent stream.
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep