Go to the documentation of this file.
39 #ifndef FOAM_RESOURCE_USER_CONFIG_DIRNAME
40 #define FOAM_RESOURCE_USER_CONFIG_DIRNAME ".OpenFOAM"
42 #warning FOAM_RESOURCE_USER_CONFIG_DIRNAME was undefined (now ".OpenFOAM")
77 add(
"cpuTime", cpuTime_.elapsedCpuTime());
81 if (!
found(
"termination"))
83 add(
"termination", terminationType);
87 write(OFstream(finishedDir_/jobFileName_)());
114 runningDir_ = jobDir/
"runningJobs";
115 finishedDir_ = jobDir/
"finishedJobs";
120 <<
"No JobInfo directory: " << jobDir
123 if (!
isDir(runningDir_) && !
mkDir(runningDir_))
126 <<
"No JobInfo directory: " << runningDir_
129 if (!
isDir(finishedDir_) && !
mkDir(finishedDir_))
132 <<
"No JobInfo directory: " << finishedDir_
155 const fileName output = runningDir_/jobFileName_;
159 <<
"Failed to write to JobInfo file " << output
188 Foam::mv(runningDir_/jobFileName_, finishedDir_/jobFileName_);
void exit()
End with "termination=exit".
static bool writeJobInfo
Global value for writeJobInfo enabled.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Helper class for recording information about run/finished jobs.
A class for handling file names.
void end()
End with "termination=normal".
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
void write() const
Write the job info to its file in the runningJobs directory.
string getEnv(const std::string &envName)
Get environment value for given envName.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
const fileName & name() const
The dictionary name.
word name(const complex &c)
Return string representation of complex.
pid_t pid()
Return the PID of this process.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
static std::string date()
Return the current wall-clock date as a string.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
static bool master(const label communicator=0)
Am I the master process.
#define FOAM_RESOURCE_USER_CONFIG_DIRNAME
fileName home()
Return home directory path name for the current user.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void write(Ostream &os, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
static bool constructed
Global value for constructed job info.
string hostName(const bool full=false)
Return the system's host name, as per hostname(1)
static std::string clockTime()
Return the current wall-clock time as a string.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
void abort()
End with "termination=abort".
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool good() const
Return true if next operation might succeed.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
void signalEnd() const
Update job info and relocate the file from running to finished.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?