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

Comparing ray/src/util/rad.c (file contents):
Revision 2.93 by greg, Tue May 18 00:01:02 2010 UTC vs.
Revision 2.97 by greg, Fri May 28 17:29:14 2010 UTC

# Line 1316 | Line 1316 | rpict(                         /* run rpict and pfilt for each view */
1316                                          getview(0, vs) != NULL) {
1317                  if (!strcmp(c_rpict, DEF_RPICT_PATH) &&
1318                                  getview(1, NULL) == NULL) {
1319 <                        sprintf(sfile, "rpiece_%s.txt", vs);
1319 >                        sprintf(sfile, "rpsync_%s.txt", vs);
1320                          strcpy(rppopt, "-PP pfXXXXXX");
1321                  } else {
1322                          strcpy(rppopt, "-S 1 -PP pfXXXXXX");
1323                  }
1324                  pfile = rppopt + strlen(rppopt) - 8;
1325 <                if (mktemp(pfile) == NULL)
1325 >                if (mktemp(pfile) == NULL) {
1326                          if (do_rpiece) {
1327                                  fprintf(stderr, "%s: cannot create\n", pfile);
1328                                  quit(1);
1329 <                        } else
1330 <                                pfile = NULL;
1329 >                        }
1330 >                        pfile = NULL;
1331 >                }
1332          }
1333          vn = 0;                                 /* do each view */
1334          while ((vw = getview(vn++, vs)) != NULL) {
# Line 1356 | Line 1357 | rpict(                         /* run rpict and pfilt for each view */
1357                  }
1358                                                  /* parallel running? */
1359                  if (do_rpiece) {
1360 <                        if (rfdt < oct1date || fdate(sfile) < oct1date) {
1360 >                        if (rfdt < oct1date || !fdate(sfile)) {
1361 >                                int     xdiv = 8+nprocs/3, ydiv = 8+nprocs/3;
1362                                  rfdt = 0;               /* start fresh */
1363 +                                if (!silent)
1364 +                                        printf("\techo %d %d > %s\n",
1365 +                                                        xdiv, ydiv, sfile);
1366                                  if ((fp = fopen(sfile, "w")) == NULL) {
1367                                          fprintf(stderr, "%s: cannot create\n",
1368                                                          sfile);
1369                                          quit(1);
1370                                  }
1371 <                                fprintf(fp, "%d %d\n", 8+nprocs/3, 8+nprocs/3);
1371 >                                fprintf(fp, "%d %d\n", xdiv, ydiv);
1372                                  fclose(fp);
1373                          }
1374                  } else if (next_process()) {
# Line 1395 | Line 1400 | rpict(                         /* run rpict and pfilt for each view */
1400                                  "%s%s %s%s -x 64 -y 64 -ps 1 %s > %s",
1401                                                  c_rpict, rep, vw, opts,
1402                                                  oct1name, overfile);
1403 +                                if (do_rpiece)
1404 +                                        while (children_running < nprocs-1 &&
1405 +                                                        next_process())
1406 +                                                sleep(5);
1407                                  if (runcom(combuf)) {
1408                                          fprintf(stderr,
1409                                          "%s: error in overture for view %s\n",
1410                                                  progname, vs);
1411                                          quit(1);
1412                                  }
1413 +                                if (do_rpiece) {
1414 +                                        finish_process();
1415 +                                        wait_process(1);
1416 +                                }
1417   #ifndef NULL_DEVICE
1418                                  rmfile(overfile);
1419   #endif
# Line 1467 | Line 1480 | rpict(                         /* run rpict and pfilt for each view */
1480                          finish_process();       /* exit if child */
1481          }
1482          wait_process(1);                /* wait for children to finish */
1483 <        if (pfile != NULL) {            /* clean up rpict persistent mode */
1483 >        if (pfile != NULL) {            /* clean up persistent rpict */
1484                  RT_PID  pid;
1485                  fp = fopen(pfile, "r");
1486                  if (fp != NULL) {
# Line 1494 | Line 1507 | touch(                 /* update a file */
1507                  printf("\ttouch %s\n", fn);
1508          if (!nprocs)
1509                  return(0);
1497 #ifdef notused
1498        if (access(fn, F_OK) == -1)             /* create it */
1499                if (close(open(fn, O_WRONLY|O_CREAT, 0666)) == -1)
1500                        return(-1);
1501 #endif
1510          return(setfdate(fn, time((time_t *)NULL)));
1511   }
1512  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines