iterator_next_1d_block_c Subroutine

private subroutine iterator_next_1d_block_c(iterator, row, column, block, transposed, block_number, row_size, col_size, row_offset, col_offset)

Gets the next data block, single/double precision real/complex

Arguments

Type IntentOptional Attributes Name
type(dbcsr_iterator), intent(inout) :: iterator

the iterator

integer, intent(out) :: row

row of the data block column of the data block

integer, intent(out) :: column

row of the data block column of the data block

complex(kind=real_4), DIMENSION(:), POINTER :: block

pointer to the data block

logical, intent(out) :: transposed

whether the block data is transposed

integer, intent(out), optional :: block_number

block number

integer, intent(out), optional :: row_size

logical row size of block logical column size of block

integer, intent(out), optional :: col_size

logical row size of block logical column size of block

integer, intent(out), optional :: row_offset

logical row size of block logical column size of block

integer, intent(out), optional :: col_offset

logical row size of block logical column size of block


Source Code

      SUBROUTINE iterator_next_1d_block_c (iterator, row, column, block, &
                                                       transposed, block_number, row_size, col_size, row_offset, col_offset)
     !! Gets the next data block, single/double precision real/complex

         TYPE(dbcsr_iterator), INTENT(INOUT)      :: iterator
        !! the iterator
         INTEGER, INTENT(OUT)                     :: row, column
        !! row of the data block
        !! column of the data block
         COMPLEX(kind=real_4), DIMENSION(:), POINTER :: block
        !! pointer to the data block
         LOGICAL, INTENT(OUT)                     :: transposed
        !! whether the block data is transposed
         INTEGER, INTENT(OUT), OPTIONAL           :: block_number
        !! block number
         INTEGER, INTENT(OUT), OPTIONAL           :: row_size, col_size, &
                                                     row_offset, col_offset
        !! logical row size of block
        !! logical column size of block

         INTEGER                                  :: blk_p, bp, csize, nze, rsize

!   ---------------------------------------------------------------------------
! If we're pointing to a valid block, return that block.

         IF (iterator%pos .LE. iterator%nblks &
             .AND. iterator%pos .NE. 0) THEN
            row = iterator%row
            column = iterator%col_i(iterator%pos)
            IF (iterator%transpose) CALL swap(row, column)
            blk_p = iterator%blk_p(iterator%pos)
            transposed = blk_p .LT. 0
            bp = ABS(blk_p)
            rsize = iterator%row_size
            csize = iterator%cbs(column)
            nze = rsize*csize
            IF (PRESENT(row_size)) row_size = rsize
            IF (PRESENT(col_size)) col_size = csize
            IF (PRESENT(row_offset)) row_offset = iterator%row_offset
            IF (PRESENT(col_offset)) col_offset = iterator%coff(column)
            CALL dbcsr_get_data(iterator%data_area, block, &
                                lb=bp, ub=bp + nze - 1)
            IF (PRESENT(block_number)) block_number = iterator%pos
            ! Move to the next non-deleted position.
            CALL iterator_advance(iterator)
            CALL update_row_info(iterator)
         ELSE
            row = 0
            column = 0
            NULLIFY (block)
            IF (PRESENT(block_number)) block_number = 0
         END IF
      END SUBROUTINE iterator_next_1d_block_c