34 inline void Foam::argList::readList(ITstream& is, List<T>& list)
83 return rootPath()/caseName();
89 return rootPath()/globalCaseName();
99 return input.relative(globalPath(), caseTag);
112 return runControl_.distributed();
118 return runControl_.dryRun();
124 return runControl_.dryRun(level);
130 return runControl_.verbose();
136 return runControl_.verbose(level);
180 return options_.contains(optName);
194 template<>
inline int32_t argList::get<int32_t>(
const label index)
const 199 template<>
inline int64_t argList::get<int64_t>(
const label index)
const 204 template<>
inline float argList::get<float>(
const label index)
const 206 return Foam::readFloat(args_[index]);
209 template<>
inline double argList::get<double>(
const label index)
const 211 return Foam::readDouble(args_[index]);
215 template<>
inline int32_t argList::get<int32_t>(
const word& optName)
const 220 template<>
inline int64_t argList::get<int64_t>(
const word& optName)
const 225 template<>
inline float argList::get<float>(
const word& optName)
const 227 return Foam::readFloat(options_[optName]);
230 template<>
inline double argList::get<double>(
const word& optName)
const 232 return Foam::readDouble(options_[optName]);
237 inline string argList::get<Foam::string>(
const label index)
const 243 inline word argList::get<Foam::word>(
const label index)
const 249 inline fileName argList::get<Foam::fileName>(
const label index)
const 256 inline string argList::get<Foam::string>(
const word& optName)
const 258 return options_[optName];
262 inline word argList::get<Foam::word>(
const word& optName)
const 264 return options_[optName];
268 inline fileName argList::get<Foam::fileName>(
const word& optName)
const 280 ITstream is(args_[index]);
285 checkITstream(is, index);
299 checkITstream(is, optName);
312 if (options_.contains(optName))
314 return get<T>(optName);
328 if (options_.contains(optName))
330 val = get<T>(optName);
346 if (readIfPresent<T>(optName, val))
364 checkITstream(is, index);
379 if (mandatory || options_.contains(optName))
385 checkITstream(is, optName);
399 if (options_.contains(optName))
405 checkITstream(is, optName);
414 template<
class T,
class Predicate>
419 const Predicate& pred,
423 if (readIfPresent<T>(optName, val))
427 raiseBadInput(optName);
435 <<
"Option -" << optName <<
" not specified" <<
nl 443 template<
class T,
class Predicate>
448 const Predicate& pred
451 return readCheck<T>(optName, val, pred,
false);
455 template<
class T,
class Predicate>
459 const Predicate& pred
463 readCheck<T>(optName, val, pred,
true);
468 template<
class T,
class Predicate>
473 const Predicate& pred
479 if (readCheck<T>(optName, val, pred,
false))
498 return options_[optName];
int32_t readInt32(Istream &is)
Read int32_t from stream.
A class for handling file names.
Helper class for initializing parallel jobs from the command arguments, storing 'dry-run' state etc...
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const string & operator[](const label index) const
The string corresponding to the argument index.
constexpr char nl
The newline '\n' character (0x0a)
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.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const stringList & args() const noexcept
Return arguments.
int64_t readInt64(Istream &is)
Read int64_t from stream.
A class for handling words, derived from Foam::string.
const word & executable() const noexcept
Name of executable without the path.
int dryRun() const noexcept
Return the dry-run flag.
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.
const ParRunControl & runControl() const noexcept
Return the run control (parallel, dry-run etc)
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.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
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.
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.
bool readCheck(const word &optName, T &val, const Predicate &pred, bool mandatory=true) const
Read the named option and check its validity.
T get(const label index) const
Get a value from the argument at index.
static fileName validate(const std::string &, const bool doClean=true)
Construct fileName without invalid characters, possibly applying other transformations such as changi...
const HashTable< string > & options() const noexcept
Return options.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
A class for handling character strings derived from std::string.
int verbose() const noexcept
Return the verbose flag.
const string & commandLine() const noexcept
The command line options and arguments concatenated as a string.
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.