heap_clear Subroutine

private subroutine heap_clear(self)

Remove every entry but keep the allocated storage for reuse.

The insertion counter is reset as well, so a cleared heap behaves exactly like a freshly initialised one with the same capacity and the same min/max ordering.

Type Bound

heap_t

Arguments

Type IntentOptional Attributes Name
class(heap_t), intent(inout) :: self

Source Code

   subroutine heap_clear(self)
      !! Remove every entry but keep the allocated storage for reuse.
      !!
      !! The insertion counter is reset as well, so a cleared heap behaves
      !! exactly like a freshly initialised one with the same capacity and the
      !! same min/max ordering.
      class(heap_t), intent(inout) :: self

      self%n_entries = 0
      self%n_pushed = 0_int64
   end subroutine heap_clear