--- ray/src/rt/rcontrib.c 2012/06/15 21:32:11 2.7 +++ ray/src/rt/rcontrib.c 2012/06/19 01:27:13 2.11 @@ -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.11 2012/06/19 01:27:13 greg Exp $"; #endif /* * Accumulate ray contributions for a set of materials @@ -27,7 +27,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 +137,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 +159,7 @@ quit( /* quit program */ ) { if (nchild > 0) /* close children if any */ - end_children(); + end_children(code != 0); exit(code); } @@ -178,9 +178,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; @@ -199,17 +196,18 @@ rcinit() 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 +344,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 */ }