ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/clumpbeams.c
(Generate patch)

Comparing ray/src/hd/clumpbeams.c (file contents):
Revision 3.6 by schorsch, Sun Jul 27 22:12:02 2003 UTC vs.
Revision 3.8 by schorsch, Thu Jan 1 11:21:55 2004 UTC

# Line 8 | Line 8 | static const char      RCSid[] = "$Id$";
8   #include "holo.h"
9  
10   #define flgop(p,i,op)           ((p)[(i)>>5] op (1L<<((i)&0x1f)))
11 < #define isset(p,i)              flgop(p,i,&)
11 > #define issetfl(p,i)            flgop(p,i,&)
12   #define setfl(p,i)              flgop(p,i,|=)
13   #define clrfl(p,i)              flgop(p,i,&=~)
14  
# Line 17 | Line 17 | static int     bneighrem;
17  
18   #define nextneigh()     (bneighrem<=0 ? 0 : bneighlist[--bneighrem])
19  
20 + static void gcshifti(GCOORD *gc, int ia, int di, HOLO *hp);
21 + static void mkneighgrid(GCOORD  ng[3*3], HOLO   *hp, GCOORD     *gc);
22 + static int firstneigh(HOLO      *hp, int        b);
23  
24 < gcshifti(gc, ia, di, hp)        /* shift cell row or column */
25 < register GCOORD *gc;
26 < int     ia, di;
27 < register HOLO   *hp;
24 >
25 >
26 > static void
27 > gcshifti(       /* shift cell row or column */
28 >        register GCOORD *gc,
29 >        int     ia,
30 >        int     di,
31 >        register HOLO   *hp
32 > )
33   {
34          int     nw;
35  
# Line 43 | Line 51 | register HOLO  *hp;
51   }
52  
53  
54 < mkneighgrid(ng, hp, gc)         /* compute neighborhood for grid cell */
55 < GCOORD  ng[3*3];
56 < HOLO    *hp;
57 < GCOORD  *gc;
54 > static void
55 > mkneighgrid(            /* compute neighborhood for grid cell */
56 >        GCOORD  ng[3*3],
57 >        HOLO    *hp,
58 >        GCOORD  *gc
59 > )
60   {
61          GCOORD  gci0;
62          register int    i, j;
# Line 63 | Line 73 | GCOORD *gc;
73  
74  
75   static int
76 < firstneigh(hp, b)               /* initialize neighbor list and return first */
77 < HOLO    *hp;
78 < int     b;
76 > firstneigh(             /* initialize neighbor list and return first */
77 >        HOLO    *hp,
78 >        int     b
79 > )
80   {
81          GCOORD  wg0[9], wg1[9], bgc[2];
82          int     i, j;
# Line 92 | Line 103 | int    b;
103   }
104  
105  
106 < clumpbeams(hp, maxcnt, maxsiz, cf)      /* clump beams from hinp */
107 < register HOLO   *hp;
108 < int     maxcnt, maxsiz;
109 < int     (*cf)();
106 > extern void
107 > clumpbeams(     /* clump beams from hinp */
108 >        register HOLO   *hp,
109 >        int     maxcnt,
110 >        int     maxsiz,
111 >        int     (*cf)(HOLO *hp, int *bqueue, int bqlen)
112 > )
113   {
114          static short    primes[] = {9431,6803,4177,2659,1609,887,587,251,47,1};
115          uint32  *bflags;
# Line 127 | Line 141 | int    (*cf)();
141                                          /* add each input beam and neighbors */
142          for (bc = bci = nbeams(hp); bc > 0; bc--,
143                          bci += bci>myprime ? -myprime : nbeams(hp)-myprime) {
144 <                if (isset(bflags, bci))
144 >                if (issetfl(bflags, bci))
145                          continue;
146                  bqueue[0] = bci;                /* initialize queue */
147                  bqlen = 1;
# Line 138 | Line 152 | int    (*cf)();
152                                                  /* add neighbors until full */
153                          for (i = firstneigh(hp,bqueue[bqc]); i > 0;
154                                          i = nextneigh()) {
155 <                                if (isset(bflags, i))   /* done already? */
155 >                                if (issetfl(bflags, i)) /* done already? */
156                                          continue;
157                                  bqueue[bqlen++] = i;    /* add it */
158                                  bqtotal += bnrays(hp, i);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines