From aeef96251ff3c90287ce457e897427984646bbda Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Tue, 21 Sep 2021 20:51:41 +0100 Subject: [PATCH] ENH: Refactored stateFunctionObject - created new functionObjects::properties class derived from IOdictionary - replaces raw state IOdictionary owned by functionObjectList - state dictionary access/manipulators moved from stateFunctionObject - stateFunctionObject now acts as a light wrapper around functionObjecties::properties - updated dependent code --- src/OpenFOAM/Make/files | 1 + .../functionObjectList/functionObjectList.C | 45 +-- .../functionObjectList/functionObjectList.H | 27 +- .../functionObjectProperties.C | 308 ++++++++++++++++++ .../functionObjectProperties.H | 241 ++++++++++++++ .../functionObjectPropertiesTemplates.C | 163 +++++++++ .../stateFunctionObject/stateFunctionObject.C | 168 ++-------- .../stateFunctionObject/stateFunctionObject.H | 12 +- .../stateFunctionObjectTemplates.C | 73 +---- 9 files changed, 787 insertions(+), 251 deletions(-) create mode 100644 src/OpenFOAM/db/functionObjects/functionObjectProperties/functionObjectProperties.C create mode 100644 src/OpenFOAM/db/functionObjects/functionObjectProperties/functionObjectProperties.H create mode 100644 src/OpenFOAM/db/functionObjects/functionObjectProperties/functionObjectPropertiesTemplates.C diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 79cd748121..47a7a41a0d 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -354,6 +354,7 @@ $(dll)/codedBase/codedBase.C funcObjs = db/functionObjects $(funcObjs)/functionObject/functionObject.C +$(funcObjs)/functionObjectProperties/functionObjectProperties.C $(funcObjs)/functionObjectList/functionObjectList.C $(funcObjs)/stateFunctionObject/stateFunctionObject.C $(funcObjs)/timeFunctionObject/timeFunctionObject.C diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 4c39aa2759..8aa4168d6d 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -97,13 +97,13 @@ namespace Foam // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -void Foam::functionObjectList::createStateDict() const +void Foam::functionObjectList::createPropertiesDict() const { - // Cannot set the state dictionary on construction since Time has not + // Cannot set the properties dictionary on construction since Time has not // been fully initialised - stateDictPtr_.reset + propsDictPtr_.reset ( - new IOdictionary + new functionObjects::properties ( IOobject ( @@ -412,7 +412,7 @@ Foam::functionObjectList::functionObjectList warnings_(), time_(runTime), parentDict_(parentDict), - stateDictPtr_(nullptr), + propsDictPtr_(nullptr), objectsRegistryPtr_(nullptr), execution_(execution), updated_(false) @@ -509,37 +509,38 @@ Foam::autoPtr Foam::functionObjectList::New Foam::label Foam::functionObjectList::triggerIndex() const { - return stateDict().getOrDefault