dbcsr_heap_reset_node Subroutine

public subroutine dbcsr_heap_reset_node(heap, key, value)

Changes the value of the heap element with given key and rebalances the heap.

Arguments

TypeIntentOptionalAttributesName
type(dbcsr_heap_type), intent(inout) :: heap
integer(kind=keyt), intent(in) :: key
integer(kind=valt), intent(in) :: value

Contents

Source Code


Source Code

   SUBROUTINE dbcsr_heap_reset_node(heap, key, value)
      !! Changes the value of the heap element with given key and
      !! rebalances the heap.

      TYPE(dbcsr_heap_type), INTENT(INOUT)               :: heap
      INTEGER(KIND=keyt), INTENT(IN)                     :: key
      INTEGER(KIND=valt), INTENT(IN)                     :: value

      INTEGER                                            :: n, new_pos

      DBCSR_ASSERT(heap%n > 0)

      n = heap%index(key)
      DBCSR_ASSERT(heap%nodes(n)%node%key == key)
      heap%nodes(n)%node%value = value
      CALL bubble_up(heap, n, new_pos)
      CALL bubble_down(heap, new_pos)
   END SUBROUTINE dbcsr_heap_reset_node