Skip to content
Snippets Groups Projects

Draft: Add missing subroutines from libgridman

Open Yen-Chen Chen requested to merge support_gridman into master
+ 23
0
@@ -44,6 +44,7 @@ MODULE mo_util_sort
END INTERFACE swap
INTERFACE insertion_sort
MODULE PROCEDURE insertion_sort_permutation_int
MODULE PROCEDURE insertion_sort_int
END INTERFACE insertion_sort
@@ -686,6 +687,28 @@ CONTAINS
END SUBROUTINE quicksort_string
SUBROUTINE insertion_sort_permutation_int(a, permutation)
INTEGER, INTENT(INOUT) :: a(:)
INTEGER, INTENT(INOUT) :: permutation(:) !< (optional) permutation of indices
INTEGER :: t, h, t_p
INTEGER :: i, n
n = SIZE(a)
DO i = 2, n
t = a(i)
t_p = permutation(i)
DO h = i - 1, 1, -1
IF (t >= a(h)) EXIT
a(h + 1) = a(h)
permutation(h+1) = permutation(h)
END DO
a(h + 1) = t
permutation(h + 1) = t_p
END DO
END SUBROUTINE insertion_sort_permutation_int
SUBROUTINE insertion_sort_int(a)
INTEGER, INTENT(INOUT) :: a(:)
Loading