ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rxcmain.cpp
(Generate patch)

Comparing ray/src/rt/rxcmain.cpp (file contents):
Revision 2.3 by greg, Wed Oct 30 02:22:23 2024 UTC vs.
Revision 2.9 by greg, Tue Dec 3 17:39:42 2024 UTC

# Line 41 | Line 41 | static void
41   printdefaults(void)                     /* print default values to stdout */
42   {
43          printf("-c %-5d\t\t\t# accumulated rays per record\n", myRCmanager.accum);
44 <        printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-',
45 <                        contrib ? "contributions" : "coefficients");
44 >        printf(myRCmanager.HasFlag(RCcontrib) ?
45 >                        "-V+\t\t\t\t# output contributions\n" :
46 >                        "-V-\t\t\t\t# output coefficients\n");
47          if (myRCmanager.HasFlag(RTimmIrrad))
48                  printf("-I+\t\t\t\t# immediate irradiance on\n");
49          printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
50 <        if (xres > 0)
51 <                printf("-x %-9d\t\t\t# x resolution\n", xres);
52 <        printf("-y %-9d\t\t\t# y resolution\n", yres);
50 >        if (myRCmanager.xres > 0)
51 >                printf("-x %-9d\t\t\t# x resolution\n", myRCmanager.xres);
52 >        printf("-y %-9d\t\t\t# y resolution\n", myRCmanager.yres);
53          printf(myRCmanager.HasFlag(RTlimDist) ?
54                          "-ld+\t\t\t\t# limit distance on\n" :
55                          "-ld-\t\t\t\t# limit distance off\n");
# Line 74 | Line 75 | onsig(                         /* fatal signal */
75                  _exit(signo);
76  
77   #ifdef SIGALRM
78 <        alarm(15);                      /* allow 15 seconds to clean up */
78 >        alarm(180);                     /* allow 3 minutes to clean up */
79          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
80   #endif
81          eputs("signal - ");
# Line 95 | Line 96 | sigdie(                        /* set fatal signal */
96          sigerr[signo] = msg;
97   }
98  
98 const char *
99 formstr(int f)                          // return format identifier
100 {
101        switch (f) {
102        case 'a': return("ascii");
103        case 'f': return("float");
104        case 'd': return("double");
105        case 'c': return(NCSAMP==3 ? COLRFMT : SPECFMT);
106        }
107        return("unknown");
108 }
109
99   /* set input/output format */
100   static void
101   setformat(const char *fmt)
# Line 184 | Line 173 | main(int argc, char *argv[])
173                                          /* initialize calcomp routines early */
174          initfunc();
175          calcontext(RCCONTEXT);
187        esupport &= ~E_REDEFW;          /* temporary */
176                                          /* option city */
177          for (i = 1; i < argc; i++) {
178                                                  /* expand arguments */
# Line 219 | Line 207 | main(int argc, char *argv[])
207                                  nproc = 1;
208                          break;
209                  case 'V':                       /* output contributions? */
210 <                        check_bool(2,contrib);
210 >                        rval = myRCmanager.HasFlag(RCcontrib);
211 >                        check_bool(2,rval);
212 >                        myRCmanager.SetFlag(RCcontrib, rval);
213                          break;
214                  case 'x':                       /* x resolution */
215                          check(2,"i");
216 <                        xres = atoi(argv[++i]);
216 >                        myRCmanager.xres = atoi(argv[++i]);
217                          break;
218                  case 'y':                       /* y resolution */
219                          check(2,"i");
220 <                        yres = atoi(argv[++i]);
220 >                        myRCmanager.yres = atoi(argv[++i]);
221                          break;
222                  case 'w':                       /* warnings on/off */
223                          rval = (erract[WARNING].pf != NULL);
# Line 307 | Line 297 | main(int argc, char *argv[])
297          if (i != argc-1)
298                  error(USER, "expected single octree argument");
299  
310        esupport |= E_REDEFW;
300          override_options();             /* override some option settings */
301  
302          if (!myRCmanager.GetOutput())   // check that we have work to do
# Line 348 | Line 337 | main(int argc, char *argv[])
337                                          // rval = # rows recovered
338          rval = myRCmanager.PrepOutput();
339                                          // check if recovered everything
340 <        if (recover && rval >= myRCmanager.GetRowMax()) {
340 >        if (rval >= myRCmanager.GetRowMax()) {
341                  error(WARNING, "nothing left to compute");
342                  quit(0);
343          }                               // add processes as requested
# Line 493 | Line 482 | rxcontrib(const int rstart)
482                  }
483                  last_report = tstart = time(0);
484          }
485 <        while (r < totRows) {           // getting to work...
485 >        while (r < totRows) {           // loop until done
486                  time_t  tnow;
487                  if (!getRayBundle(odarr))
488                          goto readerr;
489 <                if (myRCmanager.ComputeRecord(odarr) < 0)
489 >                if (myRCmanager.ComputeRecord(odarr) <= 0)
490                          return;         // error reported, hopefully...
491                  r++;
492                  if (report_intvl <= 0)
493                          continue;
494 <                if ((r < totRows) & ((tnow = time(0)) < last_report+report_intvl))
494 >                tnow = time(0);         // time to report progress?
495 >                if (r == totRows)
496 >                        myRCmanager.FlushQueue();
497 >                else if (tnow < last_report+report_intvl)
498                          continue;
499                  sprintf(errmsg, "%.2f%% done after %.3f hours\n",
500 <                                100.*r/totRows, (1./3600.)*(tnow - tstart));
500 >                                100.*myRCmanager.GetRowFinished()/totRows,
501 >                                (1./3600.)*(tnow - tstart));
502                  eputs(errmsg);
503                  last_report = tnow;
504          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines