dbcsr_datatype_sizeof Function

public function dbcsr_datatype_sizeof(datatype) result(size)

Helper-routine, returns size of given datatype in terms of bytes.

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: datatype

Return Value integer


Contents

Source Code


Source Code

   FUNCTION dbcsr_datatype_sizeof(datatype) RESULT(size)
      !! Helper-routine, returns size of given datatype in terms of bytes.
      INTEGER, INTENT(IN)                                :: datatype
      INTEGER                                            :: size

      size = 0
      SELECT CASE (datatype)
      CASE (dbcsr_type_int_4)
         size = int_4_size
      CASE (dbcsr_type_int_8)
         size = int_8_size
      CASE (dbcsr_type_real_4)
         size = real_4_size
      CASE (dbcsr_type_real_8)
         size = real_8_size
      CASE (dbcsr_type_complex_4)
         size = (2*real_4_size)
      CASE (dbcsr_type_complex_8)
         size = (2*real_8_size)
      CASE default
         DBCSR_ABORT("Invalid data type")
      END SELECT
   END FUNCTION dbcsr_datatype_sizeof