ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rcontrib.c
(Generate patch)

Comparing ray/src/rt/rcontrib.c (file contents):
Revision 2.36 by greg, Mon Jul 20 15:54:29 2020 UTC vs.
Revision 2.37 by greg, Wed Sep 9 21:28:19 2020 UTC

# Line 172 | Line 172 | addmodfile(char *fname, char *outf, char *prms, char *
172   }
173  
174  
175 + /* Check if we have any more rays left (and report progress) */
176 + int
177 + morays(void)
178 + {
179 +        static RNUMBER  total_rays;
180 +        static time_t   tstart, last_report;
181 +        time_t          tnow;
182 +
183 +        if (!raysleft)
184 +                return(1);      /* unknown total, so nothing to do or say */
185 +
186 +        if (report_intvl > 0 && (tnow = time(0)) >= last_report+report_intvl) {
187 +                if (!total_rays) {
188 +                        total_rays = raysleft;
189 +                        tstart = tnow;
190 +                }
191 +                sprintf(errmsg, "%.2f%% done after %.3f hours",
192 +                                100.-100.*raysleft/total_rays,
193 +                                (1./3600.)*(tnow - tstart));
194 +                eputs(errmsg);
195 +                last_report = tnow;
196 +        }
197 +        return(--raysleft);
198 + }
199 +
200 +
201 + /* Quit program */
202   void
203 < quit(                   /* quit program */
203 > quit(
204          int  code
205   )
206   {
# Line 364 | Line 391 | rcontrib(void)
391                  }
392                  done_contrib();         /* accumulate/output */
393                  ++lastdone;
394 <                if (raysleft && !--raysleft)
394 >                if (!morays())
395                          break;          /* preemptive EOI */
396          }
397          if (nchild != -1 && (accumulate <= 0) | (account < accumulate)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines