Gromacs
2018.8
|
#include <stdio.h>
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
This file declares functions for a simple hash map used by domain decomposition.
It is limited to integer keys and integer values. The purpose is highest efficiency and lowest memory usage possible. Thus the code is in a header, so it can be inlined where it is used.
Classes | |
struct | gmx_hash_e_t |
Hashing key-generation helper struct. More... | |
struct | gmx_hash_t |
Hashing helper struct. More... | |
Functions | |
static void | gmx_hash_clear (gmx_hash_t *hash) |
Clear all the entries in the hash table. | |
static void | gmx_hash_realloc (gmx_hash_t *hash, int nkey_used_estimate) |
Reallocate hash table data structures. | |
static void | gmx_hash_clear_and_optimize (gmx_hash_t *hash) |
Clear all the entries in the hash table. More... | |
static gmx_hash_t * | gmx_hash_init (int nkey_used_estimate) |
Initialize hash table. | |
static void | gmx_hash_set (gmx_hash_t *hash, int key, int value) |
Set the hash entry for key to value. | |
static void | gmx_hash_del (gmx_hash_t *hash, int key) |
Delete the hash entry for key. | |
static void | gmx_hash_change_value (gmx_hash_t *hash, int key, int value) |
Change the value for present hash entry for key. | |
static void | gmx_hash_change_or_set (gmx_hash_t *hash, int key, int value) |
Change the hash value if already set, otherwise set the hash value. | |
static gmx_bool | gmx_hash_get (const gmx_hash_t *hash, int key, int *value) |
Returns if the key is present, if the key is present *value is set. | |
static int | gmx_hash_get_minone (const gmx_hash_t *hash, int key) |
Returns the value or -1 if the key is not present. | |
|
inlinestatic |
Clear all the entries in the hash table.
With the current number of keys check if the table size is still good, if not optimize it with the current number of keys.