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),
167 if (
dict.readIfPresent(
"file", file_))
170 if (!file_.empty() && !file_.isAbsolute())
172 file_ = time_.globalPath()/file_;
180 file_ = time_.globalPath()/
name();
190 Time::stopAtControls::saNextWrite
195 <<
" File: " << file_ <<
endl;
206 auto action = Time::stopAtControls::saUnknown;
212 if (Time::stopAtControls::saUnknown == action)
217 action = defaultAction_;
222 int intAction(action);
228 triggered_ = time_.stopAt(action);
232 Info<<
"USER REQUESTED ABORT (timeIndex=" 233 << time_.timeIndex() <<
"): " static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
defineTypeNameAndDebug(ObukhovLength, 0)
Inter-processor communication reduction functions.
virtual bool read(const dictionary &dict)
Read the dictionary settings.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
adjust endTime to stop immediately w/ writing
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool end()
Remove the trigger file after the final time-loop.
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool warnOnly=false) const
Find the key in the dictionary and return the corresponding enumeration element based on its name...
Macros for easy insertion into run-time selection tables.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
virtual bool execute()
Check existence of the file and take action.
A class for handling words, derived from Foam::string.
static std::string longDescription(const Time::stopAtControls ctrl)
errorManip< error > abort(error &err)
static enum Time::stopAtControls getStopAction(const std::string &filename)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Adjust endTime to stop immediately w/o writing.
Stop when Time reaches prescribed endTime.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
messageStream Info
Information stream (stdout output on master, null elsewhere)
stop at the next data write interval
stopAtControls
Stop-run control options, which are primarily used when altering the stopAt condition.
virtual bool write()
No-op.
Virtual base class for function objects with a reference to Time.
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.