34void Foam::objectRegistry::readCacheTemporaryObjects()
const
36 if (cacheTemporaryObjectsActive_)
return;
38 const auto* eptr = time_.controlDict().findEntry
40 "cacheTemporaryObjects",
46 cacheTemporaryObjectsActive_ =
true;
56 eptr->dict().readIfPresent(
name(), objectNames);
61 eptr->readEntry(objectNames);
64 for (
const word& objName : objectNames)
66 cacheTemporaryObjects_.emplace(objName,
false,
false);
69 if (objectRegistry::debug)
71 Info<<
"objectRegistry::cacheTemporaryObjects : "
78void Foam::objectRegistry::deleteCachedObject(
regIOobject*
io)
const
85 io->rename(
io->name() +
"-Cache");
106 return cacheTemporaryObjects_.contains(
name);
112 return io && cacheTemporaryObjects_.contains(
io->name());
118 return cacheTemporaryObjects_.contains(
io.name());
127 if (
io && !cacheTemporaryObjects_.empty())
129 auto iter = cacheTemporaryObjects_.find(
io->name());
134 iter.val().first() =
false;
151 bool enabled = cacheTemporaryObjects_.size();
155 const auto* subObr =
dynamic_cast<const objectRegistry*
>(iter.val());
158 if (subObr && subObr !=
this)
160 enabled = subObr->checkCacheTemporaryObjects() || enabled;
170 if (!iter.val().second())
177 <<
"objectRegistry '"
178 <<
name() <<
"' has missing temporary objects:" <<
nl;
181 *emitWarning<<
" " << iter.key() <<
nl;
185 iter.val().second() =
false;
192 <<
"Available temporary objects: "
193 << temporaryObjects_.sortedToc() <<
endl;
196 temporaryObjects_.
clear();
const word & name() const noexcept
Return the object name.
Generic output stream using a standard (STL) stream.
OSstream & stream(OSstream *alternative=nullptr, int communicator=-1)
Return OSstream for output operations.
Registry of regIOobjects.
void resetCacheTemporaryObject(const regIOobject *io) const
Reset the cache state of the given object (nullptr is ignored).
bool checkCacheTemporaryObjects() const
Check that all objects specified in the cacheTemporaryObjects were also cached.
void clear()
Clear all entries from the registry.
bool is_cacheTemporaryObject(const word &name) const
True if given name is in the cacheTemporaryObjects set.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
A class for handling words, derived from Foam::string.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text.
constexpr char nl
The newline '\n' character (0x0a).
#define forAllIters(container, iter)
Iterate across all elements in the container object.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.