42namespace 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)
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";
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();
195 <<
" File: " << file_ <<
endl;
217 action = defaultAction_;
222 label intAction(action);
228 triggered_ = time_.stopAt(action);
232 Info<<
"USER REQUESTED ABORT (timeIndex="
233 << time_.timeIndex() <<
"): "
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Inter-processor communication reduction functions.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.
static void scatter(const List< commsStruct > &comms, T &value, const int tag, const label comm)
Broadcast data: Distribute without modification.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
@ saNoWriteNow
Adjust endTime to stop immediately w/o writing.
@ saWriteNow
adjust endTime to stop immediately w/ writing
@ saUnknown
Dummy no-op. Do not change current value.
@ saEndTime
Stop when Time reaches prescribed endTime.
@ saNextWrite
stop at the next data write interval
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
Watches for presence of the named trigger file in the case directory and signals a simulation stop (o...
virtual bool read(const dictionary &dict)
Read the dictionary settings.
virtual bool execute()
Check existence of the file and take action.
virtual bool write()
No-op.
virtual bool end()
Remove the trigger file after the final time-loop.
Virtual base class for function objects with a reference to Time.
virtual void validate()
Validate the turbulence fields after construction.
splitCell * master() const
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
static enum Time::stopAtControls getStopAction(const std::string &filename)
messageStream Info
Information stream (stdout output on master, null elsewhere)
static std::string longDescription(const Time::stopAtControls ctrl)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)