BUG: Corrected re-reading of time control function objects. Fixes #1192

This commit is contained in:
Andrew Heather
2019-02-05 11:28:31 +00:00
parent 427acc84b0
commit edfd27f9e4

View File

@ -815,7 +815,35 @@ bool Foam::functionObjectList::read()
"functionObject::" + objPtr->name() + "::read" "functionObject::" + objPtr->name() + "::read"
); );
enabled = objPtr->read(dict); if (functionObjects::timeControl::entriesPresent(dict))
{
if (isA<functionObjects::timeControl>(objPtr()))
{
// Already a time control - normal read
enabled = objPtr->read(dict);
}
else
{
// Was not a time control - need to re-create
objPtr.reset
(
new functionObjects::timeControl
(
key,
time_,
dict
)
);
enabled = true;
}
}
else
{
// Plain function object - normal read
enabled = objPtr->read(dict);
}
ok = enabled && ok; ok = enabled && ok;
} }