dbcsr_switch_data_area Subroutine

public subroutine dbcsr_switch_data_area(matrix, data_area, previous_data_area)

Sets the data area of a matrix

Arguments

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

matrix for which to set the data area

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

data area to set

type(dbcsr_data_obj), intent(out), optional :: previous_data_area

previous data area


Source Code

   SUBROUTINE dbcsr_switch_data_area(matrix, data_area, previous_data_area)
      !! Sets the data area of a matrix

      TYPE(dbcsr_type), INTENT(INOUT)                    :: matrix
         !! matrix for which to set the data area
      TYPE(dbcsr_data_obj), INTENT(IN)                   :: data_area
         !! data area to set
      TYPE(dbcsr_data_obj), INTENT(OUT), OPTIONAL        :: previous_data_area
         !! previous data area

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

      INTEGER                                            :: handle

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

      CALL timeset(routineN, handle)
      IF (PRESENT(previous_data_area)) THEN
         previous_data_area = matrix%data_area
      ELSE
         CALL dbcsr_data_release(matrix%data_area)
      END IF
      matrix%data_area = data_area
      CALL dbcsr_data_hold(matrix%data_area)
      CALL timestop(handle)
   END SUBROUTINE dbcsr_switch_data_area