dbcsr_data_get_size Function

public function dbcsr_data_get_size(area) result(data_size)

Returns the allocated data size

Arguments

TypeIntentOptionalAttributesName
type(dbcsr_data_obj), intent(in) :: area

data area

Return Value integer

size of data


Contents

Source Code


Source Code

   FUNCTION dbcsr_data_get_size(area) RESULT(data_size)
      !! Returns the allocated data size

      TYPE(dbcsr_data_obj), INTENT(IN)                   :: area
         !! data area
      INTEGER                                            :: data_size
         !! size of data

      data_size = 0
      IF (ASSOCIATED(area%d)) THEN
         SELECT CASE (area%d%data_type)
         CASE (dbcsr_type_int_4)
            IF (ASSOCIATED(area%d%i4)) &
               data_size = SIZE(area%d%i4)
         CASE (dbcsr_type_int_8)
            IF (ASSOCIATED(area%d%i8)) &
               data_size = SIZE(area%d%i8)
         CASE (dbcsr_type_real_8)
            IF (ASSOCIATED(area%d%r_dp)) &
               data_size = SIZE(area%d%r_dp)
         CASE (dbcsr_type_real_4)
            IF (ASSOCIATED(area%d%r_sp)) &
               data_size = SIZE(area%d%r_sp)
         CASE (dbcsr_type_complex_8)
            IF (ASSOCIATED(area%d%c_dp)) &
               data_size = SIZE(area%d%c_dp)
         CASE (dbcsr_type_complex_4)
            IF (ASSOCIATED(area%d%c_sp)) &
               data_size = SIZE(area%d%c_sp)
         CASE (dbcsr_type_real_8_2d)
            IF (ASSOCIATED(area%d%r2_dp)) &
               data_size = SIZE(area%d%r2_dp)
         CASE (dbcsr_type_real_4_2d)
            IF (ASSOCIATED(area%d%r2_sp)) &
               data_size = SIZE(area%d%r2_sp)
         CASE (dbcsr_type_complex_8_2d)
            IF (ASSOCIATED(area%d%c2_dp)) &
               data_size = SIZE(area%d%c2_dp)
         CASE (dbcsr_type_complex_4_2d)
            IF (ASSOCIATED(area%d%c2_sp)) &
               data_size = SIZE(area%d%c2_sp)
         CASE default
            DBCSR_ABORT("Incorrect data type")
         END SELECT
      ELSE
         DBCSR_WARN("Uninitialized data area")
         data_size = 0
      END IF
   END FUNCTION dbcsr_data_get_size