38 setEnv(
"FOAM_APPLICATION", application,
false);
46 if (controlDict_.
found(
"writeControl"))
50 controlDict_.
lookup(
"writeControl")
56 if (controlDict_.
readIfPresent(
"writeInterval", newWriteInterval))
70 &&
label(newWriteInterval) < 1
74 <<
"writeInterval < 1 for writeControl timeStep"
80 controlDict_.
lookup(
"writeFrequency") >> newWriteInterval;
91 <<
", should be >= 0, setting to 0"
98 if (controlDict_.
found(
"timeFormat"))
100 const word formatName(controlDict_.
lookup(
"timeFormat"));
102 if (formatName ==
"general")
106 else if (formatName ==
"fixed")
110 else if (formatName ==
"scientific")
117 <<
"unsupported time format " << formatName
127 if (controlDict_.
found(
"stopAt"))
147 if (controlDict_.
found(
"writeVersion"))
151 controlDict_.
lookup(
"writeVersion")
155 if (controlDict_.
found(
"writeFormat"))
159 controlDict_.
lookup(
"writeFormat")
163 if (controlDict_.
found(
"writePrecision"))
167 controlDict_.
lookup<
unsigned int>(
"writePrecision")
183 if (controlDict_.
found(
"writeCompression"))
187 controlDict_.
lookup(
"writeCompression")
197 <<
"Selecting compressed binary is inefficient and ineffective"
198 ", resetting to uncompressed binary"
205 controlDict_.
readIfPresent(
"runTimeModifiable", runTimeModifiable_);
213 if (controlDict_.regIOobject::read())
228 if (runTimeModifiable_)
246 if (controlDict_.readIfModified())
249 functionObjects_.read();
254 if (registryModified)
280 timeDict.
add(
"beginTime", timeToUserTime(beginTime_));
281 timeDict.
add(
"value",
timeName(timeToUserTime(value()), maxPrecision_));
282 timeDict.
add(
"name",
string(tmName));
283 timeDict.
add(
"index", timeIndex_);
284 timeDict.
add(
"deltaT", timeToUserTime(deltaT_));
285 timeDict.
add(
"deltaT0", timeToUserTime(deltaT0_));
287 return timeDict.regIOobject::writeObject
307 bool writeOK = writeTimeDict();
317 if (writeTime_ && purgeWrite_)
321 previousWriteTimes_.size() == 0
322 || previousWriteTimes_.top() !=
name()
325 previousWriteTimes_.push(
name());
328 while (previousWriteTimes_.size() > purgeWrite_)
359 stopAt_ = stopAtControl::writeNow;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static fileCheckTypes fileModificationChecking
Type of file modification checking.
static const versionNumber currentVersion
Current version number.
streamFormat
Enumeration for the format of data in the stream.
static unsigned int defaultPrecision()
Return the default precision.
static streamFormat formatEnum(const word &)
Return stream format of given format name.
compressionType
Enumeration for the format of data in the stream.
static compressionType compressionEnum(const word &)
Return compression of given compression name.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
virtual int precision() const
Get precision of output field.
virtual void readDict()
Read the control dictionary and set the write controls etc.
static int precision_
Time directory name precision.
scalar timeToUserTime(const scalar t) const
Convert the real-time (s) into user-time (e.g. CA deg)
static const NamedEnum< stopAtControl, 4 > stopAtControlNames_
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
const word & timeName() const
Return current time name (for backwards-compatibility)
bool writeNow()
Write the objects now (not at end of iteration) and continue.
static int curPrecision_
Current time directory name precision adjusted as necessary.
scalar userTimeToTime(const scalar tau) const
Convert the user-time (e.g. CA deg) to real-time (s).
static const NamedEnum< writeControl, 5 > writeControlNames_
void writeOnce()
Write the objects once (one shot) and continue the run.
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType, const bool write) const
Write using given format, version and compression.
virtual void setWriteInterval(const scalar writeInterval)
Reset the write interval.
writeControl writeControl_
autoPtr< userTimes::userTime > userTime_
Optional user-time, defaults to realTime in s.
@ endTime
stop when Time reaches the prescribed endTime
static format format_
Time directory name format.
void readModifiedObjects()
Read the objects that have been modified.
virtual bool read()
Read control dictionary, update controls and time.
static bool & parRun()
Is this a parallel run?
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const scalar & value() const
Return const reference to value.
const word & name() const
Return const reference to name.
virtual bool rmDir(const fileName &) const =0
Remove a directory and its contents.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool write) const
Write the objects.
virtual bool modified() const
Return true if any of the object's files have been modified.
fileName path() const
Return complete path.
void readModifiedObjects()
Read the objects that have been modified.
timeIOdictionary derived from IOdictionary with globalFile set false to enable writing to processor t...
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
#define WarningInFunction
Report a warning using Foam::Warning.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
prefixOSstream Perr(cerr, "Perr")
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout(cout, "Pout")
OSstream Serr(cerr, "Serr")
prefixOSstream Sout(cout, "Sout")
word name(const complex &)
Return a string representation of a complex.