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.15 by greg, Fri Oct 17 17:43:53 2025 UTC vs.
Revision 2.19 by greg, Sat Oct 25 03:30:35 2025 UTC

# Line 58 | Line 58 | static const char      ROW_DONE[] = "ROW FINISHED\n";
58   static RcontribMod *
59   NewRcMod(const char *prms, const char *binexpr, int ncbins)
60   {
61 +        if (binexpr && !*binexpr) binexpr = NULL;
62          if (!prms) prms = "";
63          if ((ncbins > 1) & !binexpr) {
64                  error(USER, "missing bin expression");
# Line 115 | Line 116 | formstr(int f)
116          return("unknown");
117   }
118  
119 < // Our default data share function
119 > // Standard file data share function
120   RdataShare *
121 < defDataShare(const char *name, RCOutputOp op, size_t siz)
121 > fileDataShare(const char *name, RCOutputOp op, size_t siz)
122   {
123 +        if (op == RCOrecover && access(name, R_OK|W_OK) < 0) {
124 +                sprintf(errmsg, "cannot recover from '%s'", name);
125 +                error(SYSTEM, errmsg);
126 +                return NULL;
127 +        }
128 +        return new RdataShareFile(name, RSDOflags[op], siz);
129 + }
130 +
131 + // Memory-mapped data share function
132 + RdataShare *
133 + mapDataShare(const char *name, RCOutputOp op, size_t siz)
134 + {
135 +        if (op == RCOrecover && access(name, R_OK|W_OK) < 0) {
136 +                sprintf(errmsg, "cannot recover from '%s'", name);
137 +                error(SYSTEM, errmsg);
138 +                return NULL;
139 +        }
140          return new RdataShareMap(name, RSDOflags[op], siz);
141   }
142  
# Line 379 | Line 397 | RcontribSimulManager::PrepOutput()
397                          if (rd < 0)
398                                  return -1;
399                          if (rd >= op->nRows) {
400 <                                if (remWarnings >= 0) {
400 >                                if (remWarnings > 0) {
401                                          sprintf(errmsg, "recovered output '%s' is complete",
402                                                          op->GetName());
403                                          error(WARNING, --remWarnings ? errmsg : "etc...");
# Line 396 | Line 414 | RcontribSimulManager::PrepOutput()
414          }
415          rowsDone.NewBitMap(outList->nRows);     // create row completion map
416          rowsDone.ClearBits(0, rInPos, true);
417 <        return rInPos;
417 >        return nrDone = rInPos;
418   }
419  
420   // Create header in open write-only channel
# Line 516 | Line 534 | RcontribOutput::CheckHeader(const RcontribSimulManager
534                  return -1;
535          }
536                                                  // check #columns
537 <        if (((cp = findArgs(hdr, "NCOLS=", begData)) && atoi(cp)*esiz != rowBytes) ||
538 <                        !rcp->xres | (rowBytes > esiz)) {
539 <                sprintf(errmsg, "expected NCOLS=%d in '%s'",
522 <                                int(rowBytes/esiz), GetName());
537 >        if ((cp = findArgs(hdr, "NCOLS=", begData)) ? (atoi(cp)*esiz != rowBytes)
538 >                                                    : (!rcp->xres | (rowBytes > esiz))) {
539 >                sprintf(errmsg, "expected NCOLS=%d in '%s'", int(rowBytes/esiz), GetName());
540                  error(USER, errmsg);
541                  return -1;
542          }
# Line 561 | Line 578 | RcontribSimulManager::ResetRow(int r)
578                          return false;
579  
580          rowsDone.ClearBits(r, rInPos-r, false);
581 <        rInPos = r;
581 >        nrDone = rInPos = r;
582          return true;
583   }
584  
# Line 720 | Line 737 | RcontribSimulManager::UpdateRowsDone(int r)
737                  error(WARNING, "redundant call to UpdateRowsDone()");
738                  return false;
739          }
740 <        int     nDone = GetRowFinished();
741 <        if (nDone <= r)
740 >        GetRowFinished();
741 >        if (nrDone <= r)
742                  return true;                    // nothing to update, yet
743          for (RcontribOutput *op = outList; op; op = op->next)
744 <                if (!op->SetRowsDone(nDone))
744 >                if (!op->SetRowsDone(nrDone))
745                          return false;
746          return true;                            // up-to-date
747   }

Diff Legend

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