ensure_product_wm_cleared Subroutine

private subroutine ensure_product_wm_cleared(this)

Makes sure that the product_wm is cleared.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mm_sched_type), intent(inout) :: this

Source Code

   SUBROUTINE ensure_product_wm_cleared(this)
      !! Makes sure that the product_wm is cleared.
      TYPE(dbcsr_mm_sched_type), INTENT(INOUT)           :: this

      INTEGER                                            :: allocated_datasize, used_datasize

      IF (this%product_wm_cleared) RETURN

      ! The product's data_area could already contain some data.
      ! ( see: keep_product_data in dbcsr_operations.F )
      ! But this data might not occupy all the allocated memory in the data_area.
      ! Since, we don't want to keep track of uninitialized memory we just zero it now.

      used_datasize = this%product_wm_orig_datasize
      allocated_datasize = dbcsr_data_get_size(this%product_wm%data_area)
      CALL dbcsr_data_clear(this%product_wm%data_area, lb=used_datasize + 1, ub=allocated_datasize)
      this%product_wm_cleared = .TRUE.
   END SUBROUTINE ensure_product_wm_cleared