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;
182 (localDict = controlDict_.
findDict(
"DimensionedConstants")) !=
nullptr
187 <<
"Overriding DimensionedConstants according to "
188 << controlDict_.
name() <<
nl;
203 obj->readData(dummyIs);
208 obj->writeData(
Info);
219 (localDict = controlDict_.
findDict(
"DimensionSets")) !=
nullptr
224 <<
"Overriding DimensionSets according to "
225 << controlDict_.
name() <<
nl;
230 dict.merge(*localDict);
270 <<
"writeInterval < 1 for writeControl timeStep"
307 <<
", should be >= 0, setting to 0"
314 if (controlDict_.
found(
"timeFormat"))
316 const word formatName(controlDict_.
get<
word>(
"timeFormat"));
318 if (formatName ==
"general")
322 else if (formatName ==
"fixed")
326 else if (formatName ==
"scientific")
333 <<
"unsupported time format " << formatName
360 if (controlDict_.
found(
"writeVersion"))
365 if (controlDict_.
found(
"writeFormat"))
367 writeStreamOption_.
format(controlDict_.
get<
word>(
"writeFormat"));
370 if (controlDict_.
found(
"writePrecision"))
374 controlDict_.
get<
unsigned int>(
"writePrecision")
390 if (controlDict_.
found(
"writeCompression"))
394 controlDict_.
get<
word>(
"writeCompression")
404 <<
"Disabled binary format compression"
405 <<
" (inefficient/ineffective)"
413 controlDict_.
readIfPresent(
"runTimeModifiable", runTimeModifiable_);
416 if (!runTimeModifiable_ && controlDict_.
watchIndices().size())
429 if (controlDict_.regIOobject::read())
433 functionObjects_.read();
435 if (runTimeModifiable_)
443 controlDict_.files().clear();
454 if (runTimeModifiable_)
471 if (controlDict_.readIfModified())
474 functionObjects_.read();
476 if (runTimeModifiable_)
485 controlDict_.files().clear();
490 if (registryModified)
518 timeDict.
add(
"value",
timeName(timeToUserTime(value()), maxPrecision_));
519 timeDict.
add(
"name",
string(tmName));
520 timeDict.
add(
"index", timeIndex_);
521 timeDict.
add(
"deltaT", timeToUserTime(deltaT_));
522 timeDict.
add(
"deltaT0", timeToUserTime(deltaT0_));
524 return timeDict.regIOobject::writeObject
540 bool writeOK = writeTimeDict();
550 if (writeTime_ && purgeWrite_)
554 previousWriteTimes_.empty()
555 || previousWriteTimes_.top() !=
timeName()
558 previousWriteTimes_.push(
timeName());
561 while (previousWriteTimes_.size() > purgeWrite_)
590 stopAt_ = saWriteNow;
605 switch (printExecutionFormat_)
609 os <<
"ExecutionTime = ";
612 os <<
" ClockTime = ";
619 os <<
"ExecutionTime = " << elapsedCpuTime() <<
" s"
620 <<
" 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.
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 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
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.
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.
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.
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
"adjustable" / "adjustableRunTime"
Input from string buffer, using a ISstream.
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
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.
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.