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

Comparing ray/src/hd/rholo.c (file contents):
Revision 3.37 by gregl, Fri Jan 16 11:45:43 1998 UTC vs.
Revision 3.43 by gwlarson, Thu Dec 10 10:47:29 1998 UTC

# Line 26 | Line 26 | char   *progname;              /* our program name */
26   char    *hdkfile;               /* holodeck file name */
27   char    froot[256];             /* root file name */
28  
29 int     nowarn = 0;             /* turn warnings off? */
30
29   int     ncprocs = 0;            /* desired number of compute processes */
30  
31   char    *outdev = NULL;         /* output device name */
# Line 51 | Line 49 | long   nraysdone = 0L;         /* number of rays done */
49   long    npacksdone = 0L;        /* number of packets done */
50  
51   PACKET  *freepacks;             /* available packets */
52 < int     avgqlen;                /* average queue length when full */
52 > int     totqlen;                /* maximum queue length when full */
53  
54   char  *sigerr[NSIG];            /* signal error messages */
55  
56 + extern int      nowarn;         /* turn warnings off? */
57 +
58   extern time_t   time();
59  
60  
# Line 222 | Line 222 | initrholo()                    /* get our holodeck running */
222                  endtime = starttime + vflt(TIME)*3600. + .5;
223                                                  /* start rtrace */
224          if (ncprocs > 0) {
225 <                i = start_rtrace();
225 >                totqlen = i = start_rtrace();
226                  if (i < 1)
227                          error(USER, "cannot start rtrace process(es)");
228                  if (vdef(REPORT)) {             /* make first report */
# Line 233 | Line 233 | initrholo()                    /* get our holodeck running */
233                  freepacks = (PACKET *)bmalloc(i*sizeof(PACKET));
234                  if (freepacks == NULL)
235                          goto memerr;
236                if (!(avgqlen = i/nprocs))      /* record mean queue length */
237                        avgqlen = 1;
236                  freepacks[--i].nr = 0;
237                  freepacks[i].next = NULL;
238                  if (!vdef(OBSTRUCTIONS) || !vbool(OBSTRUCTIONS)) {
# Line 302 | Line 300 | rholo()                                /* holodeck main loop */
300                  report(t);
301                                          /* figure out good packet size */
302   #if MAXQTIME
303 <        pksiz = nraysdone*MAXQTIME/(avgqlen*(t - starttime + 1L));
303 >        pksiz = nraysdone*MAXQTIME/(totqlen*(t - starttime + 1L));
304          if (pksiz < 1)
305                  pksiz = 1;
306          else if (pksiz > RPACKSIZ)
# Line 369 | Line 367 | register HDGRID        *gp;
367                  for (i = 0; i < 3; i++)
368                          len[i] = VLEN(gp->xv[i]);
369                  if (!vdef(GRID)) {
370 <                        d = 2/5e5*( len[0]*len[0]*(len[1]*len[1] +
370 >                        d = 2/2e5*( len[0]*len[0]*(len[1]*len[1] +
371                                          len[2]*len[2] + 4*len[1]*len[2])
372                                  + len[1]*len[1]*len[2]*(len[2] + 4*len[0])
373                                  + 4*len[0]*len[1]*len[2]*len[2] );
# Line 422 | Line 420 | HDGRID *gp;
420   }
421  
422  
423 + int
424   headline(s)                     /* process information header line */
425   char    *s;
426   {
# Line 435 | Line 434 | char   *s;
434                                          HOLOFMT, hdkfile, FMTSTR, fmt);
435                          error(USER, errmsg);
436                  }
437 <                return;
437 >                return(0);
438          }
439          for (cp = s; *cp; cp++)         /* take off any comments */
440                  if (*cp == '#') {
# Line 443 | Line 442 | char   *s;
442                          break;
443                  }
444          setvariable(s, matchvar);       /* don't flag errors */
445 +        return(0);
446   }
447  
448  
# Line 455 | Line 455 | loadholo()                     /* start loading a holodeck from fname */
455          int4    nextloc;
456                                          /* open holodeck file */
457          if ((fp = fopen(hdkfile, ncprocs>0 ? "r+" : "r")) == NULL) {
458 <                sprintf(errmsg, "cannot open \"%s\" for %s", hdkfile,
459 <                                ncprocs>0 ? "appending" : "reading");
458 >                sprintf(errmsg, "cannot %s \"%s\"",
459 >                                ncprocs>0 ? "append" : "read", hdkfile);
460                  error(SYSTEM, errmsg);
461          }
462                                          /* load variables from header */
# Line 506 | Line 506 | PACKET *pl;
506                  p->next = freepacks;            /* push onto free list */
507                  freepacks = p;
508          }
509 <        if (n2flush > 300/MAXQTIME*avgqlen*nprocs) {
510 <                hdflush(NULL);                  /* flush holodeck buffers */
509 > #if MAXQTIME
510 >        if (n2flush > 300/MAXQTIME*totqlen) {
511 > #else
512 >        if (n2flush > 50*totqlen) {
513 > #endif
514 >                if (outdev == NULL)
515 >                        hdflush(NULL);          /* flush holodeck buffers */
516 >                else
517 >                        hdsync(NULL, 1);        /* sync holodeck file */
518                  n2flush = 0;
519          }
520   }
# Line 552 | Line 559 | register char  *s;
559                  fflush(stderr);
560                  midline = 0;
561          }
555 }
556
557
558 wputs(s)                        /* put warning string to stderr */
559 char    *s;
560 {
561        if (!nowarn)
562                eputs(s);
562   }
563  
564  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines