can_quickly_finalize Function

private function can_quickly_finalize(matrix) result(quick)

Checks whether the matrix can be finalized with minimal copying.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(in) :: matrix

matrix to check

Return Value logical

whether matrix can be quickly finalized


Source Code

   FUNCTION can_quickly_finalize(matrix) RESULT(quick)
      !! Checks whether the matrix can be finalized with minimal copying.

      TYPE(dbcsr_type), INTENT(IN)                       :: matrix
         !! matrix to check
      LOGICAL                                            :: quick
         !! whether matrix can be quickly finalized

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

      IF (ASSOCIATED(matrix%wms)) THEN
         quick = matrix%nblks .EQ. 0
         quick = quick .AND. SIZE(matrix%wms) .EQ. 1 .AND. &
                 .NOT. dbcsr_wm_use_mutable(matrix%wms(1))
         IF (quick) THEN
            quick = quick .AND. &
                    dbcsr_memtype_equal( &
                    dbcsr_data_get_memory_type(matrix%wms(1)%data_area), &
                    dbcsr_data_get_memory_type(matrix%data_area))
            quick = quick .AND. &
                    ASSOCIATED(matrix%wms(1)%row_i)
            quick = quick .AND. &
                    (matrix%wms(1)%datasize_after_filtering .LT. 0 .OR. &
                     matrix%wms(1)%datasize .EQ. matrix%wms(1)%datasize_after_filtering)
         END IF
      ELSE
         quick = .FALSE.
      END IF
   END FUNCTION can_quickly_finalize