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

Comparing ray/src/hd/rholo3.c (file contents):
Revision 3.20 by gregl, Thu Jan 22 11:25:51 1998 UTC vs.
Revision 3.22 by gwlarson, Wed Jul 8 17:59:58 1998 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ SGI";
5 #endif
6
1   /*
2   * Routines for tracking beam compuatations
3   */
# Line 62 | Line 56 | register PACKHEAD      *clist;
56   int     nents;
57   {
58          int     oldnr;
59 +        register HDBEAMI        *hb;
60          register int    i, n;
61                                  /* look for common members */
62          for (n = 0; n < nents; n++) {
# Line 97 | Line 92 | int    nents;
92                                  /* complete list operations */
93          switch (op) {
94          case BS_NEW:                    /* new computation set */
95 <                listpos = 0;
101 <                lastin = -1;
95 >                listpos = 0; lastin = -1;
96                  if (complen)            /* free old list */
97                          free((char *)complist);
98                  complist = NULL;
# Line 118 | Line 112 | int    nents;
112                                          /* what can't we satisfy? */
113                  for (n = 0; n < nents && clist[n].nr > clist[n].nc; n++)
114                          ;
115 <                if (op == BS_ADJ)
116 <                        nents = n;
115 >                if (op == BS_ADJ) {     /* don't regenerate adjusted beams */
116 >                        for (i = n; i < nents && clist[i].nr > 0; i++)
117 >                                ;
118 >                        nents = i;
119 >                }
120                  if (n) {                /* allocate space for merged list */
121                          PACKHEAD        *newlist;
122                          newlist = (PACKHEAD *)malloc(
# Line 141 | Line 138 | int    nents;
138          default:
139                  error(CONSISTENCY, "bundle_set called with unknown operation");
140          }
141 <        if (outdev != NULL) {           /* load and display beams we have */
142 <                register HDBEAMI        *hb;
143 <
144 <                hb = (HDBEAMI *)malloc(nents*sizeof(HDBEAMI));
145 <                for (i = 0; i < nents; i++) {
146 <                        hb[i].h = hdlist[clist[i].hd];
147 <                        hb[i].b = clist[i].bi;
151 <                }
152 <                hdloadbeams(hb, nents, dispbeam);
153 <                free((char *)hb);
141 >        if (outdev == NULL)             /* nothing to display? */
142 >                return;
143 >                                        /* load and display beams we have */
144 >        hb = (HDBEAMI *)malloc(nents*sizeof(HDBEAMI));
145 >        for (i = 0; i < nents; i++) {
146 >                hb[i].h = hdlist[clist[i].hd];
147 >                hb[i].b = clist[i].bi;
148          }
149 +        hdloadbeams(hb, nents, dispbeam);
150 +        free((char *)hb);
151          return;
152   memerr:
153          error(SYSTEM, "out of memory in bundle_set");
# Line 230 | Line 226 | init_global()                  /* initialize global ray computation *
226                  frac = 1024.*1024.*16384. / (wtotal*sizeof(RAYVAL));
227          while (k--)
228                  complist[k].nr = frac * complist[k].nr;
229 <        listpos = 0; lastin = -1;       /* flag initial sort */
229 >        listpos = 0; lastin = -1;       /* perform initial sort */
230 >        sortcomplist();
231   }
232  
233  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines