38 setEnv(
"FOAM_APPLICATION", application,
false);
46 if (controlDict_.
found(
"writeControl"))
50 controlDict_.
lookup(
"writeControl")
54 const scalar newWriteInterval =
57 {
"writeInterval",
"writeFrequency"},
64 &&
label(newWriteInterval) < 1
68 <<
"writeInterval < 1 for writeControl timeStep"
80 <<
", should be >= 0, setting to 0"
87 if (controlDict_.
found(
"timeFormat"))
89 const word formatName(controlDict_.
lookup(
"timeFormat"));
91 if (formatName ==
"general")
95 else if (formatName ==
"fixed")
99 else if (formatName ==
"scientific")
106 <<
"unsupported time format " << formatName
116 if (controlDict_.
found(
"stopAt"))
136 if (controlDict_.
found(
"writeVersion"))
140 controlDict_.
lookup(
"writeVersion")
144 if (controlDict_.
found(
"writeFormat"))
148 controlDict_.
lookup(
"writeFormat")
152 if (controlDict_.
found(
"writePrecision"))
156 controlDict_.
lookup<
unsigned int>(
"writePrecision")
172 if (controlDict_.
found(
"writeCompression"))
176 controlDict_.
lookup(
"writeCompression")
186 <<
"Selecting compressed binary is inefficient and ineffective"
187 ", resetting to uncompressed binary"
194 controlDict_.
readIfPresent(
"runTimeModifiable", runTimeModifiable_);
202 if (runTimeModifiable_)
240 timeDict.
add(
"beginTime", timeToUserTime(beginTime_));
241 timeDict.
add(
"value",
timeName(timeToUserTime(value()), maxPrecision_));
242 timeDict.
add(
"name",
string(tmName));
243 timeDict.
add(
"index", timeIndex_);
244 timeDict.
add(
"deltaT", timeToUserTime(deltaT_));
245 timeDict.
add(
"deltaT0", timeToUserTime(deltaT0_));
247 return timeDict.regIOobject::writeObject
267 bool writeOK = writeTimeDict();
277 if (writeTime_ && purgeWrite_)
281 previousWriteTimes_.size() == 0
282 || previousWriteTimes_.top() !=
name()
285 previousWriteTimes_.push(
name());
288 while (previousWriteTimes_.size() > purgeWrite_)
319 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)
const unitConversion & userUnits() const
Return the user-time unit conversion.
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.
static const NamedEnum< stopAtControl, 4 > stopAtControlNames
bool writeNow()
Write the objects now (not at end of iteration) and continue.
const unitConversion & writeIntervalUnits() const
Return the write interval units.
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).
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_
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
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.
static const NamedEnum< writeControl, 5 > writeControlNames
void readModifiedObjects()
Read the objects that have been modified.
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.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
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.
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.
word name(const bool)
Return a word representation of a bool.
prefixOSstream Pout(cout, "Pout")
OSstream Serr(cerr, "Serr")
prefixOSstream Sout(cout, "Sout")