dbcsr_iterator_seek Subroutine

private subroutine dbcsr_iterator_seek(iterator, row)

Places the iterator to the desired row.

Arguments

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

the iterator

integer, intent(in) :: row

seek to this row


Source Code

   SUBROUTINE dbcsr_iterator_seek(iterator, row)
      !! Places the iterator to the desired row.

      TYPE(dbcsr_iterator), INTENT(INOUT)                :: iterator
         !! the iterator
      INTEGER, INTENT(in)                                :: row
         !! seek to this row

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

      INTEGER                                            :: error_handle

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

      CALL timeset(routineN, error_handle)
      IF (iterator%nblks .GT. 0 .AND. row .LE. iterator%nblkrows_total) THEN
         iterator%row = row
         ! This line is replaced because iterator_advance increments the block
         ! number
         !iterator%pos = iterator%row_p(row)+1
         iterator%pos = iterator%row_p(row) ! +1-1
         CALL iterator_advance(iterator)
         CALL update_row_info(iterator)
      ELSE
         iterator%row = 0
         iterator%pos = 0
      END IF
      CALL timestop(error_handle)
   END SUBROUTINE dbcsr_iterator_seek