42 |
|
{ |
43 |
|
printf("-c %-5d\t\t\t# accumulated rays per record\n", myRCmanager.accum); |
44 |
|
printf(myRCmanager.HasFlag(RCcontrib) ? |
45 |
< |
"-V+\t\t\t\t# output contributions" : |
46 |
< |
"-V-\t\t\t\t# output coefficients"); |
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); |
96 |
|
sigerr[signo] = msg; |
97 |
|
} |
98 |
|
|
99 |
– |
const char * |
100 |
– |
formstr(int f) // return format identifier |
101 |
– |
{ |
102 |
– |
switch (f) { |
103 |
– |
case 'a': return("ascii"); |
104 |
– |
case 'f': return("float"); |
105 |
– |
case 'd': return("double"); |
106 |
– |
case 'c': return(NCSAMP==3 ? COLRFMT : SPECFMT); |
107 |
– |
} |
108 |
– |
return("unknown"); |
109 |
– |
} |
110 |
– |
|
99 |
|
/* set input/output format */ |
100 |
|
static void |
101 |
|
setformat(const char *fmt) |
132 |
|
error(USER, errmsg); |
133 |
|
} |
134 |
|
|
135 |
+ |
/* Set default options */ |
136 |
+ |
static void |
137 |
+ |
default_options(void) |
138 |
+ |
{ |
139 |
+ |
rand_samp = 1; |
140 |
+ |
dstrsrc = 0.9; |
141 |
+ |
directrelay = 3; |
142 |
+ |
vspretest = 512; |
143 |
+ |
srcsizerat = .2; |
144 |
+ |
specthresh = .02; |
145 |
+ |
specjitter = 1.; |
146 |
+ |
maxdepth = -10; |
147 |
+ |
minweight = 2e-3; |
148 |
+ |
ambres = 256; |
149 |
+ |
ambdiv = 350; |
150 |
+ |
ambounce = 1; |
151 |
+ |
} |
152 |
|
|
153 |
|
/* Set overriding options */ |
154 |
|
static void |
159 |
|
ambacc = 0; |
160 |
|
} |
161 |
|
|
157 |
– |
|
162 |
|
int |
163 |
|
main(int argc, char *argv[]) |
164 |
|
{ |
189 |
|
/* initialize calcomp routines early */ |
190 |
|
initfunc(); |
191 |
|
calcontext(RCCONTEXT); |
192 |
+ |
/* set rcontrib defaults */ |
193 |
+ |
default_options(); |
194 |
|
/* option city */ |
195 |
|
for (i = 1; i < argc; i++) { |
196 |
|
/* expand arguments */ |
355 |
|
// rval = # rows recovered |
356 |
|
rval = myRCmanager.PrepOutput(); |
357 |
|
// check if recovered everything |
358 |
< |
if (recover && rval >= myRCmanager.GetRowMax()) { |
358 |
> |
if (rval >= myRCmanager.GetRowMax()) { |
359 |
|
error(WARNING, "nothing left to compute"); |
360 |
|
quit(0); |
361 |
|
} // add processes as requested |
500 |
|
} |
501 |
|
last_report = tstart = time(0); |
502 |
|
} |
503 |
< |
while (r < totRows) { // getting to work... |
503 |
> |
while (r < totRows) { // loop until done |
504 |
|
time_t tnow; |
505 |
|
if (!getRayBundle(odarr)) |
506 |
|
goto readerr; |
509 |
|
r++; |
510 |
|
if (report_intvl <= 0) |
511 |
|
continue; |
512 |
< |
if ((r < totRows) & ((tnow = time(0)) < last_report+report_intvl)) |
512 |
> |
tnow = time(0); // time to report progress? |
513 |
> |
if (r == totRows) |
514 |
> |
myRCmanager.FlushQueue(); |
515 |
> |
else if (tnow < last_report+report_intvl) |
516 |
|
continue; |
517 |
|
sprintf(errmsg, "%.2f%% done after %.3f hours\n", |
518 |
< |
100.*r/totRows, (1./3600.)*(tnow - tstart)); |
518 |
> |
100.*myRCmanager.GetRowFinished()/totRows, |
519 |
> |
(1./3600.)*(tnow - tstart)); |
520 |
|
eputs(errmsg); |
521 |
|
last_report = tnow; |
522 |
|
} |