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] |
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" |
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) |
46 |
> |
if (myRCmanager.HasFlag(RTimmIrrad)) |
47 |
|
printf("-I+\t\t\t\t# immediate irradiance on\n"); |
48 |
|
printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc); |
49 |
|
if (xres > 0) |
50 |
|
printf("-x %-9d\t\t\t# x resolution\n", xres); |
51 |
|
printf("-y %-9d\t\t\t# y resolution\n", yres); |
52 |
< |
printf(lim_dist ? "-ld+\t\t\t\t# limit distance on\n" : |
52 |
> |
printf(myRCmanager.HasFlag(RTlimDist) ? |
53 |
> |
"-ld+\t\t\t\t# limit distance on\n" : |
54 |
|
"-ld-\t\t\t\t# limit distance off\n"); |
55 |
|
printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n", |
56 |
|
inpfmt, outfmt, formstr(inpfmt), formstr(outfmt)); |
184 |
|
/* initialize calcomp routines early */ |
185 |
|
initfunc(); |
186 |
|
calcontext(RCCONTEXT); |
187 |
+ |
esupport &= ~E_REDEFW; /* temporary */ |
188 |
|
/* option city */ |
189 |
|
for (i = 1; i < argc; i++) { |
190 |
|
/* expand arguments */ |
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 */ |
221 |
> |
case 'V': /* output contributions? */ |
222 |
|
check_bool(2,contrib); |
223 |
|
break; |
224 |
|
case 'x': /* x resolution */ |
229 |
|
check(2,"i"); |
230 |
|
yres = atoi(argv[++i]); |
231 |
|
break; |
232 |
< |
case 'w': /* warnings */ |
232 |
> |
case 'w': /* warnings on/off */ |
233 |
|
rval = (erract[WARNING].pf != NULL); |
234 |
|
check_bool(2,rval); |
235 |
|
if (rval) erract[WARNING].pf = wputs; |
236 |
|
else erract[WARNING].pf = NULL; |
237 |
|
break; |
238 |
< |
case 'e': /* expression */ |
238 |
> |
case 'e': /* .cal expression */ |
239 |
|
check(2,"s"); |
240 |
|
scompile(argv[++i], NULL, 0); |
241 |
|
break; |
242 |
|
case 'l': /* limit distance */ |
243 |
|
if (argv[i][2] != 'd') |
244 |
|
goto badopt; |
245 |
< |
check_bool(3,lim_dist); |
245 |
> |
rval = myRCmanager.HasFlag(RTlimDist); |
246 |
> |
check_bool(3,rval); |
247 |
> |
myRCmanager.SetFlag(RTlimDist, rval); |
248 |
|
break; |
249 |
|
case 'I': /* immed. irradiance */ |
250 |
< |
check_bool(2,imm_irrad); |
250 |
> |
rval = myRCmanager.HasFlag(RTimmIrrad); |
251 |
> |
check_bool(2,rval); |
252 |
> |
myRCmanager.SetFlag(RTimmIrrad, rval); |
253 |
|
break; |
254 |
< |
case 'f': /* file or force or format */ |
254 |
> |
case 'f': /* .cal file or force or format */ |
255 |
|
if (!argv[i][2]) { |
256 |
|
check(2,"s"); |
257 |
|
loadfunc(argv[++i]); |
264 |
|
setformat(argv[i]+2); |
265 |
|
myRCmanager.SetDataFormat(outfmt); |
266 |
|
break; |
267 |
< |
case 'o': /* output */ |
267 |
> |
case 'o': /* output file */ |
268 |
|
check(2,"s"); |
269 |
|
curout = argv[++i]; |
270 |
|
break; |
292 |
|
check(2,"s"); |
293 |
|
myRCmanager.AddModifier(argv[++i], curout, prms, binval, bincnt); |
294 |
|
break; |
295 |
< |
case 'M': /* modifier file */ |
295 |
> |
case 'M': /* file of modifier names */ |
296 |
|
check(2,"s"); |
297 |
|
myRCmanager.AddModFile(argv[++i], curout, prms, binval, bincnt); |
298 |
|
break; |
306 |
|
} |
307 |
|
if (i != argc-1) |
308 |
|
error(USER, "expected single octree argument"); |
309 |
+ |
|
310 |
+ |
esupport |= E_REDEFW; |
311 |
+ |
override_options(); /* override some option settings */ |
312 |
+ |
|
313 |
+ |
if (!myRCmanager.GetOutput()) // check that we have work to do |
314 |
+ |
error(USER, "missing required modifier argument"); |
315 |
|
// get ready to rock... |
316 |
|
if (setspectrsamp(CNDX, WLPART) < 0) |
317 |
|
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(); |
318 |
|
/* set up signal handling */ |
319 |
|
sigdie(SIGINT, "Interrupt"); |
320 |
|
#ifdef SIGHUP |
347 |
|
myRCmanager.outOp = RCOnew; |
348 |
|
// rval = # rows recovered |
349 |
|
rval = myRCmanager.PrepOutput(); |
350 |
< |
// check if all done |
350 |
> |
// check if recovered everything |
351 |
|
if (recover && rval >= myRCmanager.GetRowMax()) { |
352 |
|
error(WARNING, "nothing left to compute"); |
353 |
|
quit(0); |
523 |
|
const char *s |
524 |
|
) |
525 |
|
{ |
526 |
+ |
if (!erract[WARNING].pf) return; |
527 |
|
int lasterrno = errno; |
528 |
|
eputs(s); |
529 |
|
errno = lasterrno; |
551 |
|
} |
552 |
|
|
553 |
|
|
554 |
< |
/* Quit program */ |
554 |
> |
/* Exit program */ |
555 |
|
void |
556 |
|
quit( |
557 |
|
int code |