(git:6a2e663)
qs_nl_hash_table_types Module Reference

A simple hash table of integer keys, using hash function: H(k) = (k*p) mod n + 1 where: k = key p = a prime number >= n n = size of the hash table And collision resolvation is done by open addressing with linear probing. More...

Functions/Subroutines

recursive subroutine, public nl_hash_table_add (hash_table, key, val)
 Add element to a hash table, auto resize if necessary. More...
 
subroutine, public nl_hash_table_create (hash_table, nmax)
 Creates and initialises an empty nl_hash_table object. More...
 
subroutine, public nl_hash_table_get_from_index (hash_table, idx, val)
 Retrieve value from a hash table given a specified index. More...
 
subroutine, public nl_hash_table_is_null (hash_table, key, is_null)
 Initialises a nl_hash_table object. More...
 
subroutine, public nl_hash_table_release (hash_table)
 releases the hash table. Note that deallocating tasks stored in the table is the responsibility of the caller More...
 
subroutine, public nl_hash_table_status (hash_table, nelements, nmax, prime)
 outputs the current information about the table More...
 

Detailed Description

A simple hash table of integer keys, using hash function: H(k) = (k*p) mod n + 1 where: k = key p = a prime number >= n n = size of the hash table And collision resolvation is done by open addressing with linear probing.

The table consists of an array of (key,val) pairs, and there are no intermediate buckets. For every new entry (k,v): We first look up slot H(k), and if it already contains an entry, then move to the next empty slot using a predefined linear probing sequence (e.g. iterate from slots H(k) to n, and then 1 to H(k)-1). When we look up, we use the same probing sequence.

Derived from qs_fb_hash_table_types.F (Mark Tucker, Jun 2016)

Function/Subroutine Documentation

◆ nl_hash_table_add()

recursive subroutine, public qs_nl_hash_table_types::nl_hash_table_add ( type(nl_hash_table_obj), intent(inout)  hash_table,
integer(kind=int_8), intent(in)  key,
type(neighbor_list_task_type), intent(in), pointer  val 
)

Add element to a hash table, auto resize if necessary.

Parameters
hash_table: the nl_hash_table object
key: key of the element
val: value of the element

Definition at line 103 of file qs_nl_hash_table_types.F.

Here is the caller graph for this function:

◆ nl_hash_table_create()

subroutine, public qs_nl_hash_table_types::nl_hash_table_create ( type(nl_hash_table_obj), intent(inout)  hash_table,
integer, intent(in), optional  nmax 
)

Creates and initialises an empty nl_hash_table object.

Parameters
hash_table: the nl_hash_table object, its content must be NULL and cannot be UNDEFINED
nmax: total size of the table, optional. If absent default size is 1.

Definition at line 143 of file qs_nl_hash_table_types.F.

Here is the caller graph for this function:

◆ nl_hash_table_get_from_index()

subroutine, public qs_nl_hash_table_types::nl_hash_table_get_from_index ( type(nl_hash_table_obj), intent(in)  hash_table,
integer, intent(in)  idx,
type(neighbor_list_task_type), intent(out), pointer  val 
)

Retrieve value from a hash table given a specified index.

Parameters
hash_table: the nl_hash_table object
idx: the index to retrieve the data for
val: output value, might be unassociated if there is no data with that index

Definition at line 169 of file qs_nl_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nl_hash_table_is_null()

subroutine, public qs_nl_hash_table_types::nl_hash_table_is_null ( type(nl_hash_table_obj), intent(in)  hash_table,
integer, intent(in)  key,
logical, intent(out)  is_null 
)

Initialises a nl_hash_table object.

Parameters
hash_table: the nl_hash_table object, its content must be NULL and cannot be UNDEFINED
key...
is_null...

Definition at line 248 of file qs_nl_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nl_hash_table_release()

subroutine, public qs_nl_hash_table_types::nl_hash_table_release ( type(nl_hash_table_obj), intent(inout)  hash_table)

releases the hash table. Note that deallocating tasks stored in the table is the responsibility of the caller

Parameters
hash_table: the nl_hash_table object in question

Definition at line 309 of file qs_nl_hash_table_types.F.

Here is the caller graph for this function:

◆ nl_hash_table_status()

subroutine, public qs_nl_hash_table_types::nl_hash_table_status ( type(nl_hash_table_obj), intent(inout)  hash_table,
integer, intent(out), optional  nelements,
integer, intent(out), optional  nmax,
integer, intent(out), optional  prime 
)

outputs the current information about the table

Parameters
hash_table: the nl_hash_table object in question
nelements: number of non-empty slots in the table
nmax: maximum number of slots in the table
prime: the prime used in the hash function

Definition at line 329 of file qs_nl_hash_table_types.F.

Here is the call graph for this function:
Here is the caller graph for this function: