dbcsr_data_exists Function

public function dbcsr_data_exists(area) result(valid)

Checks whether a data pointer exists


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

data area

Return Value logical

whether the data pointer exists


Source Code

Source Code

   FUNCTION dbcsr_data_exists(area) RESULT(valid)
      !! Checks whether a data pointer exists

      TYPE(dbcsr_data_obj), INTENT(IN)                   :: area
         !! data area
      LOGICAL                                            :: valid
         !! whether the data pointer exists

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

      INTEGER                                            :: error_handle

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

      IF (careful_mod) THEN
         CALL timeset(routineN, error_handle)
      END IF
      valid = dbcsr_data_valid(area)
      IF (.NOT. valid) &
         DBCSR_ABORT("Data area is invalid.")

      SELECT CASE (area%d%data_type)
      CASE (dbcsr_type_int_4)
         valid = ASSOCIATED(area%d%i4)
      CASE (dbcsr_type_int_8)
         valid = ASSOCIATED(area%d%i8)
      CASE (dbcsr_type_real_4)
         valid = ASSOCIATED(area%d%r_sp)
      CASE (dbcsr_type_real_8)
         valid = ASSOCIATED(area%d%r_dp)
      CASE (dbcsr_type_complex_4)
         valid = ASSOCIATED(area%d%c_sp)
      CASE (dbcsr_type_complex_8)
         valid = ASSOCIATED(area%d%c_dp)
      CASE (dbcsr_type_real_4_2d)
         valid = ASSOCIATED(area%d%r2_sp)
      CASE (dbcsr_type_real_8_2d)
         valid = ASSOCIATED(area%d%r2_dp)
      CASE (dbcsr_type_complex_4_2d)
         valid = ASSOCIATED(area%d%c2_sp)
      CASE (dbcsr_type_complex_8_2d)
         valid = ASSOCIATED(area%d%c2_dp)
      CASE default
         DBCSR_ABORT("Invalid data type.")

      IF (careful_mod) THEN
         CALL timestop(error_handle)
      END IF
   END FUNCTION dbcsr_data_exists