32 template<
class T,
class Key,
class Hash>
40 keys_(ListHashTableCore::canonicalSize(size)),
41 objects_(ListHashTableCore::canonicalSize(size)),
43 endIter_(*
this, keys_.size(), 0),
44 endConstIter_(*
this, keys_.size(), 0)
49 <<
"Illegal size " << size <<
" for ListHashTable." 59 template<
class T,
class Key,
class Hash>
65 unsigned avgChain = 0;
83 os <<
"ListHashTable<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&, ListHashTable<T, Key, Hash>&)");
102 is.
fatalCheck(
"operator>>(Istream&, ListHashTable<T, Key, Hash>&)");
104 token firstToken(is);
108 "operator>>(Istream&, ListHashTable<T, Key, Hash>&) : " 109 "reading first token" 117 char delimiter = is.
readBeginList(
"ListHashTable<T, Key, Hash>");
121 if (2*s > L.keys_.size())
126 if (delimiter == token::BEGIN_LIST)
136 "operator>>(Istream&, ListHashTable<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&, ListHashTable<T, Key, Hash>&) : " 198 ) <<
"incorrect first token, expected <int> or '(', found " 203 is.
fatalCheck(
"operator>>(Istream&, ListHashTable<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 ListHashTable&)");
#define forAll(list, i)
Loop across all elements in list.
Ostream & printInfo(Ostream &) const
Print information.
punctuationToken pToken() const
errorManipArg< error, int > exit(error &err, const int errNo=1)
Template-invariant bits for ListHashTable.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const iterator & end()
Iterator set to beyond the end of the ListHashTable.
char readEndList(const char *funcName)
InfoProxy< token > info() const
Return info proxy.
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.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
iterator begin()
Iterator set to the beginning of the ListHashTable.
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))
Istream & operator>>(Istream &, directionInfo &)
char readBeginList(const char *funcName)
label size() const
Return number of elements in table.
errorManip< error > abort(error &err)
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
ListHashTable(const label size=128)
Construct given initial table size.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
STL conforming hash table using contiguous lists rather than linked lists.
bool insert(const Key &key, const T &newElmt)
Insert a new hashed entry.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void resize(const label newSize)
Resize the hash table for efficiency.
void clear()
Clear all entries from table.
bool isPunctuation() const