--- ray/src/rt/rxcmain.cpp 2024/12/23 16:15:38 2.11 +++ ray/src/rt/rxcmain.cpp 2025/04/22 17:12:25 2.17 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rxcmain.cpp,v 2.11 2024/12/23 16:15:38 greg Exp $"; +static const char RCSid[] = "$Id: rxcmain.cpp,v 2.17 2025/04/22 17:12:25 greg Exp $"; #endif /* * rxcmain.c - main for rxcontrib ray contribution tracer @@ -47,8 +47,7 @@ printdefaults(void) /* print default values to stdou if (myRCmanager.HasFlag(RTimmIrrad)) printf("-I+\t\t\t\t# immediate irradiance on\n"); printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); - if (myRCmanager.xres > 0) - printf("-x %-9d\t\t\t# x resolution\n", myRCmanager.xres); + printf("-x %-9d\t\t\t# x resolution\n", myRCmanager.xres); printf("-y %-9d\t\t\t# y resolution\n", myRCmanager.yres); printf(myRCmanager.HasFlag(RTlimDist) ? "-ld+\t\t\t\t# limit distance on\n" : @@ -56,7 +55,7 @@ printdefaults(void) /* print default values to stdou printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n", inpfmt, outfmt, formstr(inpfmt), formstr(outfmt)); if (report_intvl > 0) - printf("-t %-9d\t\t\t# time between reports\n", report_intvl); + printf("-t %-9d\t\t\t# time between reports\n", report_intvl); printf(erract[WARNING].pf != NULL ? "-w+\t\t\t\t# warning messages on\n" : "-w-\t\t\t\t# warning messages off\n"); @@ -75,7 +74,7 @@ onsig( /* fatal signal */ _exit(signo); #ifdef SIGALRM - alarm(180); /* allow 3 minutes to clean up */ + alarm(600); /* allow 10 minutes to clean up */ signal(SIGALRM, SIG_DFL); /* make certain we do die */ #endif eputs("signal - "); @@ -243,10 +242,6 @@ main(int argc, char *argv[]) if (rval) erract[WARNING].pf = wputs; else erract[WARNING].pf = NULL; break; - case 'e': /* .cal expression */ - check(2,"s"); - scompile(argv[++i], NULL, 0); - break; case 'l': /* limit distance */ if (argv[i][2] != 'd') goto badopt; @@ -259,12 +254,7 @@ main(int argc, char *argv[]) check_bool(2,rval); myRCmanager.SetFlag(RTimmIrrad, rval); break; - case 'f': /* .cal file or force or format */ - if (!argv[i][2]) { - check(2,"s"); - loadfunc(argv[++i]); - break; - } + case 'f': /* force or format */ if (argv[i][2] == 'o') { check_bool(3,force_open); break; @@ -345,6 +335,11 @@ main(int argc, char *argv[]) myRCmanager.LoadOctree(argv[argc-1]); // add to header myRCmanager.AddHeader(argc-1, argv); + { + char buf[128] = "SOFTWARE= "; + strcpy(buf+10, VersionID); + myRCmanager.AddHeader(buf); + } // prepare output files if (recover) myRCmanager.outOp = RCOrecover; @@ -358,9 +353,7 @@ main(int argc, char *argv[]) if (rval >= myRCmanager.GetRowMax()) { error(WARNING, "nothing left to compute"); quit(0); - } // add processes as requested - myRCmanager.SetThreadCount(nproc); - + } rxcontrib(rval); /* trace ray contributions (loop) */ quit(0); /* exit clean */ @@ -499,6 +492,9 @@ rxcontrib(const int rstart) } last_report = tstart = time(0); } + // start children as requested + myRCmanager.SetThreadCount(nproc); + while (r < totRows) { // loop until done time_t tnow; if (!getRayBundle(odarr)) @@ -508,10 +504,10 @@ rxcontrib(const int rstart) r++; if (report_intvl <= 0) continue; - tnow = time(0); // time to report progress? - if (r == totRows) - myRCmanager.FlushQueue(); - else if (tnow < last_report+report_intvl) + if (r == totRows) // need to finish up? + myRCmanager.SetThreadCount(1); + tnow = time(0); + if ((r < totRows) & (tnow < last_report+report_intvl)) continue; sprintf(errmsg, "%.2f%% done after %.3f hours\n", 100.*myRCmanager.GetRowFinished()/totRows, @@ -567,8 +563,7 @@ quit( int code ) { - if (!code && myRCmanager.Ready()) // clean up on normal exit - code = myRCmanager.Cleanup(); + myRCmanager.FlushQueue(); // leave nothing in queue exit(code); }