objectRegistry, regIOobject: Added support for automatic re-reading of dependent class

Now with the addition of the optional dependenciesModified() function classes
which depend on other classes which are re-read from file when modified are also
automatically updated via their read() function called by
objectRegistry::readModifiedObjects.

This significantly simplifies the update of the solutionControls and modular
solvers when either the controlDict or fvSolution dictionaries are modified at
run-time.
This commit is contained in:
Henry Weller
2023-08-28 20:28:39 +01:00
parent 11c6751927
commit 6054b1fea0
54 changed files with 634 additions and 499 deletions

View File

@ -58,6 +58,13 @@ Foam::functionObject* Foam::functionObjectList::remove
}
bool Foam::functionObjectList::writeData(Ostream&) const
{
NotImplemented;
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjectList::functionObjectList
@ -66,6 +73,15 @@ Foam::functionObjectList::functionObjectList
const bool execution
)
:
regIOobject
(
IOobject
(
"functionObjectList",
t.system(),
t
)
),
PtrList<functionObject>(),
digests_(),
indices_(),
@ -83,6 +99,15 @@ Foam::functionObjectList::functionObjectList
const bool execution
)
:
regIOobject
(
IOobject
(
"functionObjectList",
t.system(),
t
)
),
PtrList<functionObject>(),
digests_(),
indices_(),
@ -312,6 +337,19 @@ Foam::scalar Foam::functionObjectList::maxDeltaT() const
}
bool Foam::functionObjectList::dependenciesModified() const
{
if (&parentDict_ == &time_.controlDict())
{
return time_.controlDict().modified();
}
else
{
return false;
}
}
bool Foam::functionObjectList::read()
{
bool ok = true;