source: LMDZ.3.3/trunk/libf/dyn3d/sort.F @ 259

Last change on this file since 259 was 259, checked in by lmdz, 23 years ago

Nouveaux programmes pour la creation des etats initiaux et des conditions aux limites. Levan
LF

  • 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(1) , 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.