diff --git a/src/OpenFOAM/matrices/solution/solution.C b/src/OpenFOAM/matrices/solution/solution.C index b17130dfe6b264f4c34c866cab044c1be5570f21..ba0db67bd4165e71c6cdba9e525ad3b81668d6a3 100644 --- a/src/OpenFOAM/matrices/solution/solution.C +++ b/src/OpenFOAM/matrices/solution/solution.C @@ -60,6 +60,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName) ) ), cache_(ITstream("cache", tokenList())()), + caching_(false), relaxationFactors_(ITstream("relaxationFactors", tokenList())()), defaultRelaxationFactor_(0), solvers_(ITstream("solvers", tokenList())()) @@ -150,12 +151,19 @@ Foam::label Foam::solution::upgradeSolverDict bool Foam::solution::cache(const word& name) const { - if (debug) + if (caching_) { - Info<< "Cache: find entry for " << name << endl; - } + if (debug) + { + Info<< "Cache: find entry for " << name << endl; + } - return cache_.found(name); + return cache_.found(name); + } + else + { + return false; + } } @@ -248,6 +256,7 @@ bool Foam::solution::read() if (dict.found("cache")) { cache_ = dict.subDict("cache"); + caching_ = cache_.lookupOrDefault<Switch>("active", true); } if (dict.found("relaxationFactors")) diff --git a/src/OpenFOAM/matrices/solution/solution.H b/src/OpenFOAM/matrices/solution/solution.H index 36724bf49556cb24ea8518acd62201547a33e723..ac1304fedcc65a2bd5ce529335b853823b626277 100644 --- a/src/OpenFOAM/matrices/solution/solution.H +++ b/src/OpenFOAM/matrices/solution/solution.H @@ -37,6 +37,7 @@ SourceFiles #define solution_H #include "IOdictionary.H" +#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +57,9 @@ class solution //- Dictionary of temporary fields to cache dictionary cache_; + //- Switch for the caching mechanism + Switch caching_; + //- Dictionary of relaxation factors for all the fields dictionary relaxationFactors_;