Go to the documentation of this file.
49 const unsigned long ss = seconds;
52 const auto dd = (ss / 86400);
54 if (dd)
os << dd <<
'-';
57 const int hh = ((ss / 3600) % 24);
67 << ((ss / 60) % 60) <<
':';
75 const int hundredths = int(100 * (seconds - ss)) % 100;
96 setEnv(
"FOAM_APPLICATION", application,
false);
106 (localDict = controlDict_.
findDict(
"DebugSwitches")) !=
nullptr
111 <<
"Overriding DebugSwitches according to "
112 << controlDict_.
name() <<
nl;
121 (localDict = controlDict_.
findDict(
"InfoSwitches")) !=
nullptr
126 <<
"Overriding InfoSwitches according to "
127 << controlDict_.
name() <<
nl;
135 (localDict = controlDict_.
findDict(
"OptimisationSwitches")) !=
nullptr
140 <<
"Overriding OptimisationSwitches according to "
141 << controlDict_.
name() <<
nl;
149 word fileHandlerName;
157 DetailInfo <<
"Overriding fileHandler to " << fileHandlerName <<
nl;
175 newHandler->distributed(
true);
192 (localDict = controlDict_.
findDict(
"DimensionedConstants")) !=
nullptr
197 <<
"Overriding DimensionedConstants according to "
198 << controlDict_.
name() <<
nl;
213 obj->readData(dummyIs);
218 obj->writeData(
Info);
229 (localDict = controlDict_.
findDict(
"DimensionSets")) !=
nullptr
234 <<
"Overriding DimensionSets according to "
235 << controlDict_.
name() <<
nl;
240 dict.merge(*localDict);
280 <<
"writeInterval < 1 for writeControl timeStep"
317 <<
", should be >= 0, setting to 0"
324 if (controlDict_.
found(
"timeFormat"))
326 const word formatName(controlDict_.
get<
word>(
"timeFormat"));
328 if (formatName ==
"general")
332 else if (formatName ==
"fixed")
336 else if (formatName ==
"scientific")
343 <<
"unsupported time format " << formatName
370 if (controlDict_.
found(
"writeVersion"))
375 if (controlDict_.
found(
"writeFormat"))
377 writeStreamOption_.
format(controlDict_.
get<
word>(
"writeFormat"));
380 if (controlDict_.
found(
"writePrecision"))
384 controlDict_.
get<
unsigned int>(
"writePrecision")
397 if (controlDict_.
found(
"writeCompression"))
401 controlDict_.
get<
word>(
"writeCompression")
409 <<
"Disabled binary format compression"
410 <<
" (inefficient/ineffective)"
418 <<
"Disabled output compression"
419 <<
" (missing libz support)"
428 controlDict_.
readIfPresent(
"runTimeModifiable", runTimeModifiable_);
431 if (!runTimeModifiable_ && controlDict_.
watchIndices().size())
444 if (controlDict_.regIOobject::read())
448 functionObjects_.read();
450 if (runTimeModifiable_)
458 controlDict_.files().clear();
469 if (runTimeModifiable_)
486 if (controlDict_.readIfModified())
489 functionObjects_.read();
491 if (runTimeModifiable_)
500 controlDict_.files().clear();
505 if (registryModified)
533 timeDict.
add(
"value",
timeName(timeToUserTime(value()), maxPrecision_));
534 timeDict.
add(
"name",
string(tmName));
535 timeDict.
add(
"index", timeIndex_);
536 timeDict.
add(
"deltaT", timeToUserTime(deltaT_));
537 timeDict.
add(
"deltaT0", timeToUserTime(deltaT0_));
539 return timeDict.regIOobject::writeObject
555 bool writeOK = writeTimeDict();
565 if (writeTime_ && purgeWrite_)
569 previousWriteTimes_.empty()
570 || previousWriteTimes_.top() !=
timeName()
573 previousWriteTimes_.push(
timeName());
576 while (previousWriteTimes_.size() > purgeWrite_)
605 stopAt_ = saWriteNow;
620 switch (printExecutionFormat_)
624 os <<
"ExecutionTime = ";
627 os <<
" ClockTime = ";
634 os <<
"ExecutionTime = " << elapsedCpuTime() <<
" s"
635 <<
" 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,...
static bool supports_gz()
True if compiled with libz support.
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 fileCheckTypes fileModificationChecking
Type of file modification checking.
streamFormat format() const noexcept
Get the current stream format.
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.
A token holds an item read from Istream.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
const Type & value() const
Return const reference to value.
OSstream Serr
OSstream wrapped stderr (std::cerr)
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const word & name() const
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.
bool distributed() const noexcept
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.
messageStream Info
Information stream (stdout output on master, null elsewhere)
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
dictionary & dimensionSystems()
Top level dictionary.
The IOstreamOption is a simple container for options an IOstream can normally have.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
dictionary & dimensionedConstants()
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Generic output stream using a standard (STL) stream.
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.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write the objects using stream options.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
OBJstream os(runTime.globalPath()/outputName)
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
"adjustable" / "adjustableRunTime"
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Omanip< int > setw(const int i)
T * find(const word &keyword)
Find and return an entry, nullptr on failure.
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.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
virtual int precision() const
Get precision of output field.
virtual void readDict()
Read the control dictionary and set the write controls etc.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void readModifiedObjects()
Read the objects that have been modified.
OSstream & stream()
Return OSstream for output operations.
forAllConstIters(mixture.phases(), phase)
virtual std::ostream & stdStream()
Access to underlying std::ostream.
static bool & parRun() noexcept
Test if this a parallel run.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
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.
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
OSstream wrapped stdout (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.