49 const unsigned long ss = seconds;
52 const auto dd = (ss / 86400);
54 if (dd)
os << dd <<
'-';
57 const int hh = ((ss / 3600) % 24);
61 os << std::setw(2) << std::setfill(
'0')
66 os << std::setw(2) << std::setfill(
'0')
67 << ((ss / 60) % 60) <<
':';
70 os << std::setw(2) << std::setfill(
'0')
75 const int hundredths = int(100 * (seconds - ss)) % 100;
79 os <<
'.' << std::setw(2) << std::setfill(
'0') << hundredths;
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;
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_);
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";
T * find(const word &keyword)
Find and return an entry, nullptr on failure.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
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 fileCheckTypes fileModificationChecking
Type of file modification checking.
The IOstreamOption is a simple container for options an IOstream can normally have.
versionNumber version() const noexcept
Get the stream version.
compressionType compression() const noexcept
Get the stream compression.
streamFormat format() const noexcept
Get the current stream format.
@ ASCII
"ascii" (normal default)
@ UNCOMPRESSED
compression = false
@ COMPRESSED
compression = true
static unsigned int defaultPrecision() noexcept
Return the default precision.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
void clear()
Clear the list, i.e. set size to zero.
virtual std::ostream & stdStream()
Access to underlying std::ostream.
Generic output stream using a standard (STL) stream.
virtual int precision() const
Get precision of output field.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool distributed() const noexcept
virtual void readDict()
Read the control dictionary and set the write controls etc.
static int precision_
Time directory name precision.
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 Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
@ wcAdjustableRunTime
"adjustable" / "adjustableRunTime"
void writeOnce()
Write the objects once (one shot) and continue the run.
@ general
default float notation
@ scientific
scientific notation
@ fixed
fixed-point notation
static fmtflags format_
Time directory name format.
@ saEndTime
Stop when Time reaches prescribed endTime.
writeControls writeControl_
virtual word timeName() const
Return current time name.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
static const Enum< writeControls > writeControlNames
Names for writeControls.
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
void readModifiedObjects()
Read the objects that have been modified.
virtual bool read()
Read control dictionary, update controls and time.
void size(const label n)
Older name for setAddressableSize.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const word & name() const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const scalar & value() const
Return const reference to value.
const word & name() const
Return const reference to name.
OSstream & stream()
Return OSstream for output operations.
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual bool rmDir(const fileName &dir, const bool silent=false) const =0
Remove a directory and its contents.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
virtual bool modified() const
Return true if any of the object's files have been modified.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write the objects using stream options.
void readModifiedObjects()
Read the objects that have been modified.
static bool supports_gz()
True if compiled with libz support.
const labelList & watchIndices() const noexcept
Read access to file-monitoring handles.
Object registry for simpleRegIOobject. Maintains ordering.
void setValues(const dictionary &dict, bool report=false)
Set values (invoke callbacks) from dictionary entries.
Abstract base class for registered object with I/O. Used in debug symbol registration.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
#define WarningInFunction
Report a warning using Foam::Warning.
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
simpleObjectRegistry & dimensionSetObjects()
Access to registered DimensionSets objects.
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
const fileOperation & fileHandler()
Get current file handler.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
messageStream Info
Information stream (stdout output on master, null elsewhere)
dictionary & dimensionSystems()
Top level dictionary.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
OSstream Sout
OSstream wrapped stdout (std::cout)
static std::ostream & printTimeHMS(std::ostream &os, double seconds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
OSstream Serr
OSstream wrapped stderr (std::cerr)
int infoDetailLevel
Global for selective suppression of Info output.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dictionary & dimensionedConstants()
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.