File: pcchna.f

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (42 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
      subroutine pcchna(i0,lp,ls,m,n,pan,pani,pile)
      implicit integer (a-z)
      dimension lp(*),ls(m),pani(n),pan(n),pile(n)
      infe=32700
      if (i0 .lt. 0 .or. i0 .gt. n) then
         call erro('bad internal node number')
         return
      endif
      do 10 i=1,n
         pani(i)=infe
         pan(i)=-infe
         pile(i)=0
 10   continue
      top=0
      bottom=0
      pani(i0)=0
      pan(i0)=0
      j=i0
 100  continue
      if(lp(j).eq.lp(j+1))goto 120
      do 110 ll=lp(j),lp(j+1)-1
         i=ls(ll)
         if(pan(i).ge.0)goto 110
         pani(i)=pani(j)+1
         pan(i)=j
         top=top+1
         pile(top)=i
 110  continue
 120  continue
      bottom=bottom + 1
      if(bottom.gt.top) go to 999
      j=pile(bottom)
      goto 100
 999  continue
      do 20,i=1,n
         if (pani(i) .eq. infe) then
            pani(i)=-1
         endif
 20   continue
      end