Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
lammps
src
COLVARS
inthash.h
1
#ifndef INTHASH_H
2
#define INTHASH_H
3
4
namespace
IntHash_NS {
5
6
/* re-usable integer hash table code. */
7
9
typedef
struct
inthash_t
{
10
struct
inthash_node_t
**bucket;
/* array of hash nodes */
11
int
size;
/* size of the array */
12
int
entries;
/* number of entries in table */
13
int
downshift;
/* shift cound, used in hash function */
14
int
mask;
/* used to select bits for hashing */
15
}
inthash_t
;
16
18
typedef
struct
inthash_node_t
{
19
int
data;
/* data in hash node */
20
int
key;
/* key for hash lookup */
21
struct
inthash_node_t
*next;
/* next node in hash chain */
22
}
inthash_node_t
;
23
24
#define HASH_FAIL -1
25
#define HASH_LIMIT 0.5
26
27
/* initialize new hash table */
28
void
inthash_init(
inthash_t
*tptr,
int
buckets);
29
/* lookup entry in hash table */
30
int
inthash_lookup(
inthash_t
*tptr,
int
key);
31
/* insert an entry into hash table. */
32
int
inthash_insert(
inthash_t
*tptr,
int
key,
int
data);
33
/* delete the hash table */
34
void
inthash_destroy(
inthash_t
*tptr);
35
36
}
// namespace IntHash_NS
37
38
#endif
IntHash_NS::inthash_node_t
Definition:
inthash.h:18
IntHash_NS::inthash_t
Definition:
inthash.h:9
Generated on Mon Nov 18 2024 18:38:26 for Collective Variables Module - Developer Documentation by
1.9.5