source: LMDZ6/branches/Amaury_dev/libf/obsolete/sort.f90 @ 5153

Last change on this file since 5153 was 5117, checked in by abarral, 2 months ago

rename modules properly lmdz_*
move some unused files to obsolete/
(lint) uppercase fortran keywords

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 588 bytes
Line 
1! $Header$
2
3!
4!
5SUBROUTINE sort(n, d)
6  !
7  ! P.Le Van
8  !
9  !...  cette routine met le tableau d  dans l'ordre croissant  ....
10  !c   ( pour avoir l'ordre decroissant,il suffit de remplacer l'instruc
11  !  tion  situee + bas  IF(d(j).LE.p)  THEN     par
12  !                       IF(d(j).GE.p)  THEN
13  !
14
15  INTEGER :: n
16  REAL :: d(n), p
17  INTEGER :: i, j, k
18
19  DO i = 1, n - 1
20    k = i
21    p = d(i)
22    DO j = i + 1, n
23      IF(d(j)<=p) THEN
24        k = j
25        p = d(j)
26      ENDIF
27    ENDDO
28
29    IF(k/=i) THEN
30      d(k) = d(i)
31      d(i) = p
32    ENDIF
33  ENDDO
34
35END SUBROUTINE sort
Note: See TracBrowser for help on using the repository browser.