mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: fvSchemes,fvSolution : read file only once.
This commit is contained in:
@ -43,9 +43,40 @@ static const Foam::List<Foam::word> subDictNames
|
||||
);
|
||||
//! @endcond
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::solution::read(const dictionary& dict)
|
||||
{
|
||||
if (dict.found("cache"))
|
||||
{
|
||||
cache_ = dict.subDict("cache");
|
||||
caching_ = cache_.lookupOrDefault("active", true);
|
||||
}
|
||||
|
||||
if (dict.found("relaxationFactors"))
|
||||
{
|
||||
relaxationFactors_ = dict.subDict("relaxationFactors");
|
||||
}
|
||||
|
||||
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
||||
|
||||
if (dict.found("solvers"))
|
||||
{
|
||||
solvers_ = dict.subDict("solvers");
|
||||
upgradeSolverDict(solvers_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||
Foam::solution::solution
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName,
|
||||
const bool syncPar
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
@ -56,7 +87,8 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||
obr,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
syncPar
|
||||
),
|
||||
cache_(ITstream("cache", tokenList())()),
|
||||
caching_(false),
|
||||
@ -64,7 +96,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||
defaultRelaxationFactor_(0),
|
||||
solvers_(ITstream("solvers", tokenList())())
|
||||
{
|
||||
read();
|
||||
read(solutionDict());
|
||||
}
|
||||
|
||||
|
||||
@ -250,26 +282,7 @@ bool Foam::solution::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
const dictionary& dict = solutionDict();
|
||||
|
||||
if (dict.found("cache"))
|
||||
{
|
||||
cache_ = dict.subDict("cache");
|
||||
caching_ = cache_.lookupOrDefault("active", true);
|
||||
}
|
||||
|
||||
if (dict.found("relaxationFactors"))
|
||||
{
|
||||
relaxationFactors_ = dict.subDict("relaxationFactors");
|
||||
}
|
||||
|
||||
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
||||
|
||||
if (dict.found("solvers"))
|
||||
{
|
||||
solvers_ = dict.subDict("solvers");
|
||||
upgradeSolverDict(solvers_);
|
||||
}
|
||||
read(solutionDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user