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.2 by gwlarson, Tue Nov 10 18:05:41 1998 UTC vs.
Revision 3.7 by greg, Mon Nov 17 02:21:53 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Bundle holodeck beams together into clumps.
6   */
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ SGI";
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 55 | Line 52 | GCOORD *gc;
52          register int    i, j;
53  
54          for (i = 3; i--; ) {
55 <                copystruct(&gci0, gc);
55 >                gci0 = *gc;
56                  gcshifti(&gci0, 0, i-1, hp);
57                  for (j = 3; j--; ) {
58 <                        copystruct(ng+(3*i+j), &gci0);
58 >                        *(ng+(3*i+j)) = gci0;
59                          gcshifti(ng+(3*i+j), gci0.w==gc->w, j-1, hp);
60                  }
61          }
# Line 79 | Line 76 | int    b;
76          bneighrem = 0;
77          for (i = 9; i--; )
78                  for (j = 9; j--; ) {
79 <                        if (i == 4 & j == 4)    /* don't copy starting beam */
79 >                        if ((i == 4) & (j == 4))        /* don't copy starting beam */
80                                  continue;
81                          if (wg0[i].w == wg1[j].w)
82                                  continue;
83 <                        copystruct(bgc, wg0+i);
84 <                        copystruct(bgc+1, wg1+j);
83 >                        *bgc = *(wg0+i);
84 >                        *(bgc+1) = *(wg1+j);
85                          bneighlist[bneighrem++] = hdbindex(hp, bgc);
86   #ifdef DEBUG
87                          if (bneighlist[bneighrem-1] <= 0)
# Line 101 | Line 98 | int    maxcnt, maxsiz;
98   int     (*cf)();
99   {
100          static short    primes[] = {9431,6803,4177,2659,1609,887,587,251,47,1};
101 <        unsigned int4   *bflags;
101 >        uint32  *bflags;
102          int     *bqueue;
103          int     bqlen;
104 <        int4    bqtotal;
104 >        int32   bqtotal;
105          int     bc, bci, bqc, myprime;
106          register int    i;
107                                          /* get clump size */
# Line 113 | Line 110 | int    (*cf)();
110          maxsiz /= sizeof(RAYVAL);
111                                          /* allocate beam queue */
112          bqueue = (int *)malloc(maxcnt*sizeof(int));
113 <        bflags = (unsigned int4 *)calloc((nbeams(hp)>>5)+1,
114 <                        sizeof(unsigned int4));
115 <        if (bqueue == NULL | bflags == NULL)
113 >        bflags = (uint32 *)calloc((nbeams(hp)>>5)+1,
114 >                        sizeof(uint32));
115 >        if ((bqueue == NULL) | (bflags == NULL))
116                  error(SYSTEM, "out of memory in clumpbeams");
117                                          /* mark empty beams as done */
118          for (i = nbeams(hp); i > 0; i--)
# Line 130 | Line 127 | int    (*cf)();
127                                          /* add each input beam and neighbors */
128          for (bc = bci = nbeams(hp); bc > 0; bc--,
129                          bci += bci>myprime ? -myprime : nbeams(hp)-myprime) {
130 <                if (isset(bflags, bci))
130 >                if (issetfl(bflags, bci))
131                          continue;
132                  bqueue[0] = bci;                /* initialize queue */
133                  bqlen = 1;
# Line 141 | Line 138 | int    (*cf)();
138                                                  /* add neighbors until full */
139                          for (i = firstneigh(hp,bqueue[bqc]); i > 0;
140                                          i = nextneigh()) {
141 <                                if (isset(bflags, i))   /* done already? */
141 >                                if (issetfl(bflags, i)) /* done already? */
142                                          continue;
143                                  bqueue[bqlen++] = i;    /* add it */
144                                  bqtotal += bnrays(hp, i);
# Line 156 | Line 153 | int    (*cf)();
153                  (*cf)(hp, bqueue, bqlen);       /* transfer clump */
154          }
155                                          /* all done; clean up */
156 <        free((char *)bqueue);
157 <        free((char *)bflags);
156 >        free((void *)bqueue);
157 >        free((void *)bflags);
158   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines