diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 8d00a9426b..729fa9b957 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -333,6 +333,27 @@ void Foam::objectRegistry::clear() } +void Foam::objectRegistry::addTemporaryObject +( + const word& name +) const +{ + if (!cacheTemporaryObjects_.found(name)) + { + cacheTemporaryObjects_.insert(name, {false, false}); + } +} + + +bool Foam::objectRegistry::cacheTemporaryObject +( + const word& name +) const +{ + return cacheTemporaryObjects_.found(name); +} + + void Foam::objectRegistry::resetCacheTemporaryObject ( const regIOobject& ob diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index e6cbfd4ae6..b090195f8a 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -214,10 +214,17 @@ public: //- Remove all regIOobject owned by the registry void clear(); + //- Add the given name to the set of temporary objects to cache + void addTemporaryObject(const word& name) const; + + //- Return true if given name is in the cacheTemporaryObjects set + bool cacheTemporaryObject(const word& name) const; + + //- Cache the given object template bool cacheTemporaryObject(Object& ob) const; - //- Reset cache state of the given object + //- Reset the cache state of the given object // in the cacheTemporaryObjects set void resetCacheTemporaryObject(const regIOobject& ob) const;