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.1 by greg, Tue Oct 29 00:36:54 2024 UTC vs.
Revision 2.6 by greg, Wed Nov 6 19:45:59 2024 UTC

# Line 21 | Line 21 | int    nproc = 1;                      /* number of processes requested */
21   int     inpfmt = 'a';                   /* input format */
22   int     outfmt = 'f';                   /* output format */
23  
24 int     contrib = 0;                    /* computing contributions? */
25
26 int     xres = 0;                       /* horizontal (scan) size */
27 int     yres = 0;                       /* vertical resolution */
28
29 int     imm_irrad = 0;                  /* compute immediate irradiance? */
30 int     lim_dist = 0;                   /* limit distance? */
31
24   int     report_intvl = 0;               /* reporting interval (seconds) */
25  
26   extern char *   progname;               // global argv[0]
# Line 38 | Line 30 | RcontribSimulManager   myRCmanager;    // global rcontrib s
30   #define RCONTRIB_FEATURES       "Multiprocessing\n" \
31                                  "Accumulation\nRecovery\n" \
32                                  "ImmediateIrradiance\n" \
33 <                                "ProgressReporting?\nDistanceLimiting\n" \
33 >                                "ProgressReporting\nDistanceLimiting\n" \
34                                  "InputFormats=a,f,d\nOutputFormats=f,d,c\n" \
35                                  "Outputs=V,W\n" \
36                                  "OutputCS=RGB,spec\n"
# Line 49 | 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");
46 <        if (imm_irrad)
44 >        printf(myRCmanager.HasFlag(RCcontrib) ?
45 >                        "-V+\t\t\t\t# output contributions" :
46 >                        "-V-\t\t\t\t# output coefficients");
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);
53 <        printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" :
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");
56          printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n",
57                          inpfmt, outfmt, formstr(inpfmt), formstr(outfmt));
# Line 81 | 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 218 | Line 212 | main(int argc, char *argv[])
212                          continue;
213                  }
214                  switch (argv[i][1]) {
215 <                case 'n':                       /* number of cores */
215 >                case 'n':                       /* number of processes */
216                          check(2,"i");
217                          nproc = atoi(argv[++i]);
218                          if (nproc < 0 && (nproc += RadSimulManager::GetNCores()) <= 0)
219                                  nproc = 1;
220                          break;
221 <                case 'V':                       /* output contributions */
222 <                        check_bool(2,contrib);
221 >                case 'V':                       /* output contributions? */
222 >                        rval = myRCmanager.HasFlag(RCcontrib);
223 >                        check_bool(2,rval);
224 >                        myRCmanager.SetFlag(RCcontrib, rval);
225                          break;
226                  case 'x':                       /* x resolution */
227                          check(2,"i");
228 <                        xres = atoi(argv[++i]);
228 >                        myRCmanager.xres = atoi(argv[++i]);
229                          break;
230                  case 'y':                       /* y resolution */
231                          check(2,"i");
232 <                        yres = atoi(argv[++i]);
232 >                        myRCmanager.yres = atoi(argv[++i]);
233                          break;
234 <                case 'w':                       /* warnings */
234 >                case 'w':                       /* warnings on/off */
235                          rval = (erract[WARNING].pf != NULL);
236                          check_bool(2,rval);
237                          if (rval) erract[WARNING].pf = wputs;
238                          else erract[WARNING].pf = NULL;
239                          break;
240 <                case 'e':                       /* expression */
240 >                case 'e':                       /* .cal expression */
241                          check(2,"s");
242                          scompile(argv[++i], NULL, 0);
243                          break;
244                  case 'l':                       /* limit distance */
245                          if (argv[i][2] != 'd')
246                                  goto badopt;
247 <                        check_bool(3,lim_dist);
247 >                        rval = myRCmanager.HasFlag(RTlimDist);
248 >                        check_bool(3,rval);
249 >                        myRCmanager.SetFlag(RTlimDist, rval);
250                          break;
251                  case 'I':                       /* immed. irradiance */
252 <                        check_bool(2,imm_irrad);
252 >                        rval = myRCmanager.HasFlag(RTimmIrrad);
253 >                        check_bool(2,rval);
254 >                        myRCmanager.SetFlag(RTimmIrrad, rval);
255                          break;
256 <                case 'f':                       /* file or force or format */
256 >                case 'f':                       /* .cal file or force or format */
257                          if (!argv[i][2]) {
258                                  check(2,"s");
259                                  loadfunc(argv[++i]);
# Line 266 | Line 266 | main(int argc, char *argv[])
266                          setformat(argv[i]+2);
267                          myRCmanager.SetDataFormat(outfmt);
268                          break;
269 <                case 'o':                       /* output */
269 >                case 'o':                       /* output file */
270                          check(2,"s");
271                          curout = argv[++i];
272                          break;
# Line 294 | Line 294 | main(int argc, char *argv[])
294                          check(2,"s");
295                          myRCmanager.AddModifier(argv[++i], curout, prms, binval, bincnt);
296                          break;
297 <                case 'M':                       /* modifier file */
297 >                case 'M':                       /* file of modifier names */
298                          check(2,"s");
299                          myRCmanager.AddModFile(argv[++i], curout, prms, binval, bincnt);
300                          break;
# Line 308 | Line 308 | main(int argc, char *argv[])
308          }
309          if (i != argc-1)
310                  error(USER, "expected single octree argument");
311 +
312 +        override_options();             /* override some option settings */
313 +
314 +        if (!myRCmanager.GetOutput())   // check that we have work to do
315 +                error(USER, "missing required modifier argument");
316                                          // get ready to rock...
317          if (setspectrsamp(CNDX, WLPART) < 0)
318                  error(USER, "unsupported spectral sampling");
314
315        if (!myRCmanager.GetOutputs(NULL))      // check that we're ready
316                error(USER, "missing required modifier argument");
317                                        /* override some option settings */
318        override_options();
319                                          /* set up signal handling */
320          sigdie(SIGINT, "Interrupt");
321   #ifdef SIGHUP
# Line 348 | Line 348 | main(int argc, char *argv[])
348                  myRCmanager.outOp = RCOnew;
349                                          // rval = # rows recovered
350          rval = myRCmanager.PrepOutput();
351 <                                        // check if all done
351 >                                        // check if recovered everything
352          if (recover && rval >= myRCmanager.GetRowMax()) {
353                  error(WARNING, "nothing left to compute");
354                  quit(0);
# Line 498 | Line 498 | rxcontrib(const int rstart)
498                  time_t  tnow;
499                  if (!getRayBundle(odarr))
500                          goto readerr;
501 <                if (myRCmanager.ComputeRecord(odarr) < 0)
501 >                if (myRCmanager.ComputeRecord(odarr) <= 0)
502                          return;         // error reported, hopefully...
503                  r++;
504                  if (report_intvl <= 0)
# Line 524 | Line 524 | wputs(                         /* warning output function */
524          const char      *s
525   )
526   {
527 +        if (!erract[WARNING].pf) return;
528          int  lasterrno = errno;
529          eputs(s);
530          errno = lasterrno;
# Line 551 | Line 552 | eputs(                         /* put string to stderr */
552   }
553  
554  
555 < /* Quit program */
555 > /* Exit program */
556   void
557   quit(
558          int  code

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines