source: LMDZ.3.3/tags/IPSL-CM4_LJ27/libf/dyn3d/sort.F @ 492

Last change on this file since 492 was 492, checked in by (none), 20 years ago

This commit was manufactured by cvs2svn to create tag
'IPSL-CM4_LJ27'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 631 bytes
Line 
1C
2C $Header$
3C
4      SUBROUTINE sort(n,d)
5c
6c     P.Le Van
7c     
8c...  cette routine met le tableau d  dans l'ordre croissant  ....
9cc   ( pour avoir l'ordre decroissant,il suffit de remplacer l'instruc
10c      tion  situee + bas  IF(d(j).LE.p)  THEN     par
11c                           IF(d(j).GE.p)  THEN
12c
13
14      INTEGER n
15      REAL d(n) , p
16      INTEGER i,j,k
17
18      DO i=1,n-1
19        k=i
20        p=d(i)
21        DO j=i+1,n
22         IF(d(j).LE.p) THEN
23           k=j
24           p=d(j)
25         ENDIF
26        ENDDO
27
28       IF(k.ne.i) THEN
29         d(k)=d(i)
30         d(i)=p
31       ENDIF
32      ENDDO
33
34       RETURN
35       END
Note: See TracBrowser for help on using the repository browser.