iterator_next_area_block Subroutine

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

Gets the next data block encapsulated in an object.

Arguments

TypeIntentOptionalAttributesName
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

type(dbcsr_data_obj), intent(inout) :: block

encapsulated data

logical, intent(out) :: transposed

whether the block data is transposed

integer, intent(out), optional :: block_number

block number logical row size of block logical column size of block logical row offset of block logical column offset of block

integer, intent(out), optional :: row_size

block number logical row size of block logical column size of block logical row offset of block logical column offset of block

integer, intent(out), optional :: col_size

block number logical row size of block logical column size of block logical row offset of block logical column offset of block

integer, intent(out), optional :: row_offset

block number logical row size of block logical column size of block logical row offset of block logical column offset of block

integer, intent(out), optional :: col_offset

block number logical row size of block logical column size of block logical row offset of block logical column offset of block


Contents


Source Code

   SUBROUTINE iterator_next_area_block(iterator, row, column, block, &
                                       transposed, block_number, row_size, col_size, row_offset, col_offset)
      !! Gets the next data block encapsulated in an object.

      TYPE(dbcsr_iterator), INTENT(INOUT)                :: iterator
         !! the iterator
      INTEGER, INTENT(OUT)                               :: row, column
         !! row of the data block
         !! column of the data block
      TYPE(dbcsr_data_obj), INTENT(INOUT)                :: block
         !! encapsulated data
      LOGICAL, INTENT(OUT)                               :: transposed
         !! whether the block data is transposed
      INTEGER, INTENT(OUT), OPTIONAL                     :: block_number, row_size, col_size, &
                                                            row_offset, col_offset
         !! block number
         !! logical row size of block
         !! logical column size of block
         !! logical row offset of block
         !! logical column offset of block

      CHARACTER(len=*), PARAMETER :: routineN = 'iterator_next_area_block'

      INTEGER                                            :: blk_p, block_col_size, block_row_size, &
                                                            bp, csize, error_handle, nze, rsize

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

      IF (careful_mod) CALL timeset(routineN, error_handle)

      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)
         block_row_size = rsize
         block_col_size = csize
         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)
         ! Redirect the encapsulated pointer to the correct pointer here.
         IF (transposed) CALL swap(rsize, csize)
         CALL dbcsr_data_set_pointer(block, rsize, csize, iterator%data_area, &
                                     source_lb=bp)
         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
         IF (PRESENT(block_number)) block_number = 0
      END IF

      IF (careful_mod) CALL timestop(error_handle)

   END SUBROUTINE iterator_next_area_block