dbcsr_data_zero Subroutine

public subroutine dbcsr_data_zero(area, lb, ub)

Clears a part of the data area

Note

Optimized for clearing big 1-D data areas from all data types.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_data_obj), intent(inout) :: area

data area

integer, intent(in), DIMENSION(:) :: lb
integer, intent(in), DIMENSION(:) :: ub

Source Code

   SUBROUTINE dbcsr_data_zero(area, lb, ub)
      !! Clears a part of the data area
      !! @note Optimized for clearing big 1-D data areas from all data types.

      TYPE(dbcsr_data_obj), INTENT(INOUT)                :: area
         !! data area
      INTEGER, DIMENSION(:), INTENT(in)                  :: lb, ub

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

      INTEGER                                            :: error_handle

      REAL(KIND=real_4), DIMENSION(:), POINTER, CONTIGUOUS :: r_sp
      REAL(KIND=real_8), DIMENSION(:), POINTER, CONTIGUOUS :: r_dp
      COMPLEX(KIND=real_4), DIMENSION(:), POINTER, CONTIGUOUS :: c_sp
      COMPLEX(KIND=real_8), DIMENSION(:), POINTER, CONTIGUOUS :: c_dp

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

      IF (careful_mod) THEN
         CALL timeset(routineN, error_handle)
      END IF

      SELECT CASE (area%d%data_type)
      CASE (dbcsr_type_real_4)
         r_sp => area%d%r_sp(lb(1):ub(1))
         CALL memory_zero(r_sp, SIZE(r_sp))
      CASE (dbcsr_type_real_8)
         r_dp => area%d%r_dp(lb(1):ub(1))
         CALL memory_zero(r_dp, SIZE(r_dp))
      CASE (dbcsr_type_complex_4)
         c_sp => area%d%c_sp(lb(1):ub(1))
         CALL memory_zero(c_sp, SIZE(c_sp))
      CASE (dbcsr_type_complex_8)
         c_dp => area%d%c_dp(lb(1):ub(1))
         CALL memory_zero(c_dp, SIZE(c_dp))
      CASE (dbcsr_type_real_4_2d)
         area%d%r2_sp(lb(1):ub(1), lb(2):ub(2)) = 0.0_real_4
      CASE (dbcsr_type_real_8_2d)
         area%d%r2_dp(lb(1):ub(1), lb(2):ub(2)) = 0.0_real_8
      CASE (dbcsr_type_complex_4_2d)
         area%d%c2_sp(lb(1):ub(1), lb(2):ub(2)) = 0.0_real_4
      CASE (dbcsr_type_complex_8_2d)
         area%d%c2_dp(lb(1):ub(1), lb(2):ub(2)) = 0.0_real_8
      CASE default
         DBCSR_ABORT("Invalid data type.")
      END SELECT

      IF (area%d%memory_type%acc_devalloc) &
         DBCSR_ABORT("not yet supported for acc devmem")

      IF (careful_mod) THEN
         CALL timestop(error_handle)
      END IF
   END SUBROUTINE dbcsr_data_zero