dict_str_i4_init Subroutine

private subroutine dict_str_i4_init(dict, initial_capacity)

Allocates the internal data-structures of the given dictionary.

Arguments

TypeIntentOptionalAttributesName
type(dict_str_i4_type), intent(inout) :: dict
integer, intent(in), optional :: initial_capacity

The initial size of the internal array (default=11).


Contents

Source Code


Source Code

      SUBROUTINE dict_str_i4_init(dict, initial_capacity)
      !! Allocates the internal data-structures of the given dictionary.

         TYPE(dict_str_i4_type), intent(inout)  :: dict
         INTEGER, INTENT(in), OPTIONAL                         :: initial_capacity
         !! The initial size of the internal array (default=11).

         INTEGER :: initial_capacity_
         initial_capacity_ = 11
         IF (PRESENT(initial_capacity)) initial_capacity_ = initial_capacity

         IF (initial_capacity_ < 1) &
            DBCSR_ABORT("dict_str_i4_init: initial_capacity < 1")

         IF (ASSOCIATED(dict%buckets)) &
            DBCSR_ABORT("dict_str_i4_init: dictionary is already initialized.")

         ALLOCATE (dict%buckets(initial_capacity_))
         dict%size = 0

      END SUBROUTINE dict_str_i4_init