writeRegisteredObject: Now writes the <time>/uniform/time dictionary
This commit is contained in:
parent
154a4c9e34
commit
8f45162c6c
3 changed files with 47 additions and 24 deletions
|
|
@ -372,6 +372,9 @@ public:
|
||||||
const word& constantName = "constant"
|
const word& constantName = "constant"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Write time dictionary to the <time>/uniform directory
|
||||||
|
virtual bool writeTimeDict() const;
|
||||||
|
|
||||||
//- Write using given format, version and compression
|
//- Write using given format, version and compression
|
||||||
virtual bool writeObject
|
virtual bool writeObject
|
||||||
(
|
(
|
||||||
|
|
|
||||||
|
|
@ -410,6 +410,39 @@ void Foam::Time::readModifiedObjects()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::Time::writeTimeDict() const
|
||||||
|
{
|
||||||
|
const word tmName(timeName());
|
||||||
|
|
||||||
|
IOdictionary timeDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"time",
|
||||||
|
tmName,
|
||||||
|
"uniform",
|
||||||
|
*this,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
timeDict.add("value", timeName(timeToUserTime(value()), maxPrecision_));
|
||||||
|
timeDict.add("name", string(tmName));
|
||||||
|
timeDict.add("index", timeIndex_);
|
||||||
|
timeDict.add("deltaT", timeToUserTime(deltaT_));
|
||||||
|
timeDict.add("deltaT0", timeToUserTime(deltaT0_));
|
||||||
|
|
||||||
|
return timeDict.regIOobject::writeObject
|
||||||
|
(
|
||||||
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
IOstream::UNCOMPRESSED
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::Time::writeObject
|
bool Foam::Time::writeObject
|
||||||
(
|
(
|
||||||
IOstream::streamFormat fmt,
|
IOstream::streamFormat fmt,
|
||||||
|
|
@ -419,37 +452,19 @@ bool Foam::Time::writeObject
|
||||||
{
|
{
|
||||||
if (writeTime())
|
if (writeTime())
|
||||||
{
|
{
|
||||||
const word tmName(timeName());
|
bool writeOK = writeTimeDict();
|
||||||
|
|
||||||
IOdictionary timeDict
|
if (writeOK)
|
||||||
(
|
{
|
||||||
IOobject
|
writeOK = objectRegistry::writeObject(fmt, ver, cmp);
|
||||||
(
|
}
|
||||||
"time",
|
|
||||||
tmName,
|
|
||||||
"uniform",
|
|
||||||
*this,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
timeDict.add("value", timeName(timeToUserTime(value()), maxPrecision_));
|
|
||||||
timeDict.add("name", string(tmName));
|
|
||||||
timeDict.add("index", timeIndex_);
|
|
||||||
timeDict.add("deltaT", timeToUserTime(deltaT_));
|
|
||||||
timeDict.add("deltaT0", timeToUserTime(deltaT0_));
|
|
||||||
|
|
||||||
timeDict.regIOobject::writeObject(fmt, ver, cmp);
|
|
||||||
bool writeOK = objectRegistry::writeObject(fmt, ver, cmp);
|
|
||||||
|
|
||||||
if (writeOK)
|
if (writeOK)
|
||||||
{
|
{
|
||||||
// Does the writeTime trigger purging?
|
// Does the writeTime trigger purging?
|
||||||
if (writeTime_ && purgeWrite_)
|
if (writeTime_ && purgeWrite_)
|
||||||
{
|
{
|
||||||
previousWriteTimes_.push(tmName);
|
previousWriteTimes_.push(timeName());
|
||||||
|
|
||||||
while (previousWriteTimes_.size() > purgeWrite_)
|
while (previousWriteTimes_.size() > purgeWrite_)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,11 @@ bool Foam::functionObjects::writeRegisteredObject::write
|
||||||
{
|
{
|
||||||
Info<< type() << " " << name() << " output:" << nl;
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
|
if (!obr_.time().writeTime())
|
||||||
|
{
|
||||||
|
obr_.time().writeTimeDict();
|
||||||
|
}
|
||||||
|
|
||||||
DynamicList<word> allNames(obr_.toc().size());
|
DynamicList<word> allNames(obr_.toc().size());
|
||||||
forAll(objectNames_, i)
|
forAll(objectNames_, i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue