argList Class Reference

Extract command arguments and options from the supplied argc and argv parameters. More...

Collaboration diagram for argList:
[legend]

Public Member Functions

 argList (int &argc, char **&argv, bool checkArgs=argList::argsMandatory(), bool checkOpts=true, bool initialise=true)
 
 argList (const argList &args, const HashTable< string > &options, bool checkArgs=true, bool checkOpts=true, bool initialise=true)
 Construct copy with new options. More...
 
virtual ~argList ()
 Destructor. More...
 
void parse (bool checkArgs, bool checkOpts, bool initialise)
 
const wordexecutable () const
 Name of executable without the path. More...
 
const stringcommandLine () const
 The command line options and arguments concatenated as a string. More...
 
const fileNamerootPath () const
 Return root path. More...
 
const fileNamecaseName () const
 Return case name (parallel run) or global case (serial run) More...
 
const fileNameglobalCaseName () const
 Return global case name. More...
 
fileName path () const
 Return the full path to the (processor local) case. More...
 
fileName globalPath () const
 Return the full path to the global case. More...
 
fileName relativePath (const fileName &input, const bool caseTag=false) const
 
bool distributed () const
 
const ParRunControlparRunControl () const
 Return the ParRunControl. More...
 
dlLibraryTablelibs () const
 Mutable access to the loaded dynamic libraries. More...
 
label size () const noexcept
 The number of arguments. More...
 
const stringListargs () const
 Return arguments. More...
 
stringListargs ()
 Non-const access to the command arguments (non-options) More...
 
const HashTable< string > & options () const
 Return options. More...
 
HashTable< string > & options ()
 Return non-const access to the command options. More...
 
bool found (const word &optName) const
 Return true if the named option is found. More...
 
label count (const UList< word > &optionNames) const
 Return how many of the specified options were used. More...
 
label count (std::initializer_list< word > optionNames) const
 Return how many of the specified options were used. More...
 
ITstream lookup (const word &optName) const
 Return an input stream from the named option. More...
 
template<class T >
T get (const label index) const
 Get a value from the argument at index. More...
 
template<class T >
List< TgetList (const label index) const
 Get a List of values from the argument at index. More...
 
template<class T = string>
T get (const word &optName) const
 Get a value from the named option. More...
 
template<class T >
T getOrDefault (const word &optName, const T &deflt) const
 Get a value from the named option if present, or return default. More...
 
template<class T >
List< TgetList (const word &optName, bool mandatory=true) const
 
template<class T >
bool readIfPresent (const word &optName, T &val) const
 Read a value from the named option if present. More...
 
template<class T >
bool readIfPresent (const word &optName, T &val, const T &deflt) const
 Read a value from the named option if present. More...
 
template<class T >
bool readListIfPresent (const word &optName, List< T > &list) const
 
template<class T , class Predicate >
bool readCheck (const word &optName, T &val, const Predicate &pred, bool mandatory=true) const
 Read the named option and check its validity. More...
 
template<class T , class Predicate >
bool readCheckIfPresent (const word &optName, T &val, const Predicate &pred) const
 Read the named option if present and check its validity. More...
 
template<class T , class Predicate >
T getCheck (const word &optName, const Predicate &pred) const
 Get a value from the named option with additional checking. More...
 
template<class T , class Predicate >
T getCheckOrDefault (const word &optName, const T &deflt, const Predicate &pred) const
 
bool setOption (const word &optName, const string &param="")
 Set option directly (use with caution) More...
 
bool unsetOption (const word &optName)
 Unset option directly (use with caution) More...
 
void printCompat () const
 Print option compatibility. More...
 
void printNotes () const
 Print notes (if any) More...
 
void printUsage (bool full=true) const
 Print usage. More...
 
void printMan () const
 Print usage as nroff-man format (Experimental) More...
 
void displayDoc (bool source=false) const
 Display documentation in browser. More...
 
bool check (bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
 
bool checkRootCase () const
 Check root path and case path. More...
 
const stringoperator[] (const label index) const
 The string corresponding to the argument index. More...
 
const stringoperator[] (const word &optName) const
 The string associated with the named option. More...
 
template<class T = string>
T opt (const word &optName) const
 Deprecated(2020-05) identical to get(const word& optName) More...
 
template<class T >
T opt (const word &optName, const T &deflt) const
 Deprecated(2020-05) identical to getOrDefault(...) More...
 
template<class T >
T get (const word &optName, const T &deflt) const
 Deprecated(2020-05) identical to getOrDefault(...) More...
 
template<class T >
T lookupOrDefault (const word &optName, const T &deflt) const
 Deprecated(2020-05) identical to getOrDefault(...) More...
 
template<class T >
T read (const label index) const
 Deprecated(2018-08) read a value from the argument at index. More...
 
template<class T >
T argRead (const label index) const
 Deprecated(2018-01) read a value from the argument at index. More...
 
bool optionFound (const word &optName) const
 Deprecated(2018-01) return true if the named option is found. More...
 
ITstream optionLookup (const word &optName) const
 Deprecated(2018-01) return an input stream from the named option. More...
 
template<class T >
T optionRead (const word &optName) const
 Deprecated(2018-01) read a value from the named option. More...
 
template<class T >
bool optionReadIfPresent (const word &optName, T &val) const
 Deprecated(2018-01) read a value from the named option if present. More...
 
template<class T >
bool optionReadIfPresent (const word &optName, T &val, const T &deflt) const
 Deprecated(2018-01) read a value from the named option if present. More...
 
template<class T >
T optionLookupOrDefault (const word &optName, const T &deflt) const
 Deprecated(2018-01) read a value from the named option if present. More...
 
template<class T >
List< ToptionReadList (const word &optName) const
 Deprecated(2018-01) read a List of values from the named option. More...
 
template<>
int32_t get (const label index) const
 
template<>
int64_t get (const label index) const
 
template<>
float get (const label index) const
 
template<>
double get (const label index) const
 
template<>
int32_t get (const word &optName) const
 
template<>
int64_t get (const word &optName) const
 
template<>
float get (const word &optName) const
 
template<>
double get (const word &optName) const
 
template<class T >
Foam::List< TgetList (const label index) const
 
template<class T >
Foam::List< TgetList (const word &optName, bool mandatory) const
 

Static Public Member Functions

static fileName envGlobalPath ()
 Global case (directory) from environment variable. More...
 
static void addArgument (const string &argName, const string &usage="")
 Append a (mandatory) argument to validArgs. More...
 
static void addBoolOption (const word &optName, const string &usage="", bool advanced=false)
 Add a bool option to validOptions with usage information. More...
 
static void addOption (const word &optName, const string &param="", const string &usage="", bool advanced=false)
 Add an option to validOptions with usage information. More...
 
static void setAdvanced (const word &optName, bool advanced=true)
 Set an existing option as being 'advanced' or normal. More...
 
static void addOptionCompat (const word &optName, std::pair< const char *, int > compat)
 Specify an alias for the option name. More...
 
static void ignoreOptionCompat (std::pair< const char *, int > compat, bool expectArg)
 Specify an option to be ignored. More...
 
static void addUsage (const word &optName, const string &usage)
 Add option usage information to optionUsage. More...
 
static void addNote (const string &note)
 Add extra notes for the usage information. More...
 
static void removeOption (const word &optName)
 Remove option from validOptions and from optionUsage. More...
 
static void noMandatoryArgs ()
 Flag command arguments as being optional (non-mandatory) More...
 
static bool argsMandatory ()
 Command arguments type (optional/mandatory). More...
 
static void noBanner ()
 Disable emitting the banner information. More...
 
static bool bannerEnabled ()
 Banner status (enabled/disabled). More...
 
static void noFunctionObjects (bool addWithOption=false)
 Remove '-noFunctionObjects' option and ignore any occurrences. More...
 
static void noJobInfo ()
 Suppress JobInfo, overriding controlDict setting. More...
 
static void noLibs ()
 Add the '-no-libs' command line option. More...
 
static void noParallel ()
 Remove the parallel options. More...
 
static void noCheckProcessorDirectories ()
 Remove checking of processor directories. More...
 
static bool postProcess (int argc, char *argv[])
 Return true if the post-processing option is specified. More...
 

Static Public Attributes

static SLList< stringvalidArgs
 A list of valid (mandatory) arguments. More...
 
static HashSet< stringadvancedOptions
 The "advanced" options are shown with -help-full (not with –help) More...
 
static HashTable< stringvalidOptions
 A list of valid options. More...
 
static HashTable< stringvalidParOptions
 A list of valid parallel options. More...
 
static HashTable< std::pair< word, int > > validOptionsCompat
 A list of aliases for options. More...
 
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
 A list of options to ignore. More...
 
static HashTable< string, label, Hash< label > > argUsage
 Short description for program arguments. More...
 
static HashTable< stringoptionUsage
 Short description for validOptions. More...
 
static SLList< stringnotes
 General usage notes. More...
 
static std::string::size_type usageMin = 20
 Min indentation when displaying usage (default: 20) More...
 
static std::string::size_type usageMax = 80
 Max screen width when displaying usage (default: 80) More...
 
static word postProcessOptionName
 Standard name for the post-processing option. More...
 

Detailed Description

Extract command arguments and options from the supplied argc and argv parameters.

Sequences with "(" ... ")" are transformed into a stringList. For example,

    program -listFiles \( *.txt \)

would create a stringList:

    ( "file1.txt" "file2.txt" ... "fileN.txt" )

The backslash-escaping is required to avoid interpretation by the shell.

Default command-line options:

  • -case <dir>
    Select a case directory instead of the current working directory
  • -decomposeParDict <file>
    Read decomposePar dictionary from specified location
  • -parallel
    Specify case as a parallel job
  • -doc
    Display the documentation in browser
  • -srcDoc
    Display the source documentation in browser
  • -help
    Print the usage
    Additionally, the -noFunctionObjects and -postProcess options may be present for some solvers or utilities.

Environment variables set by argList or by Time:

  • FOAM_API
    The value of foamVersion::api
  • FOAM_CASE
    The path of the global case. It is the same for serial and parallel jobs.
  • FOAM_CASENAME
    The name of the global case.
  • FOAM_EXECUTABLE
    If not already present in the calling environment, it is set to the name portion of the calling executable.
  • FOAM_APPLICATION
    If not already present in the calling environment, it is set to the value of the application entry (from controlDict) if that entry is present.
    The value of the FOAM_APPLICATION may be inconsistent if the value of the application entry is adjusted during runtime.
Note
  • The document browser used is defined by the FOAM_DOC_BROWSER environment variable or the Documentation/docBrowser entry in the <etc>/controlDict file. The %f token is used as a placeholder for the file name.
  • The valid (mandatory) arguments can be adjusted via the addArgument static method instead of directly manipulating the argList::validArgs static member.
  • The valid options can be adjusted via the addOption/removeOption static methods instead of directly manipulating the argList::validOptions static member.
Source files

Definition at line 123 of file argList.H.

Constructor & Destructor Documentation

◆ argList() [1/2]

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.

By default, the argument check respects the value of argsMandatory() to decide if the arguments should be checked (when they are mandatory) or not (when they are optional)

Definition at line 760 of file argList.C.

References Foam::debug::debugObjects(), fileOperation::defaultFileHandler, DetailInfo, Foam::endl(), UPstream::exit(), Foam::getEnv(), Foam::Info, Foam::debug::infoObjects(), fileName::name(), fileOperationInitialise::New(), Foam::nl, Foam::debug::optimisationObjects(), Foam::foamVersion::printBuildInfo(), simpleObjectRegistry::setNamedInt(), and Foam::Warning.

Here is the call graph for this function:

◆ argList() [2/2]

argList ( const argList args,
const HashTable< string > &  options,
bool  checkArgs = true,
bool  checkOpts = true,
bool  initialise = true 
)

Construct copy with new options.

Definition at line 932 of file argList.C.

◆ ~argList()

~argList ( )
virtual

Destructor.

Definition at line 1602 of file argList.C.

References Foam::fileHandler(), and Foam::jobInfo.

Here is the call graph for this function:

Member Function Documentation

◆ envGlobalPath()

Foam::fileName envGlobalPath ( )
static

Global case (directory) from environment variable.

Returns the contents of the FOAM_CASE variable, which has previously been set by argList or by Time.

This will normally be identical to the value of globalPath(), but obtained via the environment.

Definition at line 537 of file argList.C.

References Foam::getEnv().

Referenced by noiseModel::baseFileDir(), pointNoise::calculate(), surfaceNoise::calculate(), boundaryDataWriter::write(), and boundaryDataWriter::writeTemplate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse()

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 initialising.

Definition at line 955 of file argList.C.

References dictionary::add(), dynamicCode::allowSystemOperations, UPstream::allWorlds(), Foam::foamVersion::api, Foam::foamVersion::build, Foam::foamVersion::buildArch, fileName::clean(), List< T >::clear(), clock::clockTime(), UPstream::commsTypeNames, Foam::cwd(), clock::date(), UPstream::defaultCommsType, fileOperation::defaultFileHandler, Foam::endl(), Foam::exit(), UPstream::exit(), Foam::FatalError, FatalErrorIn, FatalErrorInFunction, IOobject::fileCheckTypesNames, Foam::fileHandler(), fileOperation::fileHandlerPtr_, IOobject::fileModificationChecking, regIOobject::fileModificationSkew, Foam::findStrings(), Foam::flatOutput(), UPstream::floatTransfer, forAll, Foam::getEnv(), dictionary::getOrDefault(), IOstream::good(), Foam::hostName(), Foam::Info, Foam::debug::infoSwitch(), fileName::isAbsolute(), Foam::isDir(), Foam::jobInfo, UPstream::master(), UPstream::masterNo(), regIOobject::maxFileModificationPolls, UPstream::myProcNo(), UPstream::myWorld(), Foam::name(), fileOperation::New(), Foam::nl, UPstream::nPollProcInterfaces, UPstream::nProcs(), UPstream::nProcsSimpleSum, fileName::null, UPstream::parRun(), Foam::foamVersion::patch, Foam::foamVersion::patched(), Foam::pgid(), Foam::pid(), Foam::ppid(), Foam::foamVersion::printBuildInfo(), Foam::printHostsSubscription(), dictionary::readEntry(), List< T >::resize(), UPstream::scheduled, sigInt::set(), sigSegv::set(), sigQuit::set(), sigFpe::set(), string::starts_with(), UPstream::subProcs(), IOobject::timeStamp, IOobject::timeStampMaster, Foam::userName(), Foam::foamVersion::version, WarningInFunction, error::write(), IOobject::writeBanner(), and IOobject::writeDivider().

Here is the call graph for this function:

◆ executable()

const Foam::word & executable ( ) const
inline

Name of executable without the path.

Definition at line 51 of file argListI.H.

Referenced by if().

Here is the caller graph for this function:

◆ commandLine()

const Foam::string & commandLine ( ) const
inline

The command line options and arguments concatenated as a string.

Definition at line 57 of file argListI.H.

◆ rootPath()

const Foam::fileName & rootPath ( ) const
inline

Return root path.

Definition at line 63 of file argListI.H.

◆ caseName()

const Foam::fileName & caseName ( ) const
inline

Return case name (parallel run) or global case (serial run)

Definition at line 69 of file argListI.H.

◆ globalCaseName()

const Foam::fileName & globalCaseName ( ) const
inline

Return global case name.

Definition at line 75 of file argListI.H.

◆ path()

Foam::fileName path ( ) const
inline

Return the full path to the (processor local) case.

Note
This is guaranteed to be an absolute path

Definition at line 81 of file argListI.H.

◆ globalPath()

Foam::fileName globalPath ( ) const
inline

Return the full path to the global case.

Note
This is guaranteed to be an absolute path

Definition at line 87 of file argListI.H.

◆ relativePath()

Foam::fileName relativePath ( const fileName input,
const bool  caseTag = false 
) const
inline

Return the input relative to the globalPath by stripping off a leading value of the globalPath

Parameters
inputthe directory or filename to make case-relative
caseTagreplace globalPath with <case> for later use with expand(), or prefix <case> if the file name was not an absolute location

Definition at line 94 of file argListI.H.

References Foam::input().

Referenced by if().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distributed()

bool distributed ( ) const
inline

Return distributed flag (i.e. are rootPaths different on different machines)

Definition at line 103 of file argListI.H.

◆ parRunControl()

const Foam::ParRunControl & parRunControl ( ) const
inline

Return the ParRunControl.

Definition at line 109 of file argListI.H.

◆ libs()

Foam::dlLibraryTable & libs ( ) const
inline

Mutable access to the loaded dynamic libraries.

Definition at line 115 of file argListI.H.

◆ size()

Foam::label size ( ) const
inlinenoexcept

The number of arguments.

Definition at line 121 of file argListI.H.

Referenced by functionObjectList::readFunctionObject(), and zoltanRenumber::renumber().

Here is the caller graph for this function:

◆ args() [1/2]

const Foam::stringList & args ( ) const
inline

Return arguments.

Definition at line 127 of file argListI.H.

◆ args() [2/2]

Foam::stringList & args ( )
inline

Non-const access to the command arguments (non-options)

Definition at line 133 of file argListI.H.

◆ options() [1/2]

const Foam::HashTable< Foam::string > & options ( ) const
inline

Return options.

Definition at line 139 of file argListI.H.

◆ options() [2/2]

Foam::HashTable< Foam::string > & options ( )
inline

Return non-const access to the command options.

Definition at line 145 of file argListI.H.

◆ found()

bool found ( const word optName) const
inline

Return true if the named option is found.

Definition at line 151 of file argListI.H.

Referenced by if(), dynamicFvMesh::New(), functionObjectList::New(), argList::optionFound(), timeSelector::select(), timeSelector::selectIfPresent(), and Time::Time().

Here is the caller graph for this function:

◆ count() [1/2]

Foam::label count ( const UList< word > &  optionNames) const

Return how many of the specified options were used.

Definition at line 1613 of file argList.C.

References n.

◆ count() [2/2]

Foam::label count ( std::initializer_list< word optionNames) const

Return how many of the specified options were used.

Definition at line 1628 of file argList.C.

References n.

◆ lookup()

Foam::ITstream lookup ( const word optName) const
inline

Return an input stream from the named option.

Definition at line 157 of file argListI.H.

Referenced by argList::optionLookup().

Here is the caller graph for this function:

◆ get() [1/11]

T get ( const label  index) const
inline

Get a value from the argument at index.

Index 1 is the first (non-option) argument.

Definition at line 251 of file argListI.H.

References Foam::name(), and Foam::T().

Referenced by if().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getList() [1/4]

List<T> getList ( const label  index) const
inline

Get a List of values from the argument at index.

Index 1 is the first (non-option) argument.

Referenced by functionObjectList::New().

Here is the caller graph for this function:

◆ get() [2/11]

T get ( const word optName) const
inline

Get a value from the named option.

The default template parameter is string (ie, no conversion).

Definition at line 265 of file argListI.H.

References Foam::T().

Here is the call graph for this function:

◆ getOrDefault()

T getOrDefault ( const word optName,
const T deflt 
) const
inline

Get a value from the named option if present, or return default.

Definition at line 280 of file argListI.H.

References found.

Referenced by functionObjectList::New().

Here is the caller graph for this function:

◆ getList() [2/4]

List<T> getList ( const word optName,
bool  mandatory = true 
) const
inline

Get a List of values from the named option, treating a single entry like a list of size 1.

Parameters
optNamethe option name to read from
mandatoryif the option is non-mandatory, the behaviour is similar to readListIfPresent().

◆ readIfPresent() [1/2]

bool readIfPresent ( const word optName,
T val 
) const
inline

Read a value from the named option if present.

Returns
true if the named option was found.

Definition at line 296 of file argListI.H.

References found.

Referenced by if().

Here is the caller graph for this function:

◆ readIfPresent() [2/2]

bool readIfPresent ( const word optName,
T val,
const T deflt 
) const
inline

Read a value from the named option if present.

Returns
true if the named option was found, otherwise use the supplied default and return false.

Definition at line 313 of file argListI.H.

◆ readListIfPresent()

bool readListIfPresent ( const word optName,
List< T > &  list 
) const
inline

If named option is present, get a List of values treating a single entry like a list of size 1.

Returns
true if the named option was found.

Definition at line 367 of file argListI.H.

References found.

◆ readCheck()

bool readCheck ( const word optName,
T val,
const Predicate &  pred,
bool  mandatory = true 
) const
inline

Read the named option and check its validity.

FatalError if mandatory and not found, or if the predicate check failed.

Parameters
optNamethe option name
valthe value to read into
predthe value check predicate
Returns
true if the entry was found.

Definition at line 389 of file argListI.H.

References Foam::exit(), Foam::FatalError, and Foam::nl.

Here is the call graph for this function:

◆ readCheckIfPresent()

bool readCheckIfPresent ( const word optName,
T val,
const Predicate &  pred 
) const
inline

Read the named option if present and check its validity.

FatalError if found and the predicate check failed.

Parameters
optNamethe option name
valthe value to read into
predthe value check predicate
Returns
true if the entry was found.

Definition at line 418 of file argListI.H.

◆ getCheck()

T getCheck ( const word optName,
const Predicate &  pred 
) const
inline

Get a value from the named option with additional checking.

FatalError if the predicate check failed.

Parameters
optNamethe option name
predthe value check predicate

Definition at line 430 of file argListI.H.

References Foam::T().

Here is the call graph for this function:

◆ getCheckOrDefault()

T getCheckOrDefault ( const word optName,
const T deflt,
const Predicate &  pred 
) const
inline

Get a value from the named option with additional checking (if present), or return default.

FatalError if the predicate check on the retrieved value failed.

Parameters
optNamethe option name
defltthe default return value
predthe value check predicate

Definition at line 443 of file argListI.H.

References Foam::T().

Here is the call graph for this function:

◆ addArgument()

addArgument ( const string argName,
const string usage = "" 
)
static

Append a (mandatory) argument to validArgs.

Definition at line 315 of file argList.C.

◆ addBoolOption()

addBoolOption ( const word optName,
const string usage = "",
bool  advanced = false 
)
static

Add a bool option to validOptions with usage information.

Definition at line 338 of file argList.C.

Referenced by timeSelector::addOptions().

Here is the caller graph for this function:

◆ addOption()

addOption ( const word optName,
const string param = "",
const string usage = "",
bool  advanced = false 
)
static

Add an option to validOptions with usage information.

An option with an empty param is a bool option

Definition at line 349 of file argList.C.

Referenced by timeSelector::addOptions().

Here is the caller graph for this function:

◆ setAdvanced()

void setAdvanced ( const word optName,
bool  advanced = true 
)
static

Set an existing option as being 'advanced' or normal.

Definition at line 368 of file argList.C.

◆ addOptionCompat()

void addOptionCompat ( const word optName,
std::pair< const char *, int >  compat 
)
static

Specify an alias for the option name.

Parameters
optNamethe currently used option name
compatalias name and the last OpenFOAM version (YYMM) when the alias was not needed. Setting a zero or negative version suppresses warnings about the alias.

Definition at line 382 of file argList.C.

◆ ignoreOptionCompat()

void ignoreOptionCompat ( std::pair< const char *, int >  compat,
bool  expectArg 
)
static

Specify an option to be ignored.

Parameters
compatoptName and the last OpenFOAM version (YYMM) when the option was directly supported. Setting a zero or negative version suppresses warnings about the alias.
expectArgthe option is non-bool

Definition at line 396 of file argList.C.

◆ addUsage()

void addUsage ( const word optName,
const string usage 
)
static

Add option usage information to optionUsage.

Definition at line 410 of file argList.C.

◆ addNote()

addNote ( const string note)
static

Add extra notes for the usage information.

This string is used "as-is" without additional formatting

Definition at line 426 of file argList.C.

◆ removeOption()

void removeOption ( const word optName)
static

Remove option from validOptions and from optionUsage.

Definition at line 435 of file argList.C.

◆ noMandatoryArgs()

void noMandatoryArgs ( )
static

Flag command arguments as being optional (non-mandatory)

Definition at line 443 of file argList.C.

◆ argsMandatory()

bool argsMandatory ( )
static

Command arguments type (optional/mandatory).

Definition at line 449 of file argList.C.

◆ noBanner()

void noBanner ( )
static

Disable emitting the banner information.

Adjusts the Foam::infoDetailLevel flag.

Definition at line 455 of file argList.C.

References Foam::infoDetailLevel.

◆ bannerEnabled()

bool bannerEnabled ( )
static

Banner status (enabled/disabled).

Queries the Foam::infoDetailLevel flag.

Definition at line 461 of file argList.C.

References Foam::infoDetailLevel.

◆ noFunctionObjects()

void noFunctionObjects ( bool  addWithOption = false)
static

Remove '-noFunctionObjects' option and ignore any occurrences.

Optionally add a '-withFunctionObjects' option instead

Definition at line 467 of file argList.C.

◆ noJobInfo()

void noJobInfo ( )
static

Suppress JobInfo, overriding controlDict setting.

Definition at line 487 of file argList.C.

References JobInfo::writeJobInfo.

◆ noLibs()

void noLibs ( )
static

Add the '-no-libs' command line option.

Definition at line 493 of file argList.C.

◆ noParallel()

void noParallel ( )
static

Remove the parallel options.

Definition at line 504 of file argList.C.

◆ noCheckProcessorDirectories()

void noCheckProcessorDirectories ( )
static

Remove checking of processor directories.

Definition at line 515 of file argList.C.

◆ postProcess()

bool postProcess ( int  argc,
char *  argv[] 
)
static

Return true if the post-processing option is specified.

Definition at line 521 of file argList.C.

◆ setOption()

bool setOption ( const word optName,
const string param = "" 
)

Set option directly (use with caution)

An option with an empty param is a bool option. Not all valid options can also be set: eg, -case, -roots, ... Return true if the existing option value needed changing, or if the option did not previously exist.

Definition at line 1644 of file argList.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Here is the call graph for this function:

◆ unsetOption()

bool unsetOption ( const word optName)

Unset option directly (use with caution)

Not all valid options can also be unset: eg, -case, -roots ... Return true if the option existed before being unset.

Definition at line 1670 of file argList.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Here is the call graph for this function:

◆ printCompat()

void printCompat ( ) const

Print option compatibility.

Definition at line 540 of file argListHelp.C.

References HashTable< T, Key, Hash >::cfind(), argList::ignoreOptionsCompat, Foam::Info, k, Foam::nl, Foam::setf(), Foam::setfill(), Foam::setw(), token::SPACE, and argList::validOptionsCompat.

Here is the call graph for this function:

◆ printNotes()

void printNotes ( ) const

Print notes (if any)

Definition at line 462 of file argListHelp.C.

References Foam::Info, Foam::nl, and Foam::stringOps::writeWrapped().

Here is the call graph for this function:

◆ printUsage()

void printUsage ( bool  full = true) const

Print usage.

Definition at line 366 of file argListHelp.C.

References argList::argUsage, Foam::endl(), argList::ignoreOptionsCompat, Foam::Info, Foam::nl, string::null, Foam::foamVersion::printBuildInfo(), Foam::printOption(), Foam::printOptionUsage(), and argList::validOptionsCompat.

Here is the call graph for this function:

◆ printMan()

void printMan ( ) const

Print usage as nroff-man format (Experimental)

Definition at line 200 of file argListHelp.C.

References argList::advancedOptions, Foam::foamVersion::api, argList::argUsage, token::DQUOTE, HashTable< T, Key, Hash >::empty(), argList::ignoreOptionsCompat, Foam::Info, Foam::nl, argList::notes, string::null, Foam::printManFooter(), Foam::printManOption(), token::SPACE, Foam::stringOps::upper(), argList::usageMax, argList::validArgs, argList::validOptions, argList::validOptionsCompat, and Foam::stringOps::writeWrapped().

Here is the call graph for this function:

◆ displayDoc()

void displayDoc ( bool  source = false) const

Display documentation in browser.

Optionally display the application source code

Definition at line 1692 of file argList.C.

References Foam::foamVersion::api, Foam::debug::controlDict(), Foam::endl(), Foam::stringOps::expand(), dictionary::get(), Foam::getEnv(), Foam::Info, Foam::isFile(), Foam::nl, dictionary::readEntry(), string::replace(), Foam::stringOps::splitSpace(), string::starts_with(), dictionary::subDict(), and Foam::system().

Here is the call graph for this function:

◆ check()

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.

By default, the argument check respects the value of argsMandatory() to decide if the arguments should be checked (when they are mandatory) or not (when they are optional)

Definition at line 1766 of file argList.C.

References Foam::endl(), Foam::FatalError, forAllConstIters(), UPstream::master(), and Foam::nl.

Here is the call graph for this function:

◆ checkRootCase()

bool checkRootCase ( ) const

Check root path and case path.

Definition at line 1812 of file argList.C.

References Foam::endl(), Foam::FatalError, Foam::fileHandler(), Foam::isDir(), UPstream::master(), and path().

Here is the call graph for this function:

◆ operator[]() [1/2]

const Foam::string & operator[] ( const label  index) const
inline

The string corresponding to the argument index.

Index 0 is the executable. Index 1 is the first (non-option) argument.

Definition at line 463 of file argListI.H.

◆ operator[]() [2/2]

const Foam::string & operator[] ( const word optName) const
inline

The string associated with the named option.

Definition at line 469 of file argListI.H.

◆ opt() [1/2]

T opt ( const word optName) const
inline

Deprecated(2020-05) identical to get(const word& optName)

Deprecated:
(2020-05) - use get() method

Definition at line 658 of file argList.H.

◆ opt() [2/2]

T opt ( const word optName,
const T deflt 
) const
inline

Deprecated(2020-05) identical to getOrDefault(...)

Deprecated:
(2020-05) - use getOrDefault() method

Definition at line 666 of file argList.H.

◆ get() [3/11]

T get ( const word optName,
const T deflt 
) const
inline

Deprecated(2020-05) identical to getOrDefault(...)

Deprecated:
(2020-05) - use getOrDefault() method

Definition at line 674 of file argList.H.

◆ lookupOrDefault()

T lookupOrDefault ( const word optName,
const T deflt 
) const
inline

Deprecated(2020-05) identical to getOrDefault(...)

Deprecated:
(2020-05) - use getOrDefault() method

Definition at line 682 of file argList.H.

◆ read()

T read ( const label  index) const
inline

Deprecated(2018-08) read a value from the argument at index.

Index 1 is the first (non-option) argument.

Deprecated:
(2018-08) - use get() method

Definition at line 697 of file argList.H.

◆ argRead()

T argRead ( const label  index) const
inline

Deprecated(2018-01) read a value from the argument at index.

Index 1 is the first (non-option) argument.

Deprecated:
(2018-01) - use get() method

Definition at line 707 of file argList.H.

◆ optionFound()

bool optionFound ( const word optName) const
inline

Deprecated(2018-01) return true if the named option is found.

Deprecated:
(2018-01) - use found() method

Definition at line 715 of file argList.H.

References argList::found().

Here is the call graph for this function:

◆ optionLookup()

ITstream optionLookup ( const word optName) const
inline

Deprecated(2018-01) return an input stream from the named option.

Deprecated:
(2018-01) - use lookup() method

Definition at line 723 of file argList.H.

References argList::lookup().

Here is the call graph for this function:

◆ optionRead()

T optionRead ( const word optName) const
inline

Deprecated(2018-01) read a value from the named option.

Deprecated:
(2018-01) - use get() method

Definition at line 732 of file argList.H.

◆ optionReadIfPresent() [1/2]

bool optionReadIfPresent ( const word optName,
T val 
) const
inline

Deprecated(2018-01) read a value from the named option if present.

Return true if the named option was found.

Deprecated:
(2018-01) - use readIfPresent() method

Definition at line 743 of file argList.H.

◆ optionReadIfPresent() [2/2]

bool optionReadIfPresent ( const word optName,
T val,
const T deflt 
) const
inline

Deprecated(2018-01) read a value from the named option if present.

Return true if the named option was found, otherwise use the supplied default and return false.

Deprecated:
(2018-01) - use readIfPresent() method

Definition at line 758 of file argList.H.

◆ optionLookupOrDefault()

T optionLookupOrDefault ( const word optName,
const T deflt 
) const
inline

Deprecated(2018-01) read a value from the named option if present.

Return supplied default otherwise.

Deprecated:
(2018-01) - use getOrDefault() method

Definition at line 773 of file argList.H.

◆ optionReadList()

List<T> optionReadList ( const word optName) const
inline

Deprecated(2018-01) read a List of values from the named option.

Deprecated:
(2018-01) - use getList() method

Definition at line 785 of file argList.H.

◆ get() [4/11]

int32_t get ( const label  index) const
inline

Definition at line 167 of file argListI.H.

References Foam::readInt32().

Here is the call graph for this function:

◆ get() [5/11]

int64_t get ( const label  index) const
inline

Definition at line 172 of file argListI.H.

References Foam::readInt64().

Here is the call graph for this function:

◆ get() [6/11]

float get ( const label  index) const
inline

Definition at line 177 of file argListI.H.

◆ get() [7/11]

double get ( const label  index) const
inline

Definition at line 182 of file argListI.H.

◆ get() [8/11]

int32_t get ( const word optName) const
inline

Definition at line 188 of file argListI.H.

References Foam::readInt32().

Here is the call graph for this function:

◆ get() [9/11]

int64_t get ( const word optName) const
inline

Definition at line 193 of file argListI.H.

References Foam::readInt64().

Here is the call graph for this function:

◆ get() [10/11]

float get ( const word optName) const
inline

Definition at line 198 of file argListI.H.

◆ get() [11/11]

double get ( const word optName) const
inline

Definition at line 203 of file argListI.H.

◆ getList() [3/4]

Foam::List<T> getList ( const label  index) const
inline

Definition at line 330 of file argListI.H.

References Foam::name().

Here is the call graph for this function:

◆ getList() [4/4]

Foam::List<T> getList ( const word optName,
bool  mandatory 
) const
inline

Definition at line 345 of file argListI.H.

References found.

Member Data Documentation

◆ validArgs

Foam::SLList< Foam::string > validArgs
static

A list of valid (mandatory) arguments.

Definition at line 204 of file argList.H.

Referenced by argList::printMan().

◆ advancedOptions

Foam::HashSet< Foam::string > advancedOptions
static

The "advanced" options are shown with -help-full (not with –help)

Definition at line 207 of file argList.H.

Referenced by argList::printMan().

◆ validOptions

Foam::HashTable< Foam::string > validOptions
static

A list of valid options.

Definition at line 210 of file argList.H.

Referenced by argList::printMan(), Foam::printManOption(), Foam::printOption(), timeSelector::select(), and Time::Time().

◆ validParOptions

Foam::HashTable< Foam::string > validParOptions
static

A list of valid parallel options.

Definition at line 213 of file argList.H.

Referenced by Foam::printManOption().

◆ validOptionsCompat

Foam::HashTable< std::pair< Foam::word, int > > validOptionsCompat
static

A list of aliases for options.

Stored as (alias = canonical, version)

Definition at line 217 of file argList.H.

Referenced by argList::printCompat(), argList::printMan(), and argList::printUsage().

◆ ignoreOptionsCompat

Foam::HashTable< std::pair< bool, int > > ignoreOptionsCompat
static

A list of options to ignore.

Stored as (option = bool, version)

Definition at line 221 of file argList.H.

Referenced by argList::printCompat(), argList::printMan(), and argList::printUsage().

◆ argUsage

Foam::HashTable< Foam::string, Foam::label, Foam::Hash< Foam::label > > argUsage
static

Short description for program arguments.

Definition at line 224 of file argList.H.

Referenced by argList::printMan(), and argList::printUsage().

◆ optionUsage

Foam::HashTable< Foam::string > optionUsage
static

Short description for validOptions.

Definition at line 227 of file argList.H.

Referenced by Foam::printManOption(), and Foam::printOption().

◆ notes

Foam::SLList< Foam::string > notes
static

General usage notes.

Definition at line 230 of file argList.H.

Referenced by argList::printMan().

◆ usageMin

std::string::size_type usageMin = 20
static

Min indentation when displaying usage (default: 20)

Definition at line 233 of file argList.H.

Referenced by Foam::printOptionUsage().

◆ usageMax

std::string::size_type usageMax = 80
static

Max screen width when displaying usage (default: 80)

Definition at line 236 of file argList.H.

Referenced by argList::printMan(), Foam::printManOption(), and Foam::printOptionUsage().

◆ postProcessOptionName

Foam::word postProcessOptionName
static

Standard name for the post-processing option.

Definition at line 239 of file argList.H.


The documentation for this class was generated from the following files: