dbcsr_clearfrom_index_array Subroutine

public subroutine dbcsr_clearfrom_index_array(matrix, slot)

Removes data from the index.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(inout) :: matrix

bcsr matrix

integer, intent(in) :: slot

which index array to remove (e.g., dbcsr_slot_row_blk_sizes)


Source Code

   SUBROUTINE dbcsr_clearfrom_index_array(matrix, slot)
      !! Removes data from the index.

      TYPE(dbcsr_type), INTENT(INOUT)                    :: matrix
         !! bcsr matrix
      INTEGER, INTENT(IN)                                :: slot
         !! which index array to remove (e.g., dbcsr_slot_row_blk_sizes)

      CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_clearfrom_index_array', &
                                     routineP = moduleN//':'//routineN

      INTEGER                                            :: space
      INTEGER, DIMENSION(5)                              :: max_extents

!   ---------------------------------------------------------------------------

      IF (.NOT. ASSOCIATED(matrix%index)) &
         DBCSR_ABORT("Index must be preallocated.")
      IF (UBOUND(matrix%index, 1) < dbcsr_num_slots) &
         DBCSR_ABORT("Actual index size less than declared size")
      IF (debug_mod) WRITE (*, *) routineP//' index', &
         matrix%index(:dbcsr_num_slots)
      ! Clear index entry pointer
      matrix%index(slot) = 1
      matrix%index(slot + 1) = 0
      CALL dbcsr_repoint_index(matrix, slot)
      ! Update the declared index size
      max_extents = (/ &
                    matrix%index(dbcsr_slot_row_p + 1), &
                    matrix%index(dbcsr_slot_col_i + 1), &
                    matrix%index(dbcsr_slot_blk_p + 1), &
                    matrix%index(dbcsr_slot_thr_c + 1), &
                    matrix%index(dbcsr_slot_coo_l + 1)/)
      space = MAX(MAXVAL(max_extents), dbcsr_num_slots)
      matrix%index(dbcsr_slot_size) = space
   END SUBROUTINE dbcsr_clearfrom_index_array