Go to the documentation of this file.
42 namespace functionObjects
71 std::string fileContent;
73 std::ifstream is(filename);
74 std::getline(is, fileContent,
'\0');
76 const auto equals = fileContent.find(
'=');
78 if (equals != std::string::npos)
86 Time::stopAtControls::saUnknown
90 return Time::stopAtControls::saUnknown;
101 return "continue simulation to the endTime";
107 return "stop without writing data";
113 return "stop and write data";
119 return "stop after next data write";
126 return "unknown action";
137 Foam::functionObjects::abort::abort
146 defaultAction_(Time::stopAtControls::saUnknown),
152 if (Pstream::master())
167 if (
dict.readIfPresent(
"file", file_))
191 Time::stopAtControls::saNextWrite
196 <<
" File: " << file_ <<
endl;
207 auto action = Time::stopAtControls::saUnknown;
213 if (Time::stopAtControls::saUnknown == action)
218 action = defaultAction_;
223 label intAction(action);
229 triggered_ = time_.stopAt(action);
233 Info<<
"USER REQUESTED ABORT (timeIndex="
234 << time_.timeIndex() <<
"): "
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
stop at the next data write interval
const Time & time_
Reference to the time database.
virtual bool execute()
Check existence of the file and take action.
Virtual base class for function objects with a reference to Time.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
static std::string longDescription(const Time::stopAtControls ctrl)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Stop when Time reaches prescribed endTime.
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
static enum Time::stopAtControls getStopAction(const std::string &filename)
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
Adjust endTime to stop immediately w/o writing.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
Inter-processor communication reduction functions.
static bool master(const label communicator=0)
Am I the master process.
virtual bool end()
Remove the trigger file after the final time-loop.
adjust endTime to stop immediately w/ writing
const word & name() const
Return the name of this functionObject.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual const word & type() const =0
Runtime type information.
string & expand(const bool allowEmpty=false)
defineTypeNameAndDebug(ObukhovLength, 0)
fileName globalPath() const
Return global path for the case.
static bool clean(std::string &str)
Cleanup filename.
virtual bool write()
No-op.
virtual bool read(const dictionary &dict)
Read the dictionary settings.
static bool isAbsolute(const std::string &str)
Return true if string starts with a '/'.