41 const bool acceptPrimitiveEntry,
42 const bool report =
false 59 const keyType& kw = dEntry.keyword();
67 else if (dEntry.isDict())
77 ok = acceptPrimitiveEntry;
86 rejectKeys.insert(kw);
90 if (report && rejectKeys.size())
93 <<
"Dropped invalid/redundant entries: " 106 const word& subDictName,
107 const dictionary& topDict,
108 HashTable<refPtr<Function1<Type>>>& tbl,
109 const objectRegistry* obrPtr
114 const dictionary* dictPtr =
131 const dictionary&
dict = *dictPtr;
133 for (
const word& entryName : acceptKeys)
136 refPtr<Function1<Type>> func
138 Function1<Type>::New(entryName,
dict, obrPtr)
143 tbl.insert(entryName, std::move(func));
154 const word& subDictName,
155 const dictionary& topDict,
156 const HashTable<refPtr<Function1<Type>>>& tbl
159 const dictionary* dictPtr =
162 if (!dictPtr || tbl.empty())
169 const dictionary&
dict = *dictPtr;
171 for (
const entry& dEntry :
dict)
173 const word& entryName = dEntry.keyword();
175 const auto iter = tbl.cfind(entryName);
182 const auto& funcPtr = iter.val();
191 (*funcPtr).writeData(
os);
206 void Foam::expressions::exprDriver::resetFunctions
208 const dictionary&
dict 223 writeFuncsImpl<scalar>(
os,
"functions<scalar>", dict_, scalarFuncs_);
224 writeFuncsImpl<vector>(
os,
"functions<vector>", dict_, vectorFuncs_);
A class for handling keywords in dictionaries.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
constexpr char nl
The newline '\n' character (0x0a)
static void writeFuncsImpl(Ostream &os, const word &subDictName, const dictionary &topDict, const HashTable< refPtr< Function1< Type >>> &tbl)
static wordHashSet getAcceptableFunctionKeys(const dictionary *dictPtr, const bool acceptPrimitiveEntry, const bool report=false)
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
void resize(const label sz)
Resize the hash table for efficiency.
static void resetFuncsImpl(const word &subDictName, const dictionary &topDict, HashTable< refPtr< Function1< Type >>> &tbl, const objectRegistry *obrPtr)
virtual Ostream & endBlock()
Write end block group.
bool isPattern() const noexcept
The keyType is treated as a pattern, not as literal string.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
HashTable< refPtr< Function1< vector > > > vectorFuncs_
Function1 mappings/timelines (vector), evaluated at the simulation time or with arbitrary scalars...
void writeFunctions(Ostream &os) const
Write scalar/vector Function1 entries in dictionary format.
const dictionary & dict_
The dictionary with all input data/specification.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
const objectRegistry * obrPtr_
Pointer to an object registry (for functions etc).
HashTable< refPtr< Function1< scalar > > > scalarFuncs_
Function1 mappings/timelines (scalar), evaluated at the simulation time or with arbitrary scalars...
A keyword and a list of tokens is an 'entry'.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and a sub-dictionary) otherwise return nullptr...
#define InfoInFunction
Report an information message using Foam::Info.