|
| HashTable (int init_size=32 *1024) |
|
| HashTable (const HashTable &other) |
|
| ~HashTable () |
|
ItemT * | Get (int p1, int p2) |
| Get an item whose parents are p1, p2... Create it if it doesn't exist. More...
|
|
ItemT * | Get (int p1, int p2, int p3, int p4) |
|
ItemT * | Peek (int p1, int p2) const |
| Get an item whose parents are p1, p2... Return NULL if it doesn't exist. More...
|
|
ItemT * | Peek (int p1, int p2, int p3, int p4) const |
|
template<typename OtherT > |
ItemT * | Get (OtherT *i1, OtherT *i2) |
|
template<typename OtherT > |
ItemT * | Get (OtherT *i1, OtherT *i2, OtherT *i3, OtherT *i4) |
|
template<typename OtherT > |
ItemT * | Peek (OtherT *i1, OtherT *i2) const |
|
template<typename OtherT > |
ItemT * | Peek (OtherT *i1, OtherT *i2, OtherT *i3, OtherT *i4) const |
|
ItemT * | Peek (int id) const |
| Obtains an item given its ID. More...
|
|
void | Delete (ItemT *item) |
| Remove an item from the hash table and also delete the item itself. More...
|
|
void | Reparent (ItemT *item, int new_p1, int new_p2) |
| Make an item hashed under different parent IDs. More...
|
|
void | Reparent (ItemT *item, int new_p1, int new_p2, int new_p3, int new_p4) |
|
long | MemoryUsage () const |
| Return total size of allocated memory (tables plus items), in bytes. More...
|
|
void | PrintMemoryDetail () const |
|
template<typename ItemT>
class mfem::HashTable< ItemT >
HashTable is a container for items that require associative access through pairs (or quadruples) of indices:
(p1, p2) -> item (p1, p2, p3, p4) -> item
An example of this are edges and faces in a mesh. Each edge is uniquely identified by two parent vertices and so can be easily accessed from different elements using this class. Similarly for faces.
The order of the p1, p2, ... indices is not relevant as they are sorted each time this class is invoked.
There are two main methods this class provides. The Get(...) method always returns an item given the two or four indices. If the item didn't previously exist, the methods creates a new one. The Peek(...) method, on the other hand, just returns NULL if the item doesn't exist.
Each new item is automatically assigned a unique ID. The IDs may (but need not) be used as p1, p2, ... of other items.
The item type (ItemT) needs to follow either the Hashed2 or the Hashed4 concept. It is easiest to just inherit from these structs.
All items in the container can also be accessed sequentially using the provided iterator.
Definition at line 117 of file hash.hpp.