32 template<
class T,
class Key,
class Hash>
40 keys_(StaticHashTableCore::canonicalSize(size)),
41 objects_(StaticHashTableCore::canonicalSize(size)),
43 endIter_(*
this, keys_.size(), 0),
44 endConstIter_(*
this, keys_.size(), 0)
49 <<
"Illegal size " << size <<
" for StaticHashTable." 59 template<
class T,
class Key,
class Hash>
65 unsigned avgChain = 0;
70 const label count = keys_[hashIdx].size();
83 os <<
"StaticHashTable<T,Key,Hash>" 84 <<
" elements:" << size() <<
" slots:" << used <<
"/" << keys_.size()
85 <<
" chaining(avg/max):" << (used ? float(avgChain/used) : 0)
86 <<
"/" << maxChain <<
endl;
94 template<
class T,
class Key,
class Hash>
97 is.
fatalCheck(
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
102 is.
fatalCheck(
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
104 token firstToken(is);
108 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : " 109 "reading first token" 117 char delimiter = is.
readBeginList(
"StaticHashTable<T, Key, Hash>");
121 if (2*s > L.keys_.size())
126 if (delimiter == token::BEGIN_LIST)
136 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&)" 146 ) <<
"incorrect first token, '(', found " << firstToken.
info()
156 if (firstToken.
pToken() != token::BEGIN_LIST)
161 ) <<
"incorrect first token, '(', found " << firstToken.
info()
170 && lastToken.
pToken() == token::END_LIST
186 "operator>>(Istream&, StaticHashTable<T, Key, Hash>&) : " 198 ) <<
"incorrect first token, expected <int> or '(', found " 203 is.
fatalCheck(
"operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
209 template<
class T,
class Key,
class Hash>
216 os <<
nl << L.
size() <<
nl << token::BEGIN_LIST <<
nl;
226 os << iter.key() << token::SPACE << iter() <<
nl;
230 os << token::END_LIST;
233 os.check(
"Ostream& operator<<(Ostream&, const StaticHashTable&)");
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
iterator begin()
Iterator set to the beginning of the StaticHashTable.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
char readEndList(const char *funcName)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds items read from Istream.
void putBack(const token &)
Put back token.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
punctuationToken pToken() const
Istream & operator>>(Istream &, directionInfo &)
STL conforming hash table.
bool insert(const Key &key, const T &newElmt)
Insert a new hashed entry.
Template-invariant bits for StaticHashTable.
char readBeginList(const char *funcName)
StaticHashTable(const label size=128)
Construct given initial table size.
errorManip< error > abort(error &err)
void clear()
Clear all entries from table.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label size() const
Return number of elements in table.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
InfoProxy< token > info() const
Return info proxy.
bool isPunctuation() const
void resize(const label newSize)
Resize the hash table for efficiency.
Ostream & printInfo(Ostream &) const
Print information.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
const iterator & end()
Iterator set to beyond the end of the StaticHashTable.