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.42 by greg, Tue Jun 8 19:48:30 2004 UTC vs.
Revision 3.45 by greg, Tue Jan 21 22:30:01 2025 UTC

# Line 11 | Line 11 | static const char      RCSid[] = "$Id$";
11   #define NFRAG2CHUNK     4096    /* number of fragments to start chunking */
12   #endif
13  
14 + #ifndef MAXADISK
15 + #define MAXADISK        10240.  /* maximum holodeck size (Megs) for ambient */
16 + #endif
17 +
18   #ifndef abs
19   #define abs(x)          ((x) > 0 ? (x) : -(x))
20   #endif
# Line 38 | Line 42 | static void dispbeam(BEAM      *b, HDBEAMI     *hb);
42  
43   static int
44   beamcmp(b0, b1)                         /* comparison for compute order */
45 < register PACKHEAD       *b0, *b1;
45 > PACKHEAD        *b0, *b1;
46   {
47          BEAMI   *bip0, *bip1;
48 <        register long   c;
48 >        long    c;
49                                          /* first check desired quantities */
50          if (chunkycmp)
51                  c = rchunk(b1->nr)*(rchunk(b0->nc)+1L) -
# Line 71 | Line 75 | register PACKHEAD      *b0, *b1;
75  
76   int
77   beamidcmp(b0, b1)                       /* comparison for beam searching */
78 < register PACKHEAD       *b0, *b1;
78 > PACKHEAD        *b0, *b1;
79   {
80 <        register int    c = b0->hd - b1->hd;
80 >        int     c = b0->hd - b1->hd;
81  
82          if (c) return(c);
83          return(b0->bi - b1->bi);
# Line 82 | Line 86 | register PACKHEAD      *b0, *b1;
86  
87   static void
88   dispbeam(                               /* display a holodeck beam */
89 <        register BEAM   *b,
90 <        register HDBEAMI        *hb
89 >        BEAM    *b,
90 >        HDBEAMI *hb
91   )
92   {
93          static int      n = 0;
# Line 112 | Line 116 | dispbeam(                              /* display a holodeck beam */
116   }
117  
118  
119 < extern void
119 > void
120   bundle_set(     /* bundle set operation */
121          int     op,
122          PACKHEAD        *clist,
# Line 121 | Line 125 | bundle_set(    /* bundle set operation */
125   {
126          int     oldnr, n;
127          HDBEAMI *hbarr;
128 <        register PACKHEAD       *csm;
129 <        register int    i;
128 >        PACKHEAD        *csm;
129 >        int     i;
130                                          /* search for common members */
131          for (csm = clist+nents; csm-- > clist; )
132                  csm->nc = -1;
# Line 243 | Line 247 | beamvolume(    /* compute approximate volume of a beam */
247          FVECT   cp[4], edgeA, edgeB, cent[2];
248          FVECT   crossp[2], diffv;
249          double  vol[2];
250 <        register int    i;
250 >        int     i;
251                                          /* get grid coordinates */
252          if (!hdbcoord(gc, hp, bi))
253                  error(CONSISTENCY, "bad beam index in beamvolume");
# Line 270 | Line 274 | beamvolume(    /* compute approximate volume of a beam */
274   static void
275   ambient_list(void)                      /* compute ambient beam list */
276   {
277 <        int32   wtotal, minrt;
277 >        unsigned long   wtotal;
278 >        int32   minrt;
279          double  frac;
280          int     i;
281 <        register int    j, k;
281 >        int     j, k;
282  
283          complen = 0;
284          for (j = 0; hdlist[j] != NULL; j++)
# Line 283 | Line 288 | ambient_list(void)                     /* compute ambient beam list */
288                                          /* compute beam weights */
289          k = 0; wtotal = 0;
290          for (j = 0; hdlist[j] != NULL; j++) {
291 +                                        /* 512. arbitrary -- adjusted below */
292                  frac = 512. * VLEN(hdlist[j]->wg[0]) *
293                                  VLEN(hdlist[j]->wg[1]) *
294                                  VLEN(hdlist[j]->wg[2]);
# Line 298 | Line 304 | ambient_list(void)                     /* compute ambient beam list */
304          if (vdef(DISKSPACE))
305                  frac = 1024.*1024.*vflt(DISKSPACE) / (wtotal*sizeof(RAYVAL));
306          else
307 <                frac = 1024.*1024.*2048. / (wtotal*sizeof(RAYVAL));
308 <        minrt = .02*frac*wtotal/complen + .5;   /* heuristic mimimum */
307 >                frac = 1024.*1024.*MAXADISK / (wtotal*sizeof(RAYVAL));
308 >        minrt = .02*frac*wtotal/complen + 1.1;  /* heuristic mimimum */
309          if (minrt > RPACKSIZ)
310                  minrt = RPACKSIZ;
311          for (k = complen; k--; )
# Line 335 | Line 341 | view_list(                     /* assign beam priority from view list */
341   }
342  
343  
344 < extern void
344 > void
345   init_global(void)                       /* initialize global ray computation */
346   {
347                                          /* free old list and empty queue */
# Line 357 | Line 363 | init_global(void)                      /* initialize global ray computati
363  
364   static void
365   mergeclists(    /* merge two sorted lists */
366 <        register PACKHEAD       *cdest,
367 <        register PACKHEAD       *cl1,
366 >        PACKHEAD        *cdest,
367 >        PACKHEAD        *cl1,
368          int     n1,
369 <        register PACKHEAD       *cl2,
369 >        PACKHEAD        *cl2,
370          int     n2
371   )
372   {
373 <        register int    cmp;
373 >        int     cmp;
374  
375          while (n1 | n2) {
376                  if (!n1) cmp = 1;
# Line 387 | Line 393 | sortcomplist(void)                     /* fix our list order */
393   {
394          PACKHEAD        *list2;
395          int     listlen;
396 <        register int    i;
396 >        int     i;
397  
398          if (complen <= 0)       /* check to see if there is even a list */
399                  return;
# Line 441 | Line 447 | sortcomplist(void)                     /* fix our list order */
447   * list and start again from the beginning.  Since
448   * a merge sort is used, the sorting costs are minimal.
449   */
450 < extern int
450 > int
451   next_packet(            /* prepare packet for computation */
452 <        register PACKET *p,
452 >        PACKET  *p,
453          int     n
454   )
455   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines