32 template<
class T,
class Key,
class Hash>
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"
112 if (firstToken.isLabel())
114 label s = firstToken.labelToken();
117 char delimiter = is.
readBeginList(
"ListHashTable<T, Key, Hash>");
121 if (2*
s > L.keys_.size())
132 L.
insert(key, pTraits<T>(is));
136 "operator>>(Istream&, ListHashTable<T, Key, Hash>&)"
146 ) <<
"incorrect first token, '(', found " << firstToken.info()
154 else if (firstToken.isPunctuation())
161 ) <<
"incorrect first token, '(', found " << firstToken.info()
169 lastToken.isPunctuation()
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>
213 const ListHashTable<T, Key, Hash>& L)
233 os.check(
"Ostream& operator<<(Ostream&, const ListHashTable&)");
#define forAll(list, i)
Loop across all elements in list.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
char readEndList(const char *funcName)
char readBeginList(const char *funcName)
void putBack(const token &)
Put back token.
STL conforming hash table using contiguous lists rather than linked lists.
bool insert(const Key &key, const T &newElmt)
Insert a new hashed entry.
friend Istream & operator>>(Istream &, ListHashTable< T, Key, Hash > &)
Ostream & printInfo(Ostream &) const
Print information.
label size() const
Return number of elements in table.
const iterator & end()
Iterator set to beyond the end of the ListHashTable.
Iterator< const T &, const ListHashTable< T, Key, Hash > & > const_iterator
ListHashTable(const label size=128)
Construct given initial table size.
iterator begin()
Iterator set to the beginning of the ListHashTable.
void clear()
Clear all entries from table.
void resize(const label newSize)
Resize the hash table for efficiency.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A token holds items read from Istream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
Istream & operator>>(Istream &, pistonPointEdgeData &)
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Template-invariant bits for ListHashTable.