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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.54 by greg, Sun Jun 14 18:21:58 2009 UTC vs.
Revision 1.57 by greg, Sun Sep 26 15:44:00 2010 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   #include  "color.h"
15   #include  "resolu.h"
16   #include  "lookup.h"
17 + #include  "random.h"
18   #include  "calcomp.h"
19  
20   #ifndef MAXMODLIST
# Line 378 | Line 379 | main(int argc, char *argv[])
379          rtargv[rtargc++] = contrib ? RTCONTRIB : RTCOEFF;
380                                  /* just asking for defaults? */
381          if (!strcmp(argv[i], "-defaults")) {
382 <                char    sxres[16], syres[16];
382 >                char    nps[8], sxres[16], syres[16];
383                  char    *rtpath;
383                printf("-n %-2d\t\t\t\t# number of processes\n", nprocs);
384                  printf("-c %-5d\t\t\t# accumulated rays per record\n",
385                                  accumulate);
386                  printf("-V%c\t\t\t\t# output %s\n", contrib ? '+' : '-',
387                                  contrib ? "contributions" : "coefficients");
388                  fflush(stdout);                 /* report OUR options */
389 +                rtargv[rtargc++] = "-n";
390 +                sprintf(nps, "%d", nprocs);
391 +                rtargv[rtargc++] = nps;
392                  rtargv[rtargc++] = header ? "-h+" : "-h-";
393                  sprintf(fmt, "-f%c%c", inpfmt, outfmt);
394                  rtargv[rtargc++] = fmt;
# Line 543 | Line 546 | init(int np)
546                  raysleft = 0;
547          if ((account = accumulate) > 0)
548                  raysleft *= accumulate;
549 <        waitflush = xres;
549 >        waitflush = (yres > 0) & (xres > 1) ? 0 : xres;
550          if (!recover)
551                  return;
552                                          /* recover previous values */
# Line 664 | Line 667 | ofname(char *oname, const char *ospec, const char *mna
667                                  mnp = cp;
668                                  break;
669                          case 'd':
670 +                        case 'i':
671 +                        case 'o':
672 +                        case 'x':
673 +                        case 'X':
674                                  if (bnp != NULL)
675                                          return -1;
676                                  bnp = cp;
# Line 730 | Line 737 | printresolu(FILE *fout, int xr, int yr)
737   {
738          if ((xr > 0) & (yr > 0))        /* resolution string */
739                  fprtresolu(xr, yr, fout);
733        if (xres > 0)                   /* global flush flag */
734                fflush(fout);
740   }
741  
742   /* Get output stream pointer (open and write header if new and noopen==0) */
# Line 752 | Line 757 | getostream(const char *ospec, const char *mname, int b
757                          if (header)
758                                  printheader(stdout, NULL);
759                          printresolu(stdout, xres, yres);
760 +                        if (waitflush > 0)
761 +                                fflush(stdout);
762                          stdos.xr = xres; stdos.yr = yres;
763                          using_stdout = 1;
764                  }
# Line 820 | Line 827 | getostream(const char *ospec, const char *mname, int b
827                          if (outfmt == 'a')
828                                  putc('\n', sop->ofp);
829                  }
830 <                if (xres > 0)
830 >                if (waitflush > 0)
831                          fflush(sop->ofp);
832          }
833          sop->reclen += noopen;                  /* add to length if noopen */
# Line 950 | Line 957 | put_contrib(const DCOLOR cnt, FILE *fout)
957          default:
958                  error(INTERNAL, "botched output format");
959          }
960 +        if (waitflush < 0 && frandom() < 0.001)
961 +                fflush(fout);                   /* staggers writes */
962   }
963  
964   /* output ray tallies and clear for next accumulation */
# Line 987 | Line 996 | done_contrib(int navg)
996          if (using_stdout & (outfmt == 'a'))
997                  putc('\n', stdout);
998          if (!waitflush) {
999 <                waitflush = xres;
999 >                waitflush = (yres > 0) & (xres > 1) ? 0 : xres;
1000                  if (using_stdout)
1001                          fflush(stdout);
1002          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines