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

Comparing ray/src/rt/RcontribSimulManager.cpp (file contents):
Revision 2.1 by greg, Tue Oct 29 00:36:54 2024 UTC vs.
Revision 2.3 by greg, Wed Oct 30 01:38:21 2024 UTC

# Line 24 | Line 24 | extern const char      HDRSTR[];
24   extern const char       BIGEND[];
25   extern const char       FMTSTR[];
26  
27 < extern int              contrib;                /* computing contributions? */
28 < extern int              lim_dist;               /* limit distance? */
27 > int     contrib = 0;                    // computing contributions?
28  
29 + int     xres = 0;                       // horizontal (scan) size
30 + int     yres = 0;                       // vertical resolution
31 +
32   // new/exclusive, overwrite if exists, or recover data
33   int     RSDOflags[] = {RDSwrite|RDSexcl|RDSextend, RDSwrite|RDSextend,
34                                  RDSread|RDSwrite};
# Line 49 | Line 51 | struct RcontribMod {
51                                  }
52   };
53  
54 < // used to assign record calc to child
54 > // Struct used to assign record calculation to child
55   struct RowAssignment {
56          uint32                  row;            // row to do
57          uint32                  ac;             // accumulation count
# Line 287 | Line 289 | RcontribSimulManager::AddModFile(const char *modfn, co
289          return true;
290   }
291  
290 // Run through current list of output struct's
291 int
292 RcontribSimulManager::GetOutputs(RoutputShareF *osF, void *cd) const
293 {
294        int     cnt = 0;
295
296        for (const RcontribOutput *op = outList; op; op = op->next) {
297                int     rv = 1;
298                if (osF && (rv = (*osF)(op, cd)) < 0)
299                        return rv;
300                cnt += rv;
301        }
302        return cnt;
303 }
304
292   // Prepare output channels and return # completed rows
293   int
294   RcontribSimulManager::PrepOutput()
# Line 341 | Line 328 | RcontribSimulManager::PrepOutput()
328                                  !op->rData->Resize(op->begData + op->nRows*op->rowBytes))
329                          return -1;              // calls error() for us
330          }
344        if (lim_dist)                           // XXX where else to put this?
345                rtFlags |= RTlimDist;
346        else
347                rtFlags &= ~RTlimDist;
348
331          rowsDone.NewBitMap(outList->nRows);     // create row completion map
332          rowsDone.ClearBits(0, rInPos, true);
333          return rInPos;
# Line 461 | Line 443 | RcontribOutput::CheckHeader(const RcontribSimulManager
443                  return -1;
444          }
445                                                  // check format
446 <        if (!(cp = findArgs(hdr, FMTSTR, begData)) || strcmp(cp, formstr(etyp))) {
446 >        if (!(cp = findArgs(hdr, FMTSTR, begData)) ||
447 >                                strncmp(cp, formstr(etyp), strlen(formstr(etyp)))) {
448                  sprintf(errmsg, "expected %s%s in '%s'", FMTSTR, formstr(etyp), GetName());
449                  error(USER, errmsg);
450                  return -1;
# Line 650 | Line 633 | RcontribSimulManager::GetChild(bool forceWait)
633                                  FD_ISSET(kid[n].w, &writeset) |
634                                  FD_ISSET(kid[n].w, &errset)) {
635                                                  // update output row counts
636 <                        UpdateRowsDone(kidRow[n]);
636 >                        if (!FD_ISSET(kid[n].w, &errset))
637 >                                UpdateRowsDone(kidRow[n]);
638                          kidRow[n] = -1;         // flag it available
639                          pn = n;
640                  }
# Line 734 | Line 718 | RcontribSimulManager::StartKids(int n2go)
718                                  close(kid[nkids].w);
719                          free(kid); free(kidRow);
720                          kid = NULL; kidRow = NULL;
737                        rowsDone.NewBitMap(0);
721                          RunChild();             // should never return
722                          _exit(1);
723                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines