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.39 by greg, Thu Sep 10 01:01:18 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 +                } else {
191 +                        sprintf(errmsg, "%.2f%% done after %.3f hours\n",
192 +                                        100.-100.*raysleft/total_rays,
193 +                                        (1./3600.)*(tnow - tstart));
194 +                        eputs(errmsg);
195 +                }
196 +                last_report = tnow;
197 +        }
198 +        return(--raysleft);
199 + }
200 +
201 +
202 + /* Quit program */
203   void
204 < quit(                   /* quit program */
204 > quit(
205          int  code
206   )
207   {
# Line 364 | Line 392 | rcontrib(void)
392                  }
393                  done_contrib();         /* accumulate/output */
394                  ++lastdone;
395 <                if (raysleft && !--raysleft)
395 >                if (!morays())
396                          break;          /* preemptive EOI */
397          }
398          if (nchild != -1 && (accumulate <= 0) | (account < accumulate)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines