42#ifndef FOAM_RESOURCE_USER_CONFIG_DIRNAME
43#define FOAM_RESOURCE_USER_CONFIG_DIRNAME ".OpenFOAM"
45 #warning FOAM_RESOURCE_USER_CONFIG_DIRNAME was undefined (now ".OpenFOAM")
68 <<
"WARNING: no JobInfo directory: " << dir <<
nl
69 <<
" disabling JobInfo" <<
nl;
122void Foam::JobInfo::jobEnding()
124 if (!running_.empty())
138void Foam::JobInfo::jobEnding(
const word& terminationType)
140 if (writeJobInfo && !finished_.empty())
142 add(
"cpuTime", cpuTime_.elapsedCpuTime());
146 if (!terminationType.empty() && !
found(
"termination"))
148 add(
"termination", terminationType);
156 <<
"WARNING: could not write JobInfo file: "
174 <<
"WARNING: JobInfo was already constructed. "
175 "Should be a singleton!!" <<
nl;
187 running_ = jobDir/
"runningJobs"/jobFile;
188 finished_ = jobDir/
"finishedJobs"/jobFile;
219 if (writeJobInfo && !running_.empty())
225 <<
"WARNING: could not write JobInfo file: "
#define FOAM_RESOURCE_USER_CONFIG_DIRNAME
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool good() const noexcept
True if next operation might succeed.
Helper class for recording information about run/finished jobs, acts like global singleton.
static void disable() noexcept
Disallow JobInfo by forcing writeJobInfo (InfoSwitch) off.
void exit()
Job end with "exit" termination.
void write() const
Write job info to its file in the "running" jobs directory.
JobInfo()
Default construct.
~JobInfo()
Destructor, relocates the job file from running to finished.
static void shutdown()
Simple shutdown (finalize) of JobInfo.
static bool constructed
Global value for constructed job info.
static bool writeJobInfo
Global value for writeJobInfo enabled.
void stop()
Job end with "normal" termination.
void abort()
Job end with "abort" termination.
void signalEnd()
Relocate job file from "running" to "finished" directory.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static std::string date()
The current wall-clock date as a string formatted as (MON dd yyyy), where MON is Jan,...
static std::string clockTime()
The current wall-clock (in local time) as a string formatted as as (hh:mm:ss).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const fileName & name() const noexcept
The dictionary name.
void writeEntries(Ostream &os, const bool extraNewLine=false) const
Write dictionary entries.
A class for handling file names.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
string getEnv(const std::string &envName)
Get environment value for given envName.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
string hostName()
Return the system's host name, as per hostname(1).
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
static bool writeJobDict(Ostream &os, const dictionary &dict)
pid_t pid()
Return the PID of this process.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
fileName home()
Return home directory path name for the current user.
static bool ensureJobDirExists(const fileName &dir)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a).