48 static std::ostream&
printTimeHMS(std::ostream&
os,
double seconds)
50 const unsigned long ss = seconds;
53 const auto dd = (ss / 86400);
55 if (dd)
os << dd <<
'-';
58 const int hh = ((ss / 3600) % 24);
68 << ((ss / 60) % 60) <<
':';
76 const int hundredths = int(100 * (seconds - ss)) % 100;
97 setEnv(
"FOAM_APPLICATION", application,
false);
107 (localDict = controlDict_.
findDict(
"DebugSwitches")) !=
nullptr 112 <<
"Overriding DebugSwitches according to " 113 << controlDict_.
name() <<
nl;
122 (localDict = controlDict_.
findDict(
"InfoSwitches")) !=
nullptr 127 <<
"Overriding InfoSwitches according to " 128 << controlDict_.
name() <<
nl;
136 (localDict = controlDict_.
findDict(
"OptimisationSwitches")) !=
nullptr 141 <<
"Overriding OptimisationSwitches according to " 142 << controlDict_.
name() <<
nl;
153 word fileHandlerName;
157 && localDict->readIfPresent(
"fileHandler", fileHandlerName)
161 DetailInfo <<
"Overriding fileHandler to " << fileHandlerName <<
nl;
177 refPtr<fileOperation> newHandler
191 fileHandler().addWatches(controlDict_, oldWatched);
201 (localDict = controlDict_.
findDict(
"DimensionedConstants")) !=
nullptr 206 <<
"Overriding DimensionedConstants according to " 207 << controlDict_.
name() <<
nl;
221 const List<simpleRegIOobject*>&
objects = *iter;
223 for (simpleRegIOobject* obj :
objects)
225 obj->readData(dummyIs);
230 obj->writeData(
Info);
241 (localDict = controlDict_.
findDict(
"DimensionSets")) !=
nullptr 246 <<
"Overriding DimensionSets according to " 247 << controlDict_.
name() <<
nl;
252 dict.merge(*localDict);
254 simpleObjectRegistryEntry* objPtr = objs.find(
"DimensionSets");
260 const List<simpleRegIOobject*>&
objects = *objPtr;
264 for (simpleRegIOobject* obj :
objects)
269 ISpanStream is(
os.view());
295 <<
"writeInterval < 1 for writeControl timeStep" 332 <<
", should be >= 0, setting to 0" 366 if (controlDict_.
found(
"writeVersion"))
368 writeStreamOption_.
version(controlDict_.
get<token>(
"writeVersion"));
374 if (controlDict_.
found(
"writeFormat"))
376 writeStreamOption_.
format(controlDict_.
get<word>(
"writeFormat"));
379 if (controlDict_.
found(
"writePrecision"))
383 controlDict_.
get<
unsigned int>(
"writePrecision")
396 if (controlDict_.
found(
"writeCompression"))
400 controlDict_.
get<word>(
"writeCompression")
408 <<
"Disabled output compression for non-ascii format" 409 <<
" (inefficient/ineffective)" 417 <<
"Disabled output compression" 418 <<
" (missing libz support)" 427 controlDict_.
readIfPresent(
"runTimeModifiable", runTimeModifiable_);
443 if (controlDict_.regIOobject::read())
447 functionObjects_.read();
449 if (runTimeModifiable_)
455 fileHandler().addWatches(controlDict_, controlDict_.files());
457 controlDict_.files().clear();
468 if (runTimeModifiable_)
485 if (controlDict_.readIfModified())
488 functionObjects_.read();
490 if (runTimeModifiable_)
497 fileHandler().addWatches(controlDict_, controlDict_.files());
499 controlDict_.files().clear();
504 if (registryModified)
518 IOdictionary timeDict
532 timeDict.add(
"value",
timeName(timeToUserTime(value()), maxPrecision_));
533 timeDict.add(
"name",
string(tmName));
534 timeDict.add(
"index", timeIndex_);
535 timeDict.add(
"deltaT", timeToUserTime(deltaT_));
536 timeDict.add(
"deltaT0", timeToUserTime(deltaT0_));
538 return timeDict.regIOobject::writeObject
549 const bool writeOnProc
554 bool writeOK = writeTimeDict();
564 if (writeTime_ && purgeWrite_)
568 previousWriteTimes_.empty()
569 || previousWriteTimes_.top() !=
timeName()
572 previousWriteTimes_.push(
timeName());
575 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";
Omanip< char > setfill(char fillch)
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
Generic output stream using a standard (STL) stream.
const scalar & value() const noexcept
Return const reference to value.
void size(const label n)
Older name for setAddressableSize.
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void readModifiedObjects()
Read the objects that have been modified.
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
int infoDetailLevel
Global for selective suppression of Info output.
void setValues(const dictionary &dict, bool verbose=false, bool dryrun=false)
Set values (invoke callbacks) from dictionary entries.
constexpr char nl
The newline '\n' character (0x0a)
static bool supports_gz() noexcept
True if compiled with libz support.
static std::ostream & printTimeHMS(std::ostream &os, double seconds)
virtual bool modified() const
Return true if any of the object's files have been modified.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
static unsigned int defaultPrecision() noexcept
Return the default precision.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
A simple container for options an IOstream can normally have.
Ignore writing from objectRegistry::writeObject()
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
writeControls writeControl_
const word & timeName() const noexcept
Return the current time name.
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
fileName path() const
The complete path for the object (with instance, local,...).
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
dictionary & dimensionedConstants()
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write the objects using stream options.
virtual const std::ostream & stdStream() const override
Const access to underlying std::ostream.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
"adjustable" / "adjustableRunTime"
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
static void warnLocalBoundaryConsistencyCompat(const dictionary &)
Warn about keyword changes for local boundary consistency checks.
static int precision_
Time directory name precision.
void clear()
Clear the list, i.e. set size to zero.
virtual int precision() const override
Get precision of output field.
static const Enum< writeControls > writeControlNames
Names for writeControls.
OSstream Sout
OSstream wrapped stdout (std::cout)
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const labelList & watchIndices() const noexcept
Read access to file-monitoring handles.
bool distributed() const noexcept
True if case running with parallel distributed directories (ie. not NFS mounted)
static IOstreamOption::floatFormat format_
Format for time directory names (general | fixed | scientific)
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
OBJstream os(runTime.globalPath()/outputName)
virtual void readDict()
Read the control dictionary and set the write controls etc.
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
compressionType compression() const noexcept
Get the stream compression.
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
static autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type. Uses defaultFileHandler if the handlerType is empty.
void readModifiedObjects()
Read the objects that have been modified.
simpleObjectRegistry & dimensionSetObjects()
Access to registered DimensionSets objects.
const word & name() const noexcept
Return const reference to name.
void writeOnce()
Write the objects once (one shot) and continue the run.
dictionary & dimensionSystems()
Top level dictionary.
virtual bool read()
Read control dictionary, update controls and time.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OSstream & stream()
Return OSstream for output operations.
static floatFormat floatFormatEnum(const word &fmtName, const floatFormat deflt=floatFormat::general)
Lookup floatFormat enum corresponding to the string (general | fixed | scientific).
Stop when Time reaches prescribed endTime.
UPtrList< Type > objects()
Return unsorted list of objects with a class satisfying isA<Type> or isType<Type> (with Strict) ...
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
versionNumber version() const noexcept
Get the stream version.
bool distributed() const noexcept
Distributed roots (parallel run)
OSstream Serr
OSstream wrapped stderr (std::cerr)
messageStream Info
Information stream (stdout output on master, null elsewhere)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Omanip< int > setw(const int i)
#define forAllReverse(list, i)
Reverse loop across all elements in list.
static const fileOperation & fileHandler()
Return the current file handler. Will create the default file handler if necessary.
List< fileName > fileNameList
List of fileName.
streamFormat format() const noexcept
Get the current stream format.
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
bool writeNow()
Write the objects immediately (not at end of iteration) and continue the run.
forAllConstIters(mixture.phases(), phase)
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...