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

Comparing ray/src/rt/rxcmain.cpp (file contents):
Revision 2.11 by greg, Mon Dec 23 16:15:38 2024 UTC vs.
Revision 2.19 by greg, Thu Oct 16 18:36:23 2025 UTC

# Line 23 | Line 23 | int    outfmt = 'f';                   /* output format */
23  
24   int     report_intvl = 0;               /* reporting interval (seconds) */
25  
26 extern char *   progname;               // global argv[0]
27
26   RcontribSimulManager    myRCmanager;    // global rcontrib simulation manager
27  
28   #define RCONTRIB_FEATURES       "Multiprocessing\n" \
# Line 47 | Line 45 | printdefaults(void)                    /* print default values to stdou
45          if (myRCmanager.HasFlag(RTimmIrrad))
46                  printf("-I+\t\t\t\t# immediate irradiance on\n");
47          printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
48 <        if (myRCmanager.xres > 0)
51 <                printf("-x %-9d\t\t\t# x resolution\n", myRCmanager.xres);
48 >        printf("-x %-9d\t\t\t# x resolution\n", myRCmanager.xres);
49          printf("-y %-9d\t\t\t# y resolution\n", myRCmanager.yres);
50          printf(myRCmanager.HasFlag(RTlimDist) ?
51                          "-ld+\t\t\t\t# limit distance on\n" :
# Line 56 | Line 53 | printdefaults(void)                    /* print default values to stdou
53          printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n",
54                          inpfmt, outfmt, formstr(inpfmt), formstr(outfmt));
55          if (report_intvl > 0)
56 <                printf("-t %-9d\t\t\t#  time between reports\n", report_intvl);
56 >                printf("-t %-9d\t\t\t# time between reports\n", report_intvl);
57          printf(erract[WARNING].pf != NULL ?
58                          "-w+\t\t\t\t# warning messages on\n" :
59                          "-w-\t\t\t\t# warning messages off\n");
# Line 75 | Line 72 | onsig(                         /* fatal signal */
72                  _exit(signo);
73  
74   #ifdef SIGALRM
75 <        alarm(180);                     /* allow 3 minutes to clean up */
75 >        alarm(600);                     /* allow 10 minutes to clean up */
76          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
77   #endif
78          eputs("signal - ");
# Line 243 | Line 240 | main(int argc, char *argv[])
240                          if (rval) erract[WARNING].pf = wputs;
241                          else erract[WARNING].pf = NULL;
242                          break;
246                case 'e':                       /* .cal expression */
247                        check(2,"s");
248                        scompile(argv[++i], NULL, 0);
249                        break;
243                  case 'l':                       /* limit distance */
244                          if (argv[i][2] != 'd')
245                                  goto badopt;
# Line 259 | Line 252 | main(int argc, char *argv[])
252                          check_bool(2,rval);
253                          myRCmanager.SetFlag(RTimmIrrad, rval);
254                          break;
255 <                case 'f':                       /* .cal file or force or format */
263 <                        if (!argv[i][2]) {
264 <                                check(2,"s");
265 <                                loadfunc(argv[++i]);
266 <                                break;
267 <                        }
255 >                case 'f':                       /* force or format */
256                          if (argv[i][2] == 'o') {
257                                  check_bool(3,force_open);
258                                  break;
# Line 345 | Line 333 | main(int argc, char *argv[])
333          myRCmanager.LoadOctree(argv[argc-1]);
334                                          // add to header
335          myRCmanager.AddHeader(argc-1, argv);
336 +        {
337 +                char    buf[128] = "SOFTWARE= ";
338 +                strcpy(buf+10, VersionID);
339 +                myRCmanager.AddHeader(buf);
340 +        }
341                                          // prepare output files
342          if (recover)
343                  myRCmanager.outOp = RCOrecover;
# Line 354 | Line 347 | main(int argc, char *argv[])
347                  myRCmanager.outOp = RCOnew;
348                                          // rval = # rows recovered
349          rval = myRCmanager.PrepOutput();
350 <                                        // check if recovered everything
351 <        if (rval >= myRCmanager.GetRowMax()) {
350 >
351 >        if (rval < 0)                   // PrepOutput() failure?
352 >                error(USER, "issue loading or creating output(s)");
353 >                                        // in case we recovered everything
354 >        if (rval >= myRCmanager.GetRowMax())
355                  error(WARNING, "nothing left to compute");
356 <                quit(0);
357 <        }                               // add processes as requested
362 <        myRCmanager.SetThreadCount(nproc);
356 >        else
357 >                rxcontrib(rval);        // trace ray contributions (loop)
358  
359 <        rxcontrib(rval);                /* trace ray contributions (loop) */
359 >        quit(0);        // exit clean
360  
366        quit(0);        /* exit clean */
367
361   badopt:
362          fprintf(stderr,
363   "Usage: %s [-V][-c count][-r][-e expr][-f source][-o ospec][-p p1=V1,p2=V2][-b binv][-bn N] {-m mod | -M file} [rtrace options] octree\n",
# Line 499 | Line 492 | rxcontrib(const int rstart)
492                  }
493                  last_report = tstart = time(0);
494          }
495 +                                        // start children as requested
496 +        myRCmanager.SetThreadCount(nproc);
497 +
498          while (r < totRows) {           // loop until done
499                  time_t  tnow;
500                  if (!getRayBundle(odarr))
# Line 508 | Line 504 | rxcontrib(const int rstart)
504                  r++;
505                  if (report_intvl <= 0)
506                          continue;
507 <                tnow = time(0);         // time to report progress?
508 <                if (r == totRows)
509 <                        myRCmanager.FlushQueue();
510 <                else if (tnow < last_report+report_intvl)
507 >                if (r == totRows)       // need to finish up?
508 >                        myRCmanager.SetThreadCount(1);
509 >                tnow = time(0);
510 >                if ((r < totRows) & (tnow < last_report+report_intvl))
511                          continue;
512                  sprintf(errmsg, "%.2f%% done after %.3f hours\n",
513                                  100.*myRCmanager.GetRowFinished()/totRows,
# Line 567 | Line 563 | quit(
563          int  code
564   )
565   {
566 <        if (!code && myRCmanager.Ready())       // clean up on normal exit
571 <                code = myRCmanager.Cleanup();
566 >        myRCmanager.FlushQueue();       // leave nothing in queue
567  
568          exit(code);
569   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)