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:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user