dbcsr_get_data_size_used Function

public function dbcsr_get_data_size_used(matrix) result(data_size)

Count actual data storage used for matrix data.

Arguments

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

Count data of this matrix

Return Value integer

Data size used by matrix


Source Code

   FUNCTION dbcsr_get_data_size_used(matrix) RESULT(data_size)
      !! Count actual data storage used for matrix data.

      TYPE(dbcsr_type), INTENT(IN)                       :: matrix
         !! Count data of this matrix
      INTEGER                                            :: data_size
         !! Data size used by matrix

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

      INTEGER                                            :: blk, col, error_handle, nze, row
      INTEGER, DIMENSION(:), POINTER                     :: col_blk_sizes, row_blk_sizes

!type(dbcsr_iterator_type) :: iter
!   ---------------------------------------------------------------------------

      CALL timeset(routineN, error_handle)
      row_blk_sizes => dbcsr_row_block_sizes(matrix)
      col_blk_sizes => dbcsr_col_block_sizes(matrix)
      data_size = 0
!$OMP     DO
      DO row = 1, matrix%nblkrows_total
         DO blk = matrix%row_p(row) + 1, matrix%row_p(row + 1)
            col = matrix%col_i(blk)
            IF (matrix%blk_p(blk) .NE. 0) THEN
               nze = row_blk_sizes(row)*col_blk_sizes(col)
               data_size = data_size + nze
            END IF
         END DO
      END DO
!$OMP     END DO
      CALL timestop(error_handle)
   END FUNCTION dbcsr_get_data_size_used