99 #ifndef Foam_argList_H 100 #define Foam_argList_H 112 #define Foam_argList_1712 128 static bool argsMandatory_;
131 static bool checkProcessorDirectories_;
134 static bool parallelThreads_;
161 static word optionCompat(
const word& optName);
164 static int optionIgnore(
const word& optName);
169 static void checkITstream(
const ITstream& is,
const label index);
174 static void checkITstream(
const ITstream& is,
const word& optName);
182 void raiseBadInput(
const word& optName)
const;
198 bool regroupArgv(
int& argc,
char**& argv);
201 void printManCompat()
const;
248 struct initValidTables
268 bool checkOpts =
true,
269 bool initialise =
true 277 bool checkArgs =
true,
278 bool checkOpts =
true,
279 bool initialise =
true 319 const bool caseTag =
false 327 void parse(
bool checkArgs,
bool checkOpts,
bool initialise);
365 const
bool caseTag = false
416 inline
bool found(const
word& optName) const;
422 label
count(
std::initializer_list<
word> optionNames) const;
431 inline
T get(const label index) const;
441 template<class
T=
string>
442 inline
T get(const
word& optName) const;
487 template<class
T, class Predicate>
492 const Predicate& pred,
493 bool mandatory = true
504 template<class
T, class Predicate>
509 const Predicate& pred
517 template<class
T, class Predicate>
521 const Predicate& pred
531 template<class
T, class Predicate>
536 const Predicate& pred
545 const
string& argName,
546 const
string& usage = ""
553 const
string& usage = "",
554 bool advanced = false
562 const
string& param = "",
563 const
string& usage = "",
564 bool advanced = false
580 std::pair<const
char*,
int> compat
592 std::pair<const
char*,
int> compat,
605 static
void addNote(const
string& note);
628 bool advanced = false
634 const
string& usage = "",
635 bool advanced = false
662 bool setOption(const
word& optName, const
string& param = "");
676 static
int verbose(
int argc,
char *argv[]);
709 bool checkOpts = true
721 inline const
string& operator[](const label index) const;
724 inline const
string& operator[](const
word& optName) const;
731 template<class
T=
string>
735 return this->get<T>(optName);
742 T opt(const
word& optName, const
T& deflt)
const 744 return this->getOrDefault<T>(optName, deflt);
751 T get(const word& optName, const
T& deflt)
const 753 return this->getOrDefault<T>(optName, deflt);
762 return this->getOrDefault<T>(optName, deflt);
766 const ParRunControl&
parRunControl()
const {
return runControl_; }
771 #ifdef Foam_argList_1712 778 T read(const label index)
const 780 return this->get<T>(index);
790 return this->get<T>(index);
798 return found(optName);
815 return get<T>(optName);
829 return readIfPresent<T>(optName, val);
845 return readIfPresent<T>(optName, val, deflt);
859 return getOrDefault<T>(optName, deflt);
868 return this->getList<T>(optName);
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
bool checkRootCase() const
Check root path and case path.
A HashTable with keys but without contents that is similar to std::unordered_set. ...
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A class for handling file names.
Helper class for initializing parallel jobs from the command arguments, storing 'dry-run' state etc...
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
static std::string::size_type usageMin
Min indentation when displaying usage (default: 20)
static word postProcessOptionName
Standard name for the post-processing option.
static void noMandatoryArgs()
Flag command arguments as being optional (non-mandatory)
bool unsetOption(const word &optName)
Unset option directly (use with caution)
Template class for non-intrusive linked lists.
static SLList< string > notes
General usage notes.
List< T > getList(const label index) const
Get a List of values from the argument at index.
const fileName & globalCaseName() const noexcept
Return global case name.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
ITstream optionLookup(const word &optName) const
Deprecated(2018-01) return an input stream from the named option.
static void noParallel()
Remove the parallel options.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
static HashTable< std::pair< word, int > > validOptionsCompat
A list of aliases for options.
static bool postProcess(int argc, char *argv[])
True if the post-processing option is found in the argv list.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
static HashTable< string, label, Hash< label > > argUsage
Short description for program arguments.
T read(const label index) const
Deprecated(2018-08) read a value from the argument at index.
Lookup type of boundary radiation properties.
const stringList & args() const noexcept
Return arguments.
T optionLookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2018-01) read a value from the named option if present.
virtual ~argList()
Destructor.
const ParRunControl & parRunControl() const
Same as runControl() - v2106 and earlier.
bool allowFunctionObjects() const
The controlDict 'functions' entry is allowed to be used.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
void parse(bool checkArgs, bool checkOpts, bool initialise)
Scan for -help, -doc options etc prior to checking the validity of other args/opts and finally initia...
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
void printUsage(bool full=true) const
Print usage.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
T lookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2020-05) identical to getOrDefault(...)
bool allowLibs() const
The controlDict 'libs' entry is allowed to be used. (eg, has not been disabled by the -no-libs option...
void displayDoc(bool source=false) const
Display documentation in browser.
static HashTable< string > validParOptions
A list of valid parallel options.
void printNotes() const
Print notes (if any)
bool optionReadIfPresent(const word &optName, T &val) const
Deprecated(2018-01) read a value from the named option if present.
static bool bannerEnabled()
Banner status (enabled/disabled).
A class for handling words, derived from Foam::string.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
const word & executable() const noexcept
Name of executable without the path.
int dryRun() const noexcept
Return the dry-run flag.
Extract command arguments and options from the supplied argc and argv parameters. ...
static Istream & input(Istream &is, IntRange< T > &range)
bool readCheckIfPresent(const word &optName, T &val, const Predicate &pred) const
Read the named option if present and check its validity.
bool distributed() const noexcept
Return distributed flag (i.e. are rootPaths different on different machines)
label size() const noexcept
The number of arguments.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static std::string::size_type usageMax
Max screen width when displaying usage (default: 80)
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
const ParRunControl & runControl() const noexcept
Return the run control (parallel, dry-run etc)
static HashTable< string > optionUsage
Short description for validOptions.
static void noLibs()
Add the '-no-libs' command line option.
T opt(const word &optName) const
Deprecated(2020-05) identical to get(const word& optName)
A HashTable similar to std::unordered_map.
graph_traits< Graph >::vertices_size_type size_type
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
A table of dynamically loaded libraries.
#define FOAM_DEPRECATED_STRICT(since, replacement)
static void noCheckProcessorDirectories()
Disable checking of processor directories.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
ITstream lookup(const word &optName) const
Return an input stream from the named option.
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
A list of options to ignore.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static HashSet< string > advancedOptions
The "advanced" options are shown with -help-full (not with –help)
const fileName & rootPath() const noexcept
Return root path.
bool readListIfPresent(const word &optName, List< T > &list) const
If named option is present, get a List of values treating a single entry like a list of size 1...
T getCheck(const word &optName, const Predicate &pred) const
Get a value from the named option with additional checking.
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
static fileName envRelativePath(const fileName &input, const bool caseTag=false)
Return the input relative to the globalPath by stripping off a leading value of the envGlobalPath...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
T getCheckOrDefault(const word &optName, const T &deflt, const Predicate &pred) const
Get a value from the named option with additional checking (if present), or return default...
fileName path() const
Return the full path to the (processor local) case.
static word envExecutable()
Name of the executable from environment variable.
T optionRead(const word &optName) const
Deprecated(2018-01) read a value from the named option.
bool readCheck(const word &optName, T &val, const Predicate &pred, bool mandatory=true) const
Read the named option and check its validity.
static void parallelThreads_on()
MPI threads are desired for the application.
static fileName envGlobalPath()
Global case (directory) from environment variable.
T get(const label index) const
Get a value from the argument at index.
static bool argsMandatory()
Command arguments type (optional/mandatory).
void printMan() const
Print usage as nroff-man format (Experimental)
bool setOption(const word &optName, const string ¶m="")
Set option directly (use with caution)
T argRead(const label index) const
Deprecated(2018-01) read a value from the argument at index.
const HashTable< string > & options() const noexcept
Return options.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void noBanner()
Disable emitting the banner information.
bool optionFound(const word &optName) const
Deprecated(2018-01) return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
List< T > optionReadList(const word &optName) const
Deprecated(2018-01) read a List of values from the named option.
static void addUsage(const word &optName, const string &usage)
Add option usage information to optionUsage.
Non-intrusive singly-linked list.
argList(int &argc, char **&argv, bool checkArgs=argList::argsMandatory(), bool checkOpts=true, bool initialise=true)
Construct from argc and argv checking the arguments and options as requested.
void printCompat() const
Print option compatibility.
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
static HashTable< string > validOptions
A list of valid options.
int verbose() const noexcept
Return the verbose flag.
const string & commandLine() const noexcept
The command line options and arguments concatenated as a string.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
Check the parsed command-line for mandatory arguments and that all the options are correct...
bool found(const word &optName) const
Return true if the named option is found.
An input stream of tokens.
fileName globalPath() const
Return the full path to the global case.