hasty_hash_table Module

module~~hasty_hash_table~~UsesGraph module~hasty_hash_table hasty_hash_table module~hasty_dictionary hasty_dictionary module~hasty_dictionary->module~hasty_hash_table module~penf penf module~penf->module~hasty_hash_table module~penf->module~hasty_dictionary module~hasty_key_base hasty_key_base module~penf->module~hasty_key_base module~hasty_dictionary_node hasty_dictionary_node module~penf->module~hasty_dictionary_node module~hasty_content_adt hasty_content_adt module~hasty_content_adt->module~hasty_hash_table module~hasty_content_adt->module~hasty_dictionary_node module~hasty_key_base->module~hasty_hash_table module~hasty_key_base->module~hasty_dictionary module~hasty_key_base->module~hasty_dictionary_node module~hasty_dictionary_node->module~hasty_dictionary module~penf_global_parameters_variables penf_global_parameters_variables module~penf_global_parameters_variables->module~penf module~penf_b_size penf_b_size module~penf_global_parameters_variables->module~penf_b_size module~penf_stringify penf_stringify module~penf_global_parameters_variables->module~penf_stringify module~penf_b_size->module~penf module~penf_b_size->module~penf_stringify module~penf_stringify->module~penf iso_fortran_env iso_fortran_env iso_fortran_env->module~penf_stringify
Help

HASTY class of hash table.

Used By

module~~hasty_hash_table~~UsedByGraph module~hasty_hash_table hasty_hash_table module~hasty hasty module~hasty_hash_table->module~hasty program~hasty_test_caf_basic hasty_test_caf_basic module~hasty->program~hasty_test_caf_basic program~hasty_test_hash_table_homo hasty_test_hash_table_homo module~hasty->program~hasty_test_hash_table_homo program~hasty_test_hash_table_homocontent_failure hasty_test_hash_table_homocontent_failure module~hasty->program~hasty_test_hash_table_homocontent_failure program~hasty_test_caf_get_clone hasty_test_caf_get_clone module~hasty->program~hasty_test_caf_get_clone program~hasty_test_hash_table_homokey_failure hasty_test_hash_table_homokey_failure module~hasty->program~hasty_test_hash_table_homokey_failure program~hasty_test_dictionary hasty_test_dictionary module~hasty->program~hasty_test_dictionary program~hasty_test_hash_table hasty_test_hash_table module~hasty->program~hasty_test_hash_table
Help


Variables

TypeVisibility AttributesNameInitial
integer(kind=I4P), private, parameter:: HT_BUCKETS_NUMBER_DEF =557_I4P

Default number of buckets of hash table.


Interfaces

public interface len

Overload len builtin for accepting a hash_table.

  • private elemental function hash_table_len(self, global) result(length)

    Return the number of (actually stored) nodes of the hash table, namely the hash table length.

    Arguments

    Type IntentOptional AttributesName
    type(hash_table), intent(in) :: self

    The hash table.

    logical, intent(in), optional :: global

    Check the global values on all CAF images rather only on the local image.

    Return Value integer(kind=I4P)

    The hash table length.


Derived Types

type, public :: hash_table

Hash table class to storage any contents by means of generic dictionary buckets.

Components

TypeVisibility AttributesNameInitial
type(dictionary), private, allocatable:: bucket(:)

Hash table buckets.

integer(kind=I8P), private, allocatable:: ids_(:,:)

Minimum and maximum id values actually stored into each bucket.

integer(kind=I4P), private :: nodes_number_ =0_I4P

Number of nodes actually stored, namely the hash table length.

integer(kind=I4P), private :: me =0

Index of current CAF image.

integer(kind=I4P), private :: images_number =0

Number of CAF images.

integer(kind=I4P), private :: buckets_number =0_I4P

Number of buckets used.

logical, private :: is_homogeneous_ =.false.

Homogeneity status-guardian.

logical, private :: is_initialized_ =.false.

Initialization status.

class(*), private, allocatable:: typeguard_key

Key type guard (mold) for homogeneous keys check.

class(*), private, allocatable:: typeguard_content

Content type guard (mold) for homogeneous contents check.

Finalizations Procedures

final :: finalize

Finalize the hash table.

Type-Bound Procedures

procedure, public, pass(self) :: add_pointer

Add a node pointer to the hash table.

procedure, public, pass(self) :: add_clone

Add a node to the hash table cloning contents (non pointer add).

procedure, public, pass(self) :: destroy

Destroy the hash table.

procedure, public, pass(self) :: get_clone

Return a node's content in the hash table by cloning.

procedure, public, pass(self) :: get_pointer

Return a pointer to a node's content in the hash table.

procedure, public, pass(self) :: has_key

Check if the key is present in the hash table.

procedure, public, pass(self) :: ids

Return the list of ids actually stored.

procedure, public, pass(self) :: initialize

Initialize the hash table.

procedure, public, pass(self) :: is_homogeneous

Return homogeneity status.

procedure, public, pass(self) :: is_initialized

Return initialization status.

procedure, public, pass(self) :: print_keys

Print the hash table keys.

procedure, public, pass(self) :: remove

Remove a node from the hash table, given the key.

procedure, public, pass(self) :: traverse

Traverse hash table calling the iterator procedure.

procedure, private, pass(self) :: allocate_members

Allocate dynamic memory members.

procedure, private, pass(self) :: check_type

Check type consistency.

procedure, private, pass(self) :: get_bucket_image_indexes

Get the bucket and image indexes corresponding to the given key.

procedure, private, pass(self) :: hash

Hash the key.

procedure, private, pass(self) :: set_buckets_number

Set buckets number.

procedure, private, pass(self) :: set_caf_dimensions

Set CAF dimensions by means of intrinsic inquiring functions.

procedure, private, pass(self) :: set_homogeneous

Set homogeneity flag.

procedure, private, pass(self) :: synchronize_images

Syncrhonize CAF images.


Functions

private elemental function hash_table_len(self, global) result(length)

Return the number of (actually stored) nodes of the hash table, namely the hash table length.

Arguments

Type IntentOptional AttributesName
type(hash_table), intent(in) :: self

The hash table.

logical, intent(in), optional :: global

Check the global values on all CAF images rather only on the local image.

Return Value integer(kind=I4P)

The hash table length.

private function get_pointer(self, key) result(content)

Return a pointer to a node's content in the hash table.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

class(*), intent(in) :: key

The key.

Return Value class(*), pointer

Content pointer of the queried node.

private function has_key(self, key)

Check if the key is present in the hash table.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

class(*), intent(in) :: key

The key.

Return Value logical

Check result.

private pure function ids(self, global)

Return the minimum and maximum unique key id values actually stored.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

logical, intent(in), optional :: global

Check the global values on all CAF images rather only on the local image.

Return Value integer(kind=I8P) (1:2)

Minimum and maximum id values actually stored.

private elemental function is_homogeneous(self)

Return homogeneity status.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

Return Value logical

Homogeneity status.

private elemental function is_initialized(self)

Return initialization status.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

Return Value logical

Initialization status.

private elemental function hash(self, key) result(bucket)

Hash the key.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

class(*), intent(in) :: key

Key to hash.

Return Value integer(kind=I4P)

Bucket index corresponding to the key.

private pure function is_prime(n) result(is_prime_)

Return true if n is prime accordingly division test, false if n is composite.

Arguments

Type IntentOptional AttributesName
integer(kind=I4P), intent(in) :: n

Number inquired.

Return Value logical

Result of the test.

private pure function find_next_prime(n) result(prime)

Return the next prime after n accordingly division test.

Arguments

Type IntentOptional AttributesName
integer(kind=I4P), intent(in) :: n

Number inquired.

Return Value integer(kind=I4P)

Next prime after n.


Subroutines

private subroutine add_pointer(self, key, content)

Add a node pointer to the hash table.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

class(*), intent(in) :: key

The key.

class(*), intent(in), pointer:: content

The content.

private subroutine add_clone(self, key, content)

Add a node to the hash table cloning content (non pointer add).

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

class(*), intent(in) :: key

The key.

class(*), intent(in) :: content

The content.

private elemental subroutine destroy(self)

Destroy the hash table.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

private subroutine get_clone(self, key, content)

Return a node's content in the hash table by cloning.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

class(*), intent(in) :: key

The key.

class(*), intent(out), allocatable:: content

Content of the queried node.

private subroutine initialize(self, buckets_number, use_prime, homogeneous, typeguard_key, typeguard_content)

Initialize the hash table.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

integer(kind=I4P), intent(in), optional :: buckets_number

Number of buckets for initialize the hash table.

logical, intent(in), optional :: use_prime

If true the buckets number is rendered prime.

logical, intent(in), optional :: homogeneous

If true the hash is supposed to accept only homogeneous nodes.

class(*), intent(in), optional :: typeguard_key

Key type guard (mold) for homogeneous keys check.

class(*), intent(in), optional :: typeguard_content

content type guard (mold) for homogeneous contents check.

private subroutine print_keys(self)

Print the hash table keys.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

private subroutine remove(self, key)

Remove a node from the hash table, given the key.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

class(*), intent(in) :: key

The key.

private subroutine traverse(self, iterator)

Traverse hash table calling the iterator procedure.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash_table.

procedure(key_iterator_interface) :: iterator

The (key) iterator procedure to call for each node.

private subroutine allocate_members(self, typeguard_key, typeguard_content)

Allocate dynamic memory members.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

class(*), intent(in), optional :: typeguard_key

Key type guard (mold) for homogeneous keys check.

class(*), intent(in), optional :: typeguard_content

content type guard (mold) for homogeneous contents check.

private subroutine check_type(self, key, content)

Check type consistency.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

class(*), intent(in) :: key

The key.

class(*), intent(in) :: content

The content.

private pure subroutine get_bucket_image_indexes(self, key, bucket, image)

Get the bucket and image indexes corresponding to the given key.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(in) :: self

The hash table.

class(*), intent(in) :: key

The key.

integer(kind=I4P), intent(out) :: bucket

Bucket index.

integer(kind=I4P), intent(out) :: image

Image index.

private pure subroutine set_buckets_number(self, buckets_number, use_prime)

Set buckets number.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

integer(kind=I4P), intent(in), optional :: buckets_number

Number of buckets for initialize the hash table.

logical, intent(in), optional :: use_prime

If true the buckets number is rendered prime.

private pure subroutine set_caf_dimensions(self)

Set CAF dimensions by means of intrinsic inquiring functions.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

private pure subroutine set_homogeneous(self, homogeneous)

Set homogeneity flag.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

logical, intent(in), optional :: homogeneous

If true the hash is supposed to accept only homogeneous nodes.

private subroutine synchronize_images(self)

Synchronize CAF images.

Arguments

Type IntentOptional AttributesName
class(hash_table), intent(inout) :: self

The hash table.

private elemental subroutine finalize(self)

Finalize the hash table.

Arguments

Type IntentOptional AttributesName
type(hash_table), intent(inout) :: self

The hash table.