heap_reserve Subroutine

private subroutine heap_reserve(self, n)

Ensure room for at least n entries without further reallocation.

Existing entries are preserved. Capacity never shrinks, so a request smaller than or equal to the current capacity is a no-op.

Type Bound

heap_t

Arguments

Type IntentOptional Attributes Name
class(heap_t), intent(inout) :: self
integer(kind=default_int), intent(in) :: n

Calls

proc~~heap_reserve~~CallsGraph proc~heap_reserve heap_t%heap_reserve proc~grow_int32 grow_int32 proc~heap_reserve->proc~grow_int32 proc~grow_int64 grow_int64 proc~heap_reserve->proc~grow_int64 proc~heap_capacity heap_t%heap_capacity proc~heap_reserve->proc~heap_capacity

Called by

proc~~heap_reserve~~CalledByGraph proc~heap_reserve heap_t%heap_reserve proc~heap_build_from heap_t%heap_build_from proc~heap_build_from->proc~heap_reserve proc~heap_init heap_t%heap_init proc~heap_init->proc~heap_reserve proc~heap_push heap_t%heap_push proc~heap_push->proc~heap_reserve proc~a_star a_star proc~a_star->proc~heap_init proc~a_star->proc~heap_push proc~dijkstra dijkstra proc~dijkstra->proc~heap_init proc~dijkstra->proc~heap_push

Source Code

   subroutine heap_reserve(self, n)
      !! Ensure room for at least `n` entries without further reallocation.
      !!
      !! Existing entries are preserved. Capacity never shrinks, so a request
      !! smaller than or equal to the current capacity is a no-op.
      class(heap_t), intent(inout) :: self
      integer(default_int), intent(in) :: n

      if (n <= self%capacity()) return

      call grow_int64(self%keys, self%n_entries, n)
      call grow_int32(self%payloads, self%n_entries, n)
      call grow_int64(self%insertion, self%n_entries, n)
   end subroutine heap_reserve