Go to the documentation of this file.
46 static std::ostream&
printTimeHMS(std::ostream& os,
double seconds)
48 const unsigned long ss = seconds;
51 const auto dd = (ss / 86400);
53 if (dd) os << dd <<
'-';
56 const int hh = ((ss / 3600) % 24);
66 << ((ss / 60) % 60) <<
':';
74 const int hundredths = int(100 * (seconds - ss)) % 100;
95 setEnv(
"FOAM_APPLICATION", application,
false);
105 (localDict = controlDict_.
findDict(
"DebugSwitches")) !=
nullptr
110 <<
"Overriding DebugSwitches according to "
111 << controlDict_.
name() <<
nl;
120 (localDict = controlDict_.
findDict(
"InfoSwitches")) !=
nullptr
125 <<
"Overriding InfoSwitches according to "
126 << controlDict_.
name() <<
nl;
134 (localDict = controlDict_.
findDict(
"OptimisationSwitches")) !=
nullptr
139 <<
"Overriding OptimisationSwitches according to "
140 << controlDict_.
name() <<
nl;
148 word fileHandlerName;
156 DetailInfo <<
"Overriding fileHandler to " << fileHandlerName <<
nl;
183 (localDict = controlDict_.
findDict(
"DimensionedConstants")) !=
nullptr
188 <<
"Overriding DimensionedConstants according to "
189 << controlDict_.
name() <<
nl;
204 obj->readData(dummyIs);
209 obj->writeData(
Info);
220 (localDict = controlDict_.
findDict(
"DimensionSets")) !=
nullptr
225 <<
"Overriding DimensionSets according to "
226 << controlDict_.
name() <<
nl;
231 dict.merge(*localDict);
271 <<
"writeInterval < 1 for writeControl timeStep"
308 <<
", should be >= 0, setting to 0"
315 if (controlDict_.
found(
"timeFormat"))
317 const word formatName(controlDict_.
get<
word>(
"timeFormat"));
319 if (formatName ==
"general")
323 else if (formatName ==
"fixed")
327 else if (formatName ==
"scientific")
334 <<
"unsupported time format " << formatName
361 if (controlDict_.
found(
"writeVersion"))
367 controlDict_.
get<
float>(
"writeVersion")
372 if (controlDict_.
found(
"writeFormat"))
374 writeStreamOption_.
format(controlDict_.
get<
word>(
"writeFormat"));
377 if (controlDict_.
found(
"writePrecision"))
381 controlDict_.
get<
unsigned int>(
"writePrecision")
397 if (controlDict_.
found(
"writeCompression"))
401 controlDict_.
get<
word>(
"writeCompression")
411 <<
"Disabled binary format compression"
412 <<
" (inefficient/ineffective)"
420 controlDict_.
readIfPresent(
"runTimeModifiable", runTimeModifiable_);
423 if (!runTimeModifiable_ && controlDict_.
watchIndices().size())
436 if (controlDict_.regIOobject::read())
440 functionObjects_.read();
442 if (runTimeModifiable_)
450 controlDict_.files().clear();
461 if (runTimeModifiable_)
478 if (controlDict_.readIfModified())
481 functionObjects_.read();
483 if (runTimeModifiable_)
492 controlDict_.files().clear();
497 if (registryModified)
525 timeDict.
add(
"value",
timeName(timeToUserTime(value()), maxPrecision_));
526 timeDict.
add(
"name",
string(tmName));
527 timeDict.
add(
"index", timeIndex_);
528 timeDict.
add(
"deltaT", timeToUserTime(deltaT_));
529 timeDict.
add(
"deltaT0", timeToUserTime(deltaT0_));
531 return timeDict.regIOobject::writeObject
551 bool writeOK = writeTimeDict();
561 if (writeTime_ && purgeWrite_)
565 previousWriteTimes_.empty()
566 || previousWriteTimes_.top() !=
timeName()
569 previousWriteTimes_.push(
timeName());
572 while (previousWriteTimes_.size() > purgeWrite_)
601 stopAt_ = saWriteNow;
616 switch (printExecutionFormat_)
620 os <<
"ExecutionTime = ";
623 os <<
" ClockTime = ";
630 os <<
"ExecutionTime = " << elapsedCpuTime() <<
" s"
631 <<
" ClockTime = " << elapsedClockTime() <<
" s";
virtual fileName::Type type(const fileName &, const bool followLink=true) const =0
Return the file type: DIRECTORY, FILE or LINK.
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A class for handling words, derived from Foam::string.
void setValues(const dictionary &dict, bool report=false)
Set values (invoke callbacks) from dictionary entries.
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
const labelList & watchIndices() const
Return file-monitoring handles.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
static const Enum< writeControls > writeControlNames
Names for writeControls.
static bool & parRun()
Is this a parallel run?
static fileCheckTypes fileModificationChecking
Type of file modification checking.
streamFormat format() const noexcept
Get the current stream format.
static const versionNumber currentVersion
The current version number.
const word & name() const
Return const reference to name.
const fileOperation & fileHandler()
Get current file handler.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
const scalar & value() const
Return const reference to value.
OSstream Serr
An Ostream wrapper for std::cerr.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
const word & name() const
Name function is needed to disambiguate those inherited.
void writeOnce()
Write the objects once (one shot) and continue the run.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
virtual bool read()
Read control dictionary, update controls and time.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
Stop when Time reaches prescribed endTime.
static autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type.
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
static int precision_
Time directory name precision.
virtual word timeName() const
Return current time name.
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType, const bool valid) const
Write using given format, version and compression.
Representation of a major/minor version number.
messageStream Info
Information stream (uses stdout - output is on the master only)
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
dictionary & dimensionSystems()
Top level dictionary.
virtual std::ostream & stdStream()
Access to underlying std::ostream.
dictionary & dimensionedConstants()
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool valid) const
Write the objects.
virtual bool rmDir(const fileName &dir, const bool silent=false) const =0
Remove a directory and its contents.
simpleObjectRegistry & dimensionSetObjects()
Access to registered DimensionSets objects.
versionNumber version() const noexcept
Get the stream version.
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
streamFormat
Data format (ascii | binary)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
"adjustable" / "adjustableRunTime"
Input from string buffer, using a ISstream.
Omanip< int > setw(const int i)
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
int infoDetailLevel
Global for selective suppression of Info output.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual bool modified() const
Return true if any of the object's files have been modified.
void readModifiedObjects()
Read the objects that have been modified.
const T * lookupPtr(const word &keyword) const
Find and return an entry if present, otherwise return nullptr.
prefixOSstream Perr
An Ostream wrapper for parallel output to std::cerr.
virtual int precision() const
Get precision of output field.
virtual void readDict()
Read the control dictionary and set the write controls etc.
Foam::string str() const
Get the string - as Foam::string rather than std::string.
void readModifiedObjects()
Read the objects that have been modified.
forAllConstIters(mixture.phases(), phase)
static unsigned int defaultPrecision()
Return the default precision.
Output to string buffer, using a OSstream.
Omanip< char > setfill(char fillch)
static fmtflags format_
Time directory name format.
void clear()
Clear the list, i.e. set size to zero.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
#define forAllReverse(list, i)
Reverse loop across all elements in list.
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
OSstream Sout
An Ostream wrapper for std::cout.
compressionType compression() const noexcept
Get the stream compression.
fileName path() const
The complete path.
writeControls writeControl_
#define WarningInFunction
Report a warning using Foam::Warning.
Abstract base class for registered object with I/O. Used in debug symbol registration.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
static std::ostream & printTimeHMS(std::ostream &os, double seconds)
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
Object registry for simpleRegIOobject. Maintains ordering.