Fill heap with given values
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_heap_type), | intent(inout) | :: | heap | |||
integer(kind=valt), | intent(in), | DIMENSION(:) | :: | values |
SUBROUTINE dbcsr_heap_fill(heap, values) !! Fill heap with given values TYPE(dbcsr_heap_type), INTENT(INOUT) :: heap INTEGER(KIND=valt), DIMENSION(:), INTENT(IN) :: values INTEGER :: first, i, n n = SIZE(values) DBCSR_ASSERT(heap%n >= n) DO i = 1, n heap%index(i) = i heap%nodes(i)%node%key = i heap%nodes(i)%node%value = values(i) END DO ! Sort from the last full subtree first = get_parent(n) DO i = first, 1, -1 CALL bubble_down(heap, i) END DO END SUBROUTINE dbcsr_heap_fill