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:
@ -43,19 +43,24 @@ namespace solvers
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::solidDisplacement::readControls(const bool construct)
|
||||
bool Foam::solvers::solidDisplacement::dependenciesModified() const
|
||||
{
|
||||
solid::readControls(construct);
|
||||
return solid::dependenciesModified() || mesh.solution().modified();
|
||||
}
|
||||
|
||||
if (construct || mesh.solution().modified())
|
||||
{
|
||||
nCorr = pimple.dict().lookupOrDefault<int>("nCorrectors", 1);
|
||||
convergenceTolerance = pimple.dict().lookupOrDefault<scalar>("D", 0);
|
||||
pimple.dict().lookup("compactNormalStress") >> compactNormalStress;
|
||||
accFac = pimple.dict().lookupOrDefault<scalar>("accelerationFactor", 1);
|
||||
}
|
||||
|
||||
bool Foam::solvers::solidDisplacement::read()
|
||||
{
|
||||
solid::read();
|
||||
|
||||
nCorr = pimple.dict().lookupOrDefault<int>("nCorrectors", 1);
|
||||
convergenceTolerance = pimple.dict().lookupOrDefault<scalar>("D", 0);
|
||||
pimple.dict().lookup("compactNormalStress") >> compactNormalStress;
|
||||
accFac = pimple.dict().lookupOrDefault<scalar>("accelerationFactor", 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +145,7 @@ Foam::solvers::solidDisplacement::solidDisplacement(fvMesh& mesh)
|
||||
mesh.schemes().setFluxRequired(D.name());
|
||||
|
||||
// Read the controls
|
||||
readControls(true);
|
||||
read();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -123,8 +123,11 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return true if the solver's dependencies have been modified
|
||||
virtual bool dependenciesModified() const;
|
||||
|
||||
//- Read controls
|
||||
virtual void readControls(const bool construct = false);
|
||||
virtual bool read();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user