From edfd27f9e428218518ba400d16ea6f248562085f Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Tue, 5 Feb 2019 11:28:31 +0000 Subject: [PATCH] BUG: Corrected re-reading of time control function objects. Fixes #1192 --- .../functionObjectList/functionObjectList.C | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 94ba5eb6bc1..45f02c12ab6 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -815,7 +815,35 @@ bool Foam::functionObjectList::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; } -- GitLab