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

Comparing ray/src/rt/RcontribSimulManager.cpp (file contents):
Revision 2.18 by greg, Fri Oct 24 18:37:05 2025 UTC vs.
Revision 2.21 by greg, Mon Oct 27 18:38:32 2025 UTC

# Line 125 | Line 125 | fileDataShare(const char *name, RCOutputOp op, size_t
125                  error(SYSTEM, errmsg);
126                  return NULL;
127          }
128 <        return new RdataShareFile(name, RSDOflags[op], siz);
128 >        RdataShare *    rds = new RdataShareFile(name, RSDOflags[op],
129 >                                                 siz*(op != RCOforce));
130 >                                                
131 >        if (!rds || (op == RCOforce && rds->Resize(siz) < siz)) {
132 >                delete rds;
133 >                sprintf(errmsg, "cannot create %lu byte output file '%s'",
134 >                                        (unsigned long)siz, name);
135 >                error(SYSTEM, errmsg);
136 >                return NULL;
137 >        }
138 >        return rds;
139   }
140  
141   // Memory-mapped data share function
# Line 137 | Line 147 | mapDataShare(const char *name, RCOutputOp op, size_t s
147                  error(SYSTEM, errmsg);
148                  return NULL;
149          }
150 <        return new RdataShareMap(name, RSDOflags[op], siz);
150 >        RdataShare *    rds = new RdataShareMap(name, RSDOflags[op],
151 >                                                 siz*(op != RCOforce));
152 >
153 >        if (!rds || (op == RCOforce && rds->Resize(siz) < siz)) {
154 >                delete rds;
155 >                sprintf(errmsg, "cannot create %lu byte output map '%s'",
156 >                                        (unsigned long)siz, name);
157 >                error(SYSTEM, errmsg);
158 >                return NULL;
159 >        }
160 >        return rds;
161   }
162  
163   // Set output format ('f', 'd', or 'c')
# Line 414 | Line 434 | RcontribSimulManager::PrepOutput()
434          }
435          rowsDone.NewBitMap(outList->nRows);     // create row completion map
436          rowsDone.ClearBits(0, rInPos, true);
437 <        return rInPos;
437 >        return nrDone = rInPos;
438   }
439  
440   // Create header in open write-only channel
# Line 449 | Line 469 | RcontribOutput::NewHeader(const RcontribSimulManager *
469          sprintf(hdr+begData, "%s%d\n", NCOMPSTR, NCSAMP);
470          begData += strlen(hdr+begData);
471          if (NCSAMP > 3) {
472 <                sprintf(hdr+begData, "%s %f %f %f %f\n", WLSPLTSTR,
472 >                sprintf(hdr+begData, "%s %g %g %g %g\n", WLSPLTSTR,
473                                  WLPART[0], WLPART[1], WLPART[2], WLPART[3]);
474                  begData += strlen(hdr+begData);
475          }
# Line 534 | Line 554 | RcontribOutput::CheckHeader(const RcontribSimulManager
554                  return -1;
555          }
556                                                  // check #columns
557 <        if (((cp = findArgs(hdr, "NCOLS=", begData)) && atoi(cp)*esiz != rowBytes) ||
558 <                        !rcp->xres | (rowBytes > esiz)) {
559 <                sprintf(errmsg, "expected NCOLS=%d in '%s'",
540 <                                int(rowBytes/esiz), GetName());
557 >        if ((cp = findArgs(hdr, "NCOLS=", begData)) ? (atoi(cp)*esiz != rowBytes)
558 >                                                    : (!rcp->xres | (rowBytes > esiz))) {
559 >                sprintf(errmsg, "expected NCOLS=%d in '%s'", int(rowBytes/esiz), GetName());
560                  error(USER, errmsg);
561                  return -1;
562          }
# Line 579 | Line 598 | RcontribSimulManager::ResetRow(int r)
598                          return false;
599  
600          rowsDone.ClearBits(r, rInPos-r, false);
601 <        rInPos = r;
601 >        nrDone = rInPos = r;
602          return true;
603   }
604  
# Line 738 | Line 757 | RcontribSimulManager::UpdateRowsDone(int r)
757                  error(WARNING, "redundant call to UpdateRowsDone()");
758                  return false;
759          }
760 <        int     nDone = GetRowFinished();
761 <        if (nDone <= r)
760 >        GetRowFinished();
761 >        if (nrDone <= r)
762                  return true;                    // nothing to update, yet
763          for (RcontribOutput *op = outList; op; op = op->next)
764 <                if (!op->SetRowsDone(nDone))
764 >                if (!op->SetRowsDone(nrDone))
765                          return false;
766          return true;                            // up-to-date
767   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)