34 void Foam::objectRegistry::readCacheTemporaryObjects()
const 36 if (cacheTemporaryObjectsActive_)
return;
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);
72 void Foam::objectRegistry::deleteCachedObject(regIOobject*
io)
const 98 return cacheTemporaryObjects_.found(
name);
107 if (
io && !cacheTemporaryObjects_.empty())
109 auto iter = cacheTemporaryObjects_.find(
io->
name());
114 iter.val().first() =
false;
125 resetCacheTemporaryObject(&
io);
131 bool enabled = cacheTemporaryObjects_.size();
135 const auto* subObr =
dynamic_cast<const objectRegistry*
>(iter.val());
138 if (subObr && subObr !=
this)
146 OSstream* emitWarning =
nullptr;
150 if (!iter.val().second())
157 <<
"objectRegistry '" 158 <<
name() <<
"' has missing temporary objects:" <<
nl;
161 *emitWarning<<
" " << iter.key() <<
nl;
165 iter.val().second() =
false;
172 <<
"Available temporary objects: " 173 << temporaryObjects_.sortedToc() <<
endl;
176 temporaryObjects_.clear();
bool cacheTemporaryObject(const word &name) const
True if given name is in the cacheTemporaryObjects set.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
bool checkCacheTemporaryObjects() const
Check that all objects specified in the cacheTemporaryObjects were also cached.
OSstream & stream(OSstream *alternative=nullptr)
Return OSstream for output operations. Use the alternative stream for serial-only output if it is a v...
void resetCacheTemporaryObject(const regIOobject *io) const
Reset the cache state of the given object (nullptr is ignored)
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional 'FOAM Warning' header text...
List< word > wordList
List of word.
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Registry of regIOobjects.
forAllConstIters(mixture.phases(), phase)