7 |
|
*/ |
8 |
|
|
9 |
|
#include "rcontrib.h" |
10 |
– |
#include "source.h" |
10 |
|
#include "otypes.h" |
12 |
– |
#include "platform.h" |
11 |
|
|
12 |
|
char *shm_boundary = NULL; /* boundary of shared memory */ |
13 |
|
|
25 |
|
|
26 |
|
int rand_samp = 1; /* pure Monte Carlo sampling? */ |
27 |
|
|
28 |
< |
double dstrsrc = 0.0; /* square source distribution */ |
28 |
> |
double dstrsrc = 0.9; /* square source distribution */ |
29 |
|
double shadthresh = .03; /* shadow threshold */ |
30 |
|
double shadcert = .75; /* shadow certainty */ |
31 |
|
int directrelay = 3; /* number of source relays */ |
135 |
|
} |
136 |
|
|
137 |
|
|
138 |
< |
/* add modifiers from a file list */ |
138 |
> |
/* Add modifiers from a file list */ |
139 |
|
void |
140 |
|
addmodfile(char *fname, char *outf, char *binv, int bincnt) |
141 |
|
{ |
157 |
|
) |
158 |
|
{ |
159 |
|
if (nchild > 0) /* close children if any */ |
160 |
< |
end_children(); |
160 |
> |
end_children(code != 0); |
161 |
|
exit(code); |
162 |
|
} |
163 |
|
|
176 |
|
/* set shared memory boundary */ |
177 |
|
shm_boundary = strcpy((char *)malloc(16), "SHM_BOUNDARY"); |
178 |
|
} |
181 |
– |
if ((nproc > 1) & (accumulate <= 0)) |
182 |
– |
put_zero_record(0); /* prime our queue to accumulate */ |
183 |
– |
|
179 |
|
if (yres > 0) { /* set up flushing & ray counts */ |
180 |
|
if (xres > 0) |
181 |
|
raysleft = (RNUMBER)xres*yres; |
186 |
|
if ((account = accumulate) > 1) |
187 |
|
raysleft *= accumulate; |
188 |
|
waitflush = (yres > 0) & (xres > 1) ? 0 : xres; |
194 |
– |
/* tracing to sources as well */ |
195 |
– |
for (i = 0; i < nsources; i++) |
196 |
– |
source[i].sflags |= SFOLLOW; |
189 |
|
|
190 |
|
if (nproc > 1 && in_rchild()) /* forked child? */ |
191 |
|
return; /* return to main processing loop */ |
192 |
|
|
193 |
|
if (recover) { /* recover previous output? */ |
194 |
< |
if (accumulate <= 0) { |
194 |
> |
if (accumulate <= 0) |
195 |
|
reload_output(); |
196 |
< |
if (nproc > 1) |
205 |
< |
queue_modifiers(); |
206 |
< |
} else |
196 |
> |
else |
197 |
|
recover_output(); |
198 |
|
} |
199 |
|
if (nproc == 1) /* single process? */ |
200 |
|
return; |
201 |
< |
|
202 |
< |
parental_loop(); /* else run controller */ |
201 |
> |
/* else run appropriate controller */ |
202 |
> |
if (accumulate <= 0) |
203 |
> |
feeder_loop(); |
204 |
> |
else |
205 |
> |
parental_loop(); |
206 |
|
quit(0); /* parent musn't return! */ |
207 |
|
} |
208 |
|
|
339 |
|
account = 1; /* output accumulated totals */ |
340 |
|
done_contrib(); |
341 |
|
} |
342 |
+ |
lu_done(&ofiletab); /* close output files */ |
343 |
|
if (raysleft) |
344 |
|
error(USER, "unexpected EOF on input"); |
351 |
– |
lu_done(&ofiletab); /* close output files */ |
345 |
|
} |