--- ray/src/rt/rcontrib.c 2012/06/15 21:32:11 2.7 +++ ray/src/rt/rcontrib.c 2012/06/22 22:03:02 2.13 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcontrib.c,v 2.7 2012/06/15 21:32:11 greg Exp $"; +static const char RCSid[] = "$Id: rcontrib.c,v 2.13 2012/06/22 22:03:02 greg Exp $"; #endif /* * Accumulate ray contributions for a set of materials @@ -7,9 +7,7 @@ static const char RCSid[] = "$Id: rcontrib.c,v 2.7 201 */ #include "rcontrib.h" -#include "source.h" #include "otypes.h" -#include "platform.h" char *shm_boundary = NULL; /* boundary of shared memory */ @@ -27,7 +25,7 @@ int do_irrad = 0; /* compute irradiance? */ int rand_samp = 1; /* pure Monte Carlo sampling? */ -double dstrsrc = 0.0; /* square source distribution */ +double dstrsrc = 0.9; /* square source distribution */ double shadthresh = .03; /* shadow threshold */ double shadcert = .75; /* shadow certainty */ int directrelay = 3; /* number of source relays */ @@ -137,7 +135,7 @@ addmodifier(char *modn, char *outf, char *binv, int bi } -/* add modifiers from a file list */ +/* Add modifiers from a file list */ void addmodfile(char *fname, char *outf, char *binv, int bincnt) { @@ -159,7 +157,7 @@ quit( /* quit program */ ) { if (nchild > 0) /* close children if any */ - end_children(); + end_children(code != 0); exit(code); } @@ -178,9 +176,6 @@ rcinit() /* set shared memory boundary */ shm_boundary = strcpy((char *)malloc(16), "SHM_BOUNDARY"); } - if ((nproc > 1) & (accumulate <= 0)) - put_zero_record(0); /* prime our queue to accumulate */ - if (yres > 0) { /* set up flushing & ray counts */ if (xres > 0) raysleft = (RNUMBER)xres*yres; @@ -191,25 +186,23 @@ rcinit() if ((account = accumulate) > 1) raysleft *= accumulate; waitflush = (yres > 0) & (xres > 1) ? 0 : xres; - /* tracing to sources as well */ - for (i = 0; i < nsources; i++) - source[i].sflags |= SFOLLOW; if (nproc > 1 && in_rchild()) /* forked child? */ return; /* return to main processing loop */ if (recover) { /* recover previous output? */ - if (accumulate <= 0) { + if (accumulate <= 0) reload_output(); - if (nproc > 1) - queue_modifiers(); - } else + else recover_output(); } if (nproc == 1) /* single process? */ return; - - parental_loop(); /* else run controller */ + /* else run appropriate controller */ + if (accumulate <= 0) + feeder_loop(); + else + parental_loop(); quit(0); /* parent musn't return! */ } @@ -346,7 +339,7 @@ rcontrib() account = 1; /* output accumulated totals */ done_contrib(); } + lu_done(&ofiletab); /* close output files */ if (raysleft) error(USER, "unexpected EOF on input"); - lu_done(&ofiletab); /* close output files */ }