mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added a switch to control the caching system.
This commit is contained in:
@ -60,6 +60,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
cache_(ITstream("cache", tokenList())()),
|
cache_(ITstream("cache", tokenList())()),
|
||||||
|
caching_(false),
|
||||||
relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
|
relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
|
||||||
defaultRelaxationFactor_(0),
|
defaultRelaxationFactor_(0),
|
||||||
solvers_(ITstream("solvers", tokenList())())
|
solvers_(ITstream("solvers", tokenList())())
|
||||||
@ -149,6 +150,8 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
|
|
||||||
|
|
||||||
bool Foam::solution::cache(const word& name) const
|
bool Foam::solution::cache(const word& name) const
|
||||||
|
{
|
||||||
|
if (caching_)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -157,6 +160,11 @@ bool Foam::solution::cache(const word& name) const
|
|||||||
|
|
||||||
return cache_.found(name);
|
return cache_.found(name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::solution::relax(const word& name) const
|
bool Foam::solution::relax(const word& name) const
|
||||||
@ -248,6 +256,7 @@ bool Foam::solution::read()
|
|||||||
if (dict.found("cache"))
|
if (dict.found("cache"))
|
||||||
{
|
{
|
||||||
cache_ = dict.subDict("cache");
|
cache_ = dict.subDict("cache");
|
||||||
|
caching_ = cache_.lookupOrDefault<Switch>("active", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("relaxationFactors"))
|
if (dict.found("relaxationFactors"))
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define solution_H
|
#define solution_H
|
||||||
|
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -56,6 +57,9 @@ class solution
|
|||||||
//- Dictionary of temporary fields to cache
|
//- Dictionary of temporary fields to cache
|
||||||
dictionary cache_;
|
dictionary cache_;
|
||||||
|
|
||||||
|
//- Switch for the caching mechanism
|
||||||
|
Switch caching_;
|
||||||
|
|
||||||
//- Dictionary of relaxation factors for all the fields
|
//- Dictionary of relaxation factors for all the fields
|
||||||
dictionary relaxationFactors_;
|
dictionary relaxationFactors_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user