55 bool Foam::argList::argsMandatory_ =
true;
56 bool Foam::argList::checkProcessorDirectories_ =
true;
73 Foam::argList::initValidTables::initValidTables()
79 "Case directory (instead of current directory)" 85 "Additional library or library list to load.\n" 86 "[Can be used multiple times]",
89 argList::addBoolOption
92 "Disable use of the controlDict 'libs' entry",
100 "Set named DebugSwitch (default value: 1).\n" 101 "[Can be used multiple times]",
109 "Set named InfoSwitch (default value: 1).\n" 110 "[Can be used multiple times]",
118 "Set named OptimisationSwitch (default value: 1).\n" 119 "[Can be used multiple times]",
123 argList::addBoolOption(
"parallel",
"Run in parallel");
124 validParOptions.set(
"parallel",
"");
129 "Subprocess root directories for distributed running",
142 "Alternative decomposePar dictionary file" 147 "((host1 dir1) .. (hostN dirN))",
148 "Per-subprocess root directories for distributed running." 149 " The host specification can be a regex.",
155 "((host1 dir1) .. (hostN dirN))" 158 argList::addBoolOption
161 "Do not execute function objects",
169 "Override the file handler type",
177 "Name of the local world for parallel communication",
193 Pstream::addValidParOptions(validParOptions);
212 Info<<
"Hosts :\n(" <<
nl;
217 for (
const auto& str : hostProcs)
219 std::string curr(str.substr(0, str.rfind(
'.')));
226 Info<<
" (" << prev.c_str() <<
' ' <<
count <<
')' <<
nl;
230 prev = std::move(curr);
238 Info<<
" (" << prev.c_str() <<
' ' <<
count <<
')' <<
nl;
247 const UList<string>& hostProcs,
248 const UList<fileName>& roots
251 if (hostProcs.size() == roots.size()+1)
254 DynamicList<string> sortedProcs;
255 DynamicList<label> sortedRoots;
259 const fileName& root = roots[i];
260 const string& host = hostProcs[i+1];
261 const label index = sortedProcs.find(host);
265 sortedProcs.append(host);
266 sortedRoots.append(i);
268 else if (roots[sortedRoots[index]] != root)
275 Info<<
"Roots :\n(" <<
nl;
278 Info<<
" (" << sortedProcs[i].c_str() <<
' ' 279 << roots[sortedRoots[i]] <<
')' <<
nl;
294 void Foam::argList::checkITstream(
const ITstream& is,
const label index)
296 const label remaining = is.nRemainingTokens();
302 <<
"--> FOAM WARNING:" <<
nl 303 <<
"Argument " << index <<
" has " 304 << remaining <<
" excess tokens" <<
nl <<
nl;
310 <<
"--> FOAM WARNING:" <<
nl 311 <<
"Argument " << index <<
" had no tokens" <<
nl <<
nl;
316 void Foam::argList::checkITstream(
const ITstream& is,
const word& optName)
318 const label remaining = is.nRemainingTokens();
324 <<
"--> FOAM WARNING:" <<
nl 325 <<
"Option -" << optName <<
" has " 326 << remaining <<
" excess tokens" <<
nl <<
nl;
332 <<
"--> FOAM WARNING:" <<
nl 333 <<
"Option -" << optName <<
" had no tokens" <<
nl <<
nl;
338 void Foam::argList::raiseBadInput(
const word& optName)
const 343 <<
"Option -" << optName <<
" with invalid input" <<
nl 350 const string& argName,
354 validArgs.append(argName);
358 const label index = validArgs.size();
362 argUsage.erase(index);
366 argUsage.set(index, usage);
390 validOptions.set(optName, param);
393 optionUsage.set(optName, usage);
397 advancedOptions.set(optName);
404 if (advanced && validOptions.found(optName))
406 advancedOptions.set(optName);
410 advancedOptions.erase(optName);
418 std::pair<const char*,int> compat
421 validOptionsCompat.insert
424 std::pair<word,int>(optName, compat.second)
431 std::pair<const char*,int> compat,
435 ignoreOptionsCompat.insert
438 std::pair<bool,int>(expectArg, compat.second)
451 optionUsage.erase(optName);
455 optionUsage.set(optName, usage);
471 validOptions.erase(optName);
472 optionUsage.erase(optName);
473 advancedOptions.erase(optName);
479 argsMandatory_ =
false;
485 return argsMandatory_;
523 removeOption(
"noFunctionObjects");
527 ignoreOptionCompat({
"noFunctionObjects", 0},
false);
533 "withFunctionObjects",
534 "Execute functionObjects" 552 "Disable use of the controlDict libs entry",
560 removeOption(
"parallel");
561 removeOption(
"roots");
562 removeOption(
"decomposeParDict");
563 removeOption(
"hostRoots");
564 removeOption(
"world");
565 validParOptions.clear();
571 checkProcessorDirectories_ =
false;
577 for (
int i=1; i<argc; ++i)
579 if (argv[i] ==
'-' + postProcessOptionName)
609 if (
input.isAbsolute())
611 return input.relative(envGlobalPath(), caseTag);
620 Foam::word Foam::argList::optionCompat(
const word& optName)
625 if (!validOptionsCompat.empty())
627 const auto fnd = validOptionsCompat.cfind(optName.substr(1));
631 const auto& alt = fnd.val();
637 <<
"--> FOAM IOWarning :" <<
nl 638 <<
" Found [v" << alt.second <<
"] '" 639 << optName <<
"' instead of '-" 640 << alt.first <<
"' option" 647 return "-" + alt.first;
656 int Foam::argList::optionIgnore(
const word& optName)
660 if (!ignoreOptionsCompat.empty())
662 const auto fnd = ignoreOptionsCompat.cfind(optName);
666 const auto& alt = fnd.val();
670 const int nskip = (alt.first ? 2 : 1);
676 <<
"--> FOAM IOWarning :" <<
nl 677 <<
" Ignoring [v" << alt.second <<
"] '-" 678 << optName << (nskip > 1 ?
" ARG" :
"")
694 bool Foam::argList::regroupArgv(
int& argc,
char**& argv)
704 args_[0] = fileName(argv[0]);
705 for (
int argi = 1; argi < argc; ++argi)
707 if (strcmp(argv[argi],
"(") == 0)
712 else if (strcmp(argv[argi],
")") == 0)
720 args_[nArgs++] =
group;
726 args_[nArgs++] = argv[argi];
736 else if (argv[argi][0] ==
'-')
739 const char *optName = &argv[argi][1];
741 if (validOptions.found(optName))
744 args_[nArgs++] = argv[argi];
746 else if ((ignore = optionIgnore(optName)) > 0)
757 args_[nArgs++] = optionCompat(argv[argi]);
762 args_[nArgs++] = argv[argi];
769 args_[nArgs++] =
group;
775 for (
const auto&
s : args_)
781 commandLine_.reserve(len);
787 void Foam::argList::setCasePaths()
791 const auto optIter = options_.cfind(
"case");
797 if (caseDir.empty() || caseDir ==
".")
801 options_.erase(
"case");
806 caseDir.toAbsolute();
817 rootPath_ = caseDir.path();
818 globalCase_ = caseDir.name();
825 setEnv(
"FOAM_CASE", caseDir,
true);
826 setEnv(
"FOAM_CASENAME", globalCase_,
true);
829 setEnv(
"FOAM_EXECUTABLE", executable_,
false);
850 for (
int argi = argc-2; argi > 0; --argi)
852 if (argv[argi][0] ==
'-')
854 const char *optName = &argv[argi][1];
856 if (strcmp(optName,
"fileHandler") == 0)
858 handlerType = argv[argi+1];
863 if (handlerType.empty())
866 if (handlerType.empty())
878 )().needsThreading();
883 for (
int argi = 1; argi < argc; ++argi)
885 if (argv[argi][0] ==
'-')
887 const char *optName = &argv[argi][1];
891 runControl_.
runPar(argc, argv, needsThread);
898 regroupArgv(argc, argv);
899 commandLine_ += args_[0];
902 executable_ = fileName(args_[0]).name();
905 int numDryRun = 0, numVerbose = 0;
909 for (
int argi = 1; argi < args_.size(); ++argi)
912 commandLine_ += args_[argi];
914 if (args_[argi][0] ==
'-')
916 const char *optName = &args_[argi][1];
921 <<
"Ignoring lone '-' on the command-line" <<
endl;
939 wantArg = !optIter.val().empty();
949 if (argi >= args_.size())
954 <<
"Error: option '-" << optName
955 <<
"' requires an argument" <<
nl <<
nl 956 <<
"See '" << executable_ <<
" -help' for usage" <<
nl 957 <<
" or '" << executable_
958 <<
" -help-full' for extended usage" <<
nl 965 commandLine_ += args_[argi];
971 if (strcmp(optName,
"lib") == 0)
977 else if (strcmp(optName,
"debug-switch") == 0)
985 else if (strcmp(optName,
"info-switch") == 0)
993 else if (strcmp(optName,
"opt-switch") == 0)
1005 options_.set(optName, args_[argi]);
1013 options_.insert(optName,
"");
1018 if (strcmp(optName,
"dry-run") == 0)
1022 else if (strcmp(optName,
"verbose") == 0)
1033 args_[nArgs] = args_[argi];
1040 runControl_.
dryRun(numDryRun);
1041 runControl_.
verbose(numVerbose);
1043 args_.resize(nArgs);
1045 parse(checkArgs, checkOpts, initialise);
1058 runControl_(
args.runControl_),
1062 executable_(
args.executable_),
1063 rootPath_(
args.rootPath_),
1064 globalCase_(
args.globalCase_),
1068 parse(checkArgs, checkOpts, initialise);
1086 bool quickExit =
false;
1089 if (options_.found(
"doc"))
1094 else if (options_.found(
"doc-source"))
1101 if (options_.found(
"help-full"))
1106 else if (options_.found(
"help-notes"))
1112 else if (options_.found(
"help"))
1117 else if (options_.found(
"help-man"))
1124 if (options_.found(
"help-compat"))
1137 if (!
check(checkArgs, checkOpts))
1173 <<
"Exec : " << commandLine_.c_str() <<
nl 1174 <<
"Date : " << dateString.c_str() <<
nl 1175 <<
"Time : " << timeString.c_str() <<
nl 1177 <<
"PID : " <<
pid() <<
nl;
1190 const auto space =
build.find(
' ');
1191 if (space != std::string::npos)
1193 build.resize(space);
1205 libs().open(bannerEnabled());
1219 options_.lookup(
"fileHandler",
Foam::getEnv(
"FOAM_FILEHANDLER"))
1222 if (handlerType.empty())
1237 if (runControl_.parRun())
1250 fromSubproc >> procBuild >> hostMachine[proci] >> procPid;
1252 hostProcs[proci] = hostMachine[proci] +
"." +
name(procPid);
1260 <<
" but proc " << subproci <<
" is running " 1285 if (runControl_.parRun())
1298 bool adjustOpt =
false;
1302 source /=
"decomposeParDict";
1307 if (!source.isAbsolute() && !source.starts_with(
'.'))
1309 source = rootPath_/globalCase_/source;
1317 options_.set(
"decomposeParDict", source);
1322 label dictNProcs = -1;
1323 if (this->readListIfPresent(
"roots", roots))
1326 runControl_.distributed(
true);
1331 <<
"The -roots option must contain values" 1334 if (roots.size() > 1)
1336 dictNProcs = roots.size()+1;
1339 else if (options_.found(
"hostRoots"))
1341 source =
"-hostRoots";
1342 runControl_.distributed(
true);
1344 ITstream is(this->lookup(
"hostRoots"));
1346 List<Tuple2<wordRe, fileName>> hostRoots(is);
1347 checkITstream(is,
"hostRoots");
1349 if (hostRoots.empty())
1352 <<
"The -hostRoots option must contain values" 1358 for (
const auto& hostRoot : hostRoots)
1364 for (
const label matchi : matched)
1366 if (!roots[matchi].empty())
1369 <<
"Multiple matching roots for " 1370 << hostMachine[matchi] <<
" in " 1375 roots[matchi] = hostRoot.second();
1382 if (roots[hosti].empty())
1385 <<
"No matching roots for " 1386 << hostMachine[hosti] <<
" in " 1392 if (roots.size() > 1)
1394 dictNProcs = roots.size()+1;
1401 const bool useDefault = source.empty();
1404 source = rootPath_/globalCase_/
"system"/
"decomposeParDict";
1414 autoPtr<ISstream> dictStream
1419 if (dictStream && dictStream->good())
1427 dictionary decompDict(*dictStream);
1429 if (decompDict.getOrDefault(
"distributed",
false))
1432 runControl_.distributed(
true);
1433 decompDict.readEntry(
"roots", roots);
1438 <<
"WARNING: running distributed" 1439 <<
" but did not specify roots!" <<
nl;
1443 decompDict.readEntry
1445 "numberOfSubdomains",
1457 <<
"WARNING: running without decomposeParDict " 1458 << this->relativePath(source) <<
nl;
1464 <<
"Cannot read decomposeParDict: " 1465 << this->relativePath(source) <<
nl 1475 <<
"Running parallel on single processor. This only" 1476 <<
" makes sense for multi-world simulation" <<
endl;
1483 if (roots.size() == 1)
1485 const fileName rootName(roots[0]);
1489 if (dictNProcs <= 0)
1491 dictNProcs = roots.size()+1;
1507 checkProcessorDirectories_
1513 << this->relativePath(source)
1514 <<
" specifies " << dictNProcs
1515 <<
" processors but job was started with " 1526 <<
"number of entries in roots " 1528 <<
" is not equal to the number of sub-processes " 1533 for (fileName& dir : roots)
1539 const bool hadCaseOpt = options_.found(
"case");
1542 options_.set(
"case", roots[subproci-1]/globalCase_);
1547 << args_ << options_
1548 << runControl_.distributed()
1549 << label(runControl_.dryRun())
1550 << label(runControl_.verbose());
1552 options_.erase(
"case");
1557 options_.set(
"case", rootPath_/globalCase_);
1566 checkProcessorDirectories_
1572 label nProcDirs = 0;
1577 rootPath_/globalCase_
1586 <<
"number of processor directories = " 1588 <<
" is not equal to the number of processors = " 1600 << args_ << options_
1601 << runControl_.distributed()
1602 << label(runControl_.dryRun())
1603 << label(runControl_.verbose());
1611 label numDryRun, numVerbose;
1620 >> args_ >> options_
1622 >> numDryRun >> numVerbose;
1624 runControl_.distributed(isDistributed);
1625 runControl_.dryRun(numDryRun);
1626 runControl_.verbose(numVerbose);
1639 case_ = globalCase_;
1646 case_ = globalCase_;
1650 if (runControl_.distributed())
1661 if (!writeHostsSwitch)
1666 if (!writeRootsSwitch)
1674 Info<<
"Case : " << (rootPath_/globalCase_).c_str() <<
nl 1675 <<
"nProcs : " << nProcs <<
nl;
1677 if (runControl_.parRun())
1679 if (hostProcs.size())
1681 if (writeHostsSwitch == 1)
1686 else if (writeHostsSwitch)
1689 Info<<
"Hosts :\n(" <<
nl;
1696 for (
const auto& str : hostProcs)
1698 Info<<
" " << str.c_str() <<
nl;
1705 bool hasPrinted =
false;
1706 if (writeRootsSwitch == 1)
1711 if (writeRootsSwitch && !hasPrinted)
1714 Info<<
"Roots : " << roots <<
nl;
1717 Info<<
"Pstream initialized with:" <<
nl 1739 if (hostProcs.size())
1758 Info<<
"fileModificationChecking : " 1759 <<
"Monitoring run-time modified files using " 1772 Info<<
" (fileModificationSkew " 1778 Info<<
" (fileModificationSkew " 1780 <<
", maxFileModificationPolls " 1787 <<
"Invalid setting for maxFileModificationPolls " 1794 Info<<
"allowSystemOperations : ";
1801 Info<<
"Disallowing";
1803 Info<<
" user-supplied system call operations" <<
nl 1826 if (validOptions.found(
"withFunctionObjects"))
1829 return options_.found(
"withFunctionObjects");
1831 else if (validOptions.found(
"noFunctionObjects"))
1834 return !options_.found(
"noFunctionObjects");
1844 return !options_.found(
"no-libs");
1853 for (
const word& optName : optionNames)
1855 if (options_.found(optName))
1866 std::initializer_list<word> optionNames
1870 for (
const word& optName : optionNames)
1872 if (options_.found(optName))
1887 || optName ==
"parallel" 1888 || optName ==
"roots" 1892 <<
"Option: '" << optName <<
"' is protected" <<
nl 1897 if (options_.found(optName) ? (options_[optName] != param) :
true)
1899 options_.set(optName, param);
1913 || optName ==
"parallel" 1914 || optName ==
"roots" 1915 || optName ==
"hostRoots" 1919 <<
"Option: '" << optName <<
"' is protected" <<
nl 1925 return options_.erase(optName);
1933 fileName docExt(docDict.get<fileName>(
"doxySourceFileExt"));
1938 docExt.replace(
".",
"_source.");
1943 for (
const fileName& dir : docDirs)
1946 if (dir.starts_with(
"http:") || dir.starts_with(
"https:"))
1948 url = dir/executable_ + docExt;
1956 docFile.starts_with(
"file://")
1957 ?
isFile(docFile.substr(7))
1961 url = std::move(docFile);
1969 <<
"No documentation found for " << executable_
1970 <<
", but you can use -help to display the usage\n" <<
endl;
1975 string docBrowser =
getEnv(
"FOAM_DOC_BROWSER");
1976 if (docBrowser.empty())
1978 docDict.readEntry(
"docBrowser", docBrowser);
1982 if (docBrowser.contains(
"%f"))
1984 docBrowser.replace(
"%f", url);
1988 docBrowser +=
" " + url;
1997 <<
" " << command <<
nl <<
endl;
2009 const label nargs = args_.size()-1;
2010 if (checkArgs && nargs != validArgs.size())
2013 <<
"Expected " << validArgs.size()
2014 <<
" arguments but found " << nargs <<
endl;
2022 const word& optName = iter.key();
2025 !validOptions.found(optName)
2026 && !validParOptions.found(optName)
2030 <<
"Invalid option: -" << optName <<
endl;
2040 <<
"See '" << executable_ <<
" -help' for usage" <<
nl 2041 <<
" or '" << executable_
2042 <<
" -help-full' for extended usage" <<
nl 2057 <<
": cannot open root directory " << rootPath()
2065 if (checkProcessorDirectories_ && pathDir.empty() &&
Pstream::master())
2071 <<
": cannot open case directory " <<
path()
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
static bool floatTransfer
Should compact transfer be used in which floats replace doubles reducing the bandwidth requirement at...
static const word & myWorld()
My world.
bool checkRootCase() const
Check root path and case path.
void printBuildInfo(std::ostream &os, const bool full=true)
Print information about version, build, arch to output stream.
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.
void setNamedValue(std::string name, int val, bool report=false)
Set named value, but also handle embedded 'name=value' syntax.
A class for handling file names.
static const Enum< commsTypes > commsTypeNames
Enumerated names for the communication types.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
labelList findMatchingStrings(const UnaryMatchPredicate &matcher, const UList< StringType > &input, const bool invert=false)
Extract list indices for all matches.
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)
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool unsetOption(const word &optName)
Unset option directly (use with caution)
static float fileModificationSkew
Time skew (seconds) for file modification checks.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void set(bool verbose=false)
Activate SIGSEGV signal handler.
int verbose() const noexcept
Non-zero if set as 'verbose'.
Template class for non-intrusive linked lists.
int infoDetailLevel
Global for selective suppression of Info output.
pid_t ppid()
Return the parent PID of this process.
constexpr char nl
The newline '\n' character (0x0a)
static const fileName null
An empty fileName.
static int nProcsSimpleSum
Number of processors to change from linear to tree communication.
std::ostream & stdStream()
Return std::ostream for output operations.
static SLList< string > notes
General usage notes.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
static bool & parRun() noexcept
Test if this a parallel run.
Foam::argList::initValidTables dummyInitValidTables
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
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.
autoPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler.
static bool printRootsSubscription(const UList< string > &hostProcs, const UList< fileName > &roots)
bool patched()
Test if the patch string appears to be in use, which is when it is defined (non-zero).
static HashTable< std::pair< word, int > > validOptionsCompat
A list of aliases for options.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
static bool postProcess(int argc, char *argv[])
Return true if the post-processing option is specified.
Operations on lists of strings.
static void set(bool verbose=false)
Activate SIGINT signal handler.
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
string getEnv(const std::string &envName)
Get environment value for given envName.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
static HashTable< string, label, Hash< label > > argUsage
Short description for program arguments.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
static std::string date()
The current wall-clock date as a string formatted as (MON dd yyyy), where MON is Jan, Feb, etc.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
virtual ~argList()
Destructor.
bool allowFunctionObjects() const
The controlDict 'functions' entry is allowed to be used.
static bool warnAboutAge(const int version) noexcept
Test if an age warning should be emitted.
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
static void printHostsSubscription(const UList< string > &hostProcs)
static void set(bool verbose=false)
Activate SIGFPE signal handler when FOAM_SIGFPE is set.
#define forAll(list, i)
Loop across all elements in list.
static void disable() noexcept
Disallow JobInfo by forcing writeJobInfo (InfoSwitch) off.
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...
constexpr const char *const group
Group name for atomic constants.
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
static autoPtr< fileOperationInitialise > New(const word &type, int &argc, char **&argv)
Select type.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
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.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator) is 1 for serial run.
static int nPollProcInterfaces
Number of polling cycles in processor updates.
static void exit(int errNo=1)
Shutdown (finalize) MPI as required and exit program with errNo.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static HashTable< string > validParOptions
A list of valid parallel options.
"scheduled" : (MPI_Send, MPI_Recv)
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.
Extract command arguments and options from the supplied argc and argv parameters. ...
static Istream & input(Istream &is, IntRange< T > &range)
static constexpr int masterNo() noexcept
Process index of the master (always 0)
static int allowSystemOperations
Flag if system operations are allowed.
void write() const
Write job info to its file in the "running" jobs directory.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
static void addVerboseOption(const string &usage, bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
string userName()
Return the user's login name.
static std::string::size_type usageMax
Max screen width when displaying usage (default: 80)
static std::string clockTime()
The current wall-clock (in local time) as a string formatted as as (hh:mm:ss).
propsDict readIfPresent("fields", acceptFields)
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
static HashTable< string > optionUsage
Short description for validOptions.
static void noLibs()
Add the '-no-libs' command line option.
graph_traits< Graph >::vertices_size_type size_type
static void noCheckProcessorDirectories()
Remove 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...
string hostName()
Return the system's host name, as per hostname(1)
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation...
pid_t pid()
Return the PID of this process.
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
A list of options to ignore.
static HashSet< string > advancedOptions
The "advanced" options are shown with -help-full (not with –help)
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
bool append(const fileName &libName)
Add to the list of names, but do not yet open.
static void check(const int retVal, const char *what)
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...
static autoPtr< fileOperation > fileHandlerPtr_
Static fileOperation.
static autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type. Uses defaultFileHandler if the handlerType is empty.
pid_t pgid()
Return the group PID of this process.
static void set(bool verbose=false)
Activate SIGQUIT signal handler.
Foam::SubStrings< StringType > splitSpace(const StringType &str)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text...
static word envExecutable()
Name of the executable from environment variable.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
List< string > stringList
A List of strings.
const std::string buildArch
OpenFOAM build architecture information (machine endian, label/scalar sizes) as a std::string...
static commsTypes defaultCommsType
Default commsType.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
void stop()
Job end with "normal" termination.
static fileName envGlobalPath()
Global case (directory) from environment variable.
static word defaultFileHandler
Name of the default fileHandler.
static bool argsMandatory()
Command arguments type (optional/mandatory).
bool setOption(const word &optName, const string ¶m="")
Set option directly (use with caution)
static fileName validate(const std::string &, const bool doClean=true)
Construct fileName without invalid characters, possibly applying other transformations such as changi...
static bool master(const label communicator=worldComm)
Am I the master rank.
int dryRun() const noexcept
Non-zero if set as 'dry-run'.
const std::string patch
OpenFOAM patch number as a std::string.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
fileName cwd()
The physical or logical current working directory path name.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void noBanner()
Disable emitting the banner information.
void runPar(int &argc, char **&argv, bool needsThread)
Initialize Pstream for a parallel run.
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
List< label > labelList
A List of labels.
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
const std::string build
OpenFOAM build information as a std::string.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
static void addUsage(const word &optName, const string &usage)
Add option usage information to optionUsage.
static const wordList & allWorlds() noexcept
All worlds.
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))
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.
Foam::argList args(argc, argv)
dictionary & controlDict()
The central control dictionary, the contents of which are either taken directly from the FOAM_CONTROL...
List< fileName > fileNameList
A List of fileNames.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
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.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
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.
forAllConstIters(mixture.phases(), phase)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
string expand(const std::string &s, const HashTable< string > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping and return the expanded string.
readOption
Enumeration defining read preferences.