stack_sort Subroutine

private subroutine stack_sort(params_in, params_out, stack_size)

Sort stack entries with respect to the c_id.

Arguments

Type IntentOptional Attributes Name
integer, intent(in), DIMENSION(dbcsr_ps_width, stack_size) :: params_in
integer, intent(out), DIMENSION(dbcsr_ps_acc_width, stack_size) :: params_out
integer, intent(in) :: stack_size

Source Code

   SUBROUTINE stack_sort(params_in, params_out, stack_size)
      !! Sort stack entries with respect to the c_id.
      INTEGER, INTENT(IN)                                :: stack_size
      INTEGER, &
         DIMENSION(dbcsr_ps_acc_width, stack_size), &
         INTENT(OUT)                                     :: params_out
      INTEGER, DIMENSION(dbcsr_ps_width, stack_size), &
         INTENT(IN)                                      :: params_in

      INTEGER                                            :: i
      INTEGER, DIMENSION(stack_size)                     :: c_sort, c_sort_ind

! sort by the C-blocks

      c_sort = params_in(6, :stack_size)
      CALL sort(c_sort, stack_size, c_sort_ind)
      DO i = 1, stack_size
         params_out(1:3, i) = params_in(4:6, c_sort_ind(i))
      END DO

   END SUBROUTINE stack_sort