Go to the documentation of this file.
55 bool Foam::argList::argsMandatory_ =
true;
56 bool Foam::argList::checkProcessorDirectories_ =
true;
73 Foam::argList::initValidTables::initValidTables()
79 "Specify case directory to use (instead of cwd)"
85 "Additional library or library list to load"
86 " (can be used multiple times)",
94 "Specify the value of a registered debug switch."
95 " Default is 1 if the value is omitted."
96 " (Can be used multiple times)",
104 "Specify the value of a registered info switch."
105 " Default is 1 if the value is omitted."
106 " (Can be used multiple times)",
114 "Specify the value of a registered optimisation switch."
115 " Default is 1 if the value is omitted."
116 " (Can be used multiple times)",
120 argList::addBoolOption(
"parallel",
"Run in parallel");
121 validParOptions.set(
"parallel",
"");
126 "Subprocess root directories for distributed running",
139 "Use specified file for decomposePar dictionary"
144 "((host1 dir1) .. (hostN dirN))",
145 "Per-subprocess root directories for distributed running."
146 " The host specification can be a regex.",
152 "((host1 dir1) .. (hostN dirN))"
155 argList::addBoolOption
158 "Do not execute function objects",
166 "Override the file handler type",
174 "Name of the local world for parallel communication",
190 Pstream::addValidParOptions(validParOptions);
209 Info<<
"Hosts :\n(" <<
nl;
214 for (
const auto& str : hostProcs)
216 std::string curr(str.substr(0, str.rfind(
'.')));
223 Info<<
" (" << prev.c_str() <<
' ' <<
count <<
')' <<
nl;
227 prev = std::move(curr);
235 Info<<
" (" << prev.c_str() <<
' ' <<
count <<
')' <<
nl;
246 void Foam::argList::checkITstream(
const ITstream& is,
const label index)
248 const label remaining = is.nRemainingTokens();
254 <<
"--> FOAM WARNING:" <<
nl
255 <<
"Argument " << index <<
" has "
256 << remaining <<
" excess tokens" <<
nl <<
nl;
262 <<
"--> FOAM WARNING:" <<
nl
263 <<
"Argument " << index <<
" had no tokens" <<
nl <<
nl;
268 void Foam::argList::checkITstream(
const ITstream& is,
const word& optName)
270 const label remaining = is.nRemainingTokens();
276 <<
"--> FOAM WARNING:" <<
nl
277 <<
"Option -" << optName <<
" has "
278 << remaining <<
" excess tokens" <<
nl <<
nl;
284 <<
"--> FOAM WARNING:" <<
nl
285 <<
"Option -" << optName <<
" had no tokens" <<
nl <<
nl;
290 void Foam::argList::raiseBadInput(
const word& optName)
const
295 <<
"Option -" << optName <<
" with invalid input" <<
nl
302 const string& argName,
306 validArgs.append(argName);
310 const label index = validArgs.size();
314 argUsage.erase(index);
318 argUsage.set(index, usage);
342 validOptions.set(optName, param);
345 optionUsage.set(optName, usage);
349 advancedOptions.set(optName);
356 if (advanced && validOptions.found(optName))
358 advancedOptions.set(optName);
362 advancedOptions.erase(optName);
370 std::pair<const char*,int> compat
373 validOptionsCompat.insert
376 std::pair<word,int>(optName, compat.second)
383 std::pair<const char*,int> compat,
387 ignoreOptionsCompat.insert
390 std::pair<bool,int>(expectArg, compat.second)
403 optionUsage.erase(optName);
407 optionUsage.set(optName, usage);
423 validOptions.erase(optName);
424 optionUsage.erase(optName);
425 advancedOptions.erase(optName);
431 argsMandatory_ =
false;
437 return argsMandatory_;
475 removeOption(
"noFunctionObjects");
479 ignoreOptionCompat({
"noFunctionObjects", 0},
false);
485 "withFunctionObjects",
486 "Execute functionObjects",
504 "Disable use of the controlDict libs entry",
512 removeOption(
"parallel");
513 removeOption(
"roots");
514 removeOption(
"decomposeParDict");
515 removeOption(
"hostRoots");
516 removeOption(
"world");
517 validParOptions.clear();
523 checkProcessorDirectories_ =
false;
529 for (
int i=1; i<argc; ++i)
531 if (argv[i] ==
'-' + postProcessOptionName)
561 if (
input.isAbsolute())
563 return input.relative(envGlobalPath(), caseTag);
577 if (!validOptionsCompat.empty())
579 const auto fnd = validOptionsCompat.cfind(optName.substr(1));
583 const auto& alt = fnd.val();
589 <<
"--> FOAM IOWarning :" <<
nl
590 <<
" Found [v" << alt.second <<
"] '"
591 << optName <<
"' instead of '-"
592 << alt.first <<
"' option"
599 return "-" + alt.first;
608 int Foam::argList::optionIgnore(
const word& optName)
612 if (!ignoreOptionsCompat.empty())
614 const auto fnd = ignoreOptionsCompat.cfind(optName);
618 const auto& alt = fnd.val();
622 const int nskip = (alt.first ? 2 : 1);
628 <<
"--> FOAM IOWarning :" <<
nl
629 <<
" Ignoring [v" << alt.second <<
"] '-"
630 << optName << (nskip > 1 ?
" ARG" :
"")
646 bool Foam::argList::regroupArgv(
int& argc,
char**& argv)
656 args_[0] = fileName(argv[0]);
657 for (
int argi = 1; argi < argc; ++argi)
659 if (strcmp(argv[argi],
"(") == 0)
664 else if (strcmp(argv[argi],
")") == 0)
672 args_[nArgs++] =
group;
678 args_[nArgs++] = argv[argi];
688 else if (argv[argi][0] ==
'-')
691 const char *optName = &argv[argi][1];
693 if (validOptions.found(optName))
696 args_[nArgs++] = argv[argi];
698 else if ((ignore = optionIgnore(optName)) > 0)
709 args_[nArgs++] = optionCompat(argv[argi]);
714 args_[nArgs++] = argv[argi];
721 args_[nArgs++] =
group;
727 for (
const auto&
s : args_)
733 commandLine_.reserve(len);
739 void Foam::argList::setCasePaths()
743 const auto optIter = options_.cfind(
"case");
749 if (caseDir.empty() || caseDir ==
".")
753 options_.erase(
"case");
758 caseDir.toAbsolute();
769 rootPath_ = caseDir.path();
770 globalCase_ = caseDir.name();
777 setEnv(
"FOAM_CASE", caseDir,
true);
778 setEnv(
"FOAM_CASENAME", globalCase_,
true);
781 setEnv(
"FOAM_EXECUTABLE", executable_,
false);
802 for (
int argi = argc-2; argi > 0; --argi)
804 if (argv[argi][0] ==
'-')
806 const char *optName = &argv[argi][1];
808 if (strcmp(optName,
"fileHandler") == 0)
810 handlerType = argv[argi+1];
815 if (handlerType.empty())
818 if (handlerType.empty())
830 )().needsThreading();
835 for (
int argi = 1; argi < argc; ++argi)
837 if (argv[argi][0] ==
'-')
839 const char *optName = &argv[argi][1];
841 if (validParOptions.found(optName))
843 runControl_.runPar(argc, argv, needsThread);
850 regroupArgv(argc, argv);
851 commandLine_ += args_[0];
857 int numDryRun = 0, numVerbose = 0;
861 for (
int argi = 1; argi < args_.size(); ++argi)
864 commandLine_ += args_[argi];
866 if (args_[argi][0] ==
'-')
868 const char *optName = &args_[argi][1];
873 <<
"Ignoring lone '-' on the command-line" <<
endl;
884 auto optIter = validOptions.cfind(optName);
888 || (optIter = validParOptions.cfind(optName)).
found()
891 wantArg = !optIter.val().empty();
901 if (argi >= args_.size())
906 <<
"Error: option '-" << optName
907 <<
"' requires an argument" <<
nl <<
nl
908 <<
"See '" << executable_ <<
" -help' for usage"
915 commandLine_ += args_[argi];
921 if (strcmp(optName,
"lib") == 0)
925 libs().append(this->getList<fileName>(argi));
927 else if (strcmp(optName,
"debug-switch") == 0)
935 else if (strcmp(optName,
"info-switch") == 0)
943 else if (strcmp(optName,
"opt-switch") == 0)
955 options_.set(optName, args_[argi]);
963 options_.insert(optName,
"");
968 if (strcmp(optName,
"dry-run") == 0)
972 else if (strcmp(optName,
"verbose") == 0)
983 args_[nArgs] = args_[argi];
990 runControl_.dryRun(numDryRun);
991 runControl_.verbose(numVerbose);
995 parse(checkArgs, checkOpts, initialise);
1008 runControl_(
args.runControl_),
1012 executable_(
args.executable_),
1013 rootPath_(
args.rootPath_),
1014 globalCase_(
args.globalCase_),
1016 commandLine_(
args.commandLine_)
1018 parse(checkArgs, checkOpts, initialise);
1036 bool quickExit =
false;
1039 if (options_.found(
"doc"))
1044 else if (options_.found(
"doc-source"))
1051 if (options_.found(
"help-full"))
1056 else if (options_.found(
"help-notes"))
1062 else if (options_.found(
"help"))
1067 else if (options_.found(
"help-man"))
1074 if (options_.found(
"help-compat"))
1087 if (!
check(checkArgs, checkOpts))
1123 <<
"Exec : " << commandLine_.c_str() <<
nl
1124 <<
"Date : " << dateString.c_str() <<
nl
1125 <<
"Time : " << timeString.c_str() <<
nl
1127 <<
"PID : " <<
pid() <<
nl;
1140 const auto space =
build.find(
' ');
1141 if (space != std::string::npos)
1143 build.resize(space);
1155 libs().open(bannerEnabled());
1169 options_.lookup(
"fileHandler",
Foam::getEnv(
"FOAM_FILEHANDLER"))
1172 if (handlerType.empty())
1186 if (runControl_.parRun())
1199 fromSubproc >> procBuild >> hostMachine[proci] >> procPid;
1201 hostProcs[proci] = hostMachine[proci] +
"." +
name(procPid);
1209 <<
" but proc " << subproci <<
" is running "
1234 if (runControl_.parRun())
1245 if (this->readIfPresent(
"decomposeParDict", source))
1247 bool adjustOpt =
false;
1251 source /=
"decomposeParDict";
1258 source = rootPath_/globalCase_/source;
1266 options_.set(
"decomposeParDict", source);
1271 label dictNProcs = -1;
1272 if (this->readListIfPresent(
"roots", roots))
1275 runControl_.distributed(
true);
1279 <<
"The -roots option must contain values"
1282 if (roots.size() > 1)
1284 dictNProcs = roots.size()+1;
1287 else if (options_.found(
"hostRoots"))
1289 source =
"-hostRoots";
1290 runControl_.distributed(
true);
1295 checkITstream(is,
"hostRoots");
1297 if (hostRoots.empty())
1300 <<
"The -hostRoots option must contain values"
1306 for (
const auto& hostRoot : hostRoots)
1312 for (
const label matchi : matched)
1314 if (!roots[matchi].empty())
1317 <<
"Multiple matching roots for "
1318 << hostMachine[matchi] <<
" in "
1323 roots[matchi] = hostRoot.second();
1330 if (roots[hosti].empty())
1333 <<
"No matching roots for "
1334 << hostMachine[hosti] <<
" in "
1340 if (roots.size() > 1)
1342 dictNProcs = roots.size()+1;
1349 const bool useDefault = source.empty();
1352 source = rootPath_/globalCase_/
"system"/
"decomposeParDict";
1367 if (dictStream && dictStream->
good())
1370 bool nDomainsMandatory =
false;
1374 nDomainsMandatory =
true;
1375 runControl_.distributed(
true);
1381 <<
"WARNING: running distributed"
1382 <<
" but did not specify roots!" <<
nl;
1390 "numberOfSubdomains",
1402 <<
"WARNING: running without decomposeParDict "
1403 << this->relativePath(source) <<
nl;
1409 <<
"Cannot read decomposeParDict: "
1410 << this->relativePath(source) <<
nl
1418 <<
"Running parallel on single processor. This only"
1419 <<
" makes sense for multi-world simulation" <<
endl;
1426 if (roots.size() == 1)
1432 if (dictNProcs <= 0)
1434 dictNProcs = roots.size()+1;
1450 checkProcessorDirectories_
1456 << this->relativePath(source)
1457 <<
" specifies " << dictNProcs
1458 <<
" processors but job was started with "
1469 <<
"number of entries in roots "
1471 <<
" is not equal to the number of sub-processes "
1482 const bool hadCaseOpt = options_.found(
"case");
1485 options_.set(
"case", roots[subproci-1]/globalCase_);
1489 << args_ << options_
1490 << runControl_.distributed()
1491 << label(runControl_.dryRun())
1492 << label(runControl_.verbose());
1495 options_.erase(
"case");
1500 options_.set(
"case", rootPath_/globalCase_);
1509 checkProcessorDirectories_
1515 label nProcDirs = 0;
1520 rootPath_/globalCase_
1529 <<
"number of processor directories = "
1531 <<
" is not equal to the number of processors = "
1542 << args_ << options_
1543 << runControl_.distributed()
1544 << label(runControl_.dryRun())
1545 << label(runControl_.verbose());
1553 label numDryRun, numVerbose;
1561 >> args_ >> options_
1563 >> numDryRun >> numVerbose;
1565 runControl_.distributed(isDistributed);
1566 runControl_.dryRun(numDryRun);
1567 runControl_.verbose(numVerbose);
1580 case_ = globalCase_;
1587 case_ = globalCase_;
1591 if (runControl_.distributed())
1602 if (!writeHostsSwitch)
1615 Info<<
"Case : " << (rootPath_/globalCase_).c_str() <<
nl
1616 <<
"nProcs : " << nProcs <<
nl;
1618 if (runControl_.parRun())
1620 if (hostProcs.size())
1622 if (writeHostsSwitch == 1)
1627 else if (writeHostsSwitch)
1630 Info<<
"Hosts :\n(" <<
nl;
1637 for (
const auto& str : hostProcs)
1639 Info<<
" " << str.c_str() <<
nl;
1646 Info<<
"Roots : " << roots <<
nl;
1648 Info<<
"Pstream initialized with:" <<
nl
1670 if (hostProcs.size())
1689 Info<<
"fileModificationChecking : "
1690 <<
"Monitoring run-time modified files using "
1703 Info<<
" (fileModificationSkew "
1709 Info<<
" (fileModificationSkew "
1711 <<
", maxFileModificationPolls "
1718 <<
"Invalid setting for maxFileModificationPolls "
1725 Info<<
"allowSystemOperations : ";
1732 Info<<
"Disallowing";
1734 Info<<
" user-supplied system call operations" <<
nl
1758 for (
const word& optName : optionNames)
1760 if (options_.found(optName))
1771 std::initializer_list<word> optionNames
1775 for (
const word& optName : optionNames)
1777 if (options_.found(optName))
1792 || optName ==
"parallel"
1793 || optName ==
"roots"
1797 <<
"Option: '" << optName <<
"' is protected" <<
nl
1802 if (options_.found(optName) ? (options_[optName] != param) :
true)
1804 options_.set(optName, param);
1818 || optName ==
"parallel"
1819 || optName ==
"roots"
1820 || optName ==
"hostRoots"
1824 <<
"Option: '" << optName <<
"' is protected" <<
nl
1830 return options_.erase(optName);
1843 docExt.
replace(
".",
"_source.");
1848 for (
const fileName& dir : docDirs)
1851 if (dir.starts_with(
"http:") || dir.starts_with(
"https:"))
1853 url = dir/executable_ + docExt;
1862 ?
isFile(docFile.substr(7))
1866 url = std::move(docFile);
1874 <<
"No documentation found for " << executable_
1875 <<
", but you can use -help to display the usage\n" <<
endl;
1880 string docBrowser =
getEnv(
"FOAM_DOC_BROWSER");
1881 if (docBrowser.empty())
1883 docDict.
readEntry(
"docBrowser", docBrowser);
1887 if (docBrowser.find(
"%f") != std::string::npos)
1889 docBrowser.
replace(
"%f", url);
1893 docBrowser +=
" " + url;
1902 <<
" " << command <<
nl <<
endl;
1914 const label nargs = args_.size()-1;
1915 if (checkArgs && nargs != validArgs.size())
1918 <<
"Expected " << validArgs.size()
1919 <<
" arguments but found " << nargs <<
endl;
1927 const word& optName = iter.key();
1930 !validOptions.found(optName)
1931 && !validParOptions.found(optName)
1935 <<
"Invalid option: -" << optName <<
endl;
1945 <<
"See '" << executable_ <<
" -help' for usage"
1960 <<
": cannot open root directory " << rootPath()
1968 if (checkProcessorDirectories_ && pathDir.empty() &&
Pstream::master())
1974 <<
": cannot open case directory " <<
path()
static SLList< string > validArgs
A list of valid (mandatory) arguments.
string & replace(const std::string &s1, const std::string &s2, size_type pos=0)
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
static void set(bool verbose=false)
Activate SIGFPE signal handler when FOAM_SIGFPE is set.
static void noBanner()
Disable emitting the banner information.
static std::string::size_type usageMin
Min indentation when displaying usage (default: 20)
const std::string build
OpenFOAM build information as a std::string.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
static constexpr int masterNo() noexcept
Process index of the master (always 0)
static void addUsage(const word &optName, const string &usage)
Add option usage information to optionUsage.
A class for handling words, derived from Foam::string.
Foam::argList::initValidTables dummyInitValidTables
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
static std::string::size_type usageMax
Max screen width when displaying usage (default: 80)
A class for handling file names.
static HashTable< std::pair< word, int > > validOptionsCompat
A list of aliases for options.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
constexpr const char *const group
Group name for atomic constants.
void resize(const label len)
Adjust allocated size of list.
static fileName envGlobalPath()
Global case (directory) from environment variable.
static autoPtr< fileOperation > fileHandlerPtr_
Static fileOperation.
Output inter-processor communications stream.
bool starts_with(const std::string &s) const
True if string starts with the given prefix (cf. C++20)
static HashTable< string > optionUsage
Short description for validOptions.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
static void addNote(const string ¬e)
Add extra notes for the usage information.
static bool master(const label communicator=worldComm)
Am I the master process.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
Extract command arguments and options from the supplied argc and argv parameters.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
const fileOperation & fileHandler()
Get current file handler.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
static commsTypes defaultCommsType
Default commsType.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
bool good() const noexcept
True if the Switch represents a valid enumeration.
Foam::SubStrings< StringType > splitSpace(const StringType &str)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
void write() const
Write job info to its file in the "running" jobs directory.
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
static void noMandatoryArgs()
Flag command arguments as being optional (non-mandatory)
string getEnv(const std::string &envName)
Get environment value for given envName.
#define forAll(list, i)
Loop across all elements in list.
argList(int &argc, char **&argv, bool checkArgs=argList::argsMandatory(), bool checkOpts=true, bool initialise=true)
pid_t pgid()
Return the group PID of this process.
bool good() const noexcept
True if next operation might succeed.
static int allowSystemOperations
Flag if system operations are allowed.
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
static void disable() noexcept
Disallow JobInfo by forcing writeJobInfo (InfoSwitch) off.
static const wordList & allWorlds() noexcept
All worlds.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
static autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type.
Template class for non-intrusive linked lists.
static HashTable< string > validParOptions
A list of valid parallel options.
void parse(bool checkArgs, bool checkOpts, bool initialise)
static void noLibs()
Add the '-no-libs' command line option.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
string userName()
Return the user's login name.
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
static void check(const int retVal, const char *what)
void setNamedValue(std::string name, int val, bool report=false)
Set named value, but also handle embedded 'name=value' syntax.
An input stream of tokens.
bool setOption(const word &optName, const string ¶m="")
Set option directly (use with caution)
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
messageStream Info
Information stream (stdout output on master, null elsewhere)
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
static bool floatTransfer
pid_t pid()
Return the PID of this process.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
pid_t ppid()
Return the parent PID of this process.
static fileName envRelativePath(const fileName &input, const bool caseTag=false)
static word postProcessOptionName
Standard name for the post-processing option.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
graph_traits< Graph >::vertices_size_type size_type
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
Lookup type of boundary radiation properties.
static const Enum< commsTypes > commsTypeNames
Names of the communication types.
static float fileModificationSkew
Time skew (seconds) for file modification checks.
static const word & myWorld()
My world.
static void noCheckProcessorDirectories()
Remove checking of processor directories.
static HashTable< string > validOptions
A list of valid options.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
static bool postProcess(int argc, char *argv[])
Return true if the post-processing option is specified.
static fileName validate(const std::string &, const bool doClean=true)
static std::string date()
static word defaultFileHandler
Name of the default fileHandler.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
int infoDetailLevel
Global for selective suppression of Info output.
static const fileName null
An empty fileName.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
bool unsetOption(const word &optName)
Unset option directly (use with caution)
static int nProcsSimpleSum
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static word envExecutable()
Name of the executable from environment variable.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static HashSet< string > advancedOptions
The "advanced" options are shown with -help-full (not with –help)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void stop()
Job end with "normal" termination.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
forAllConstIters(mixture.phases(), phase)
static bool argsMandatory()
Command arguments type (optional/mandatory).
const std::string patch
OpenFOAM patch number as a std::string.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
static void set(bool verbose=false)
Activate SIGSEGV signal handler.
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
static bool & parRun() noexcept
Test if this a parallel run.
const std::string buildArch
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void clear()
Clear the list, i.e. set size to zero.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
string hostName(bool full=false)
Return the system's host name, as per hostname(1)
static SLList< string > notes
General usage notes.
static Istream & input(Istream &is, IntRange< T > &range)
bool checkRootCase() const
Check root path and case path.
static std::string clockTime()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static bool clean(std::string &str)
static bool warnAboutAge(const int version) noexcept
Test if an age warning should be emitted.
fileName cwd()
The physical or logical current working directory path name.
Operations on lists of strings.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Input inter-processor communications stream.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
A list of options to ignore.
dictionary & controlDict()
void printBuildInfo(std::ostream &os, const bool full=true)
Print information about version, build, arch to output stream.
static HashTable< string, label, Hash< label > > argUsage
Short description for program arguments.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
std::ostream & stdStream()
Return std::ostream for output operations.
static void noParallel()
Remove the parallel options.
static void set(bool verbose=false)
Activate SIGQUIT signal handler.
string expand(const std::string &s, const HashTable< string > &mapping, const char sigil='$')
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
static bool bannerEnabled()
Banner status (enabled/disabled).
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
labelList findMatchingStrings(const UnaryMatchPredicate &matcher, const UList< StringType > &input, const bool invert=false)
Extract list indices for all matches.
static void printHostsSubscription(const UList< string > &hostProcs)
static bool isAbsolute(const std::string &str)
virtual ~argList()
Destructor.
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
void displayDoc(bool source=false) const
Display documentation in browser.
static void addVerboseOption(const string &usage, bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static void set(bool verbose=false)
Activate SIGINT signal handler.
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
static int nPollProcInterfaces
Number of polling cycles in processor updates.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
static void exit(int errNo=1)
Shutdown (finalize) MPI as required and exit program with errNo.
static autoPtr< fileOperationInitialise > New(const word &type, int &argc, char **&argv)
Select type.
An adapter for copying a list of C++ strings into a list of C-style strings for passing to C code tha...