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

Comparing ray/src/rt/RtraceSimulManager.cpp (file contents):
Revision 2.16 by greg, Sun Aug 25 00:17:29 2024 UTC vs.
Revision 2.18 by greg, Thu Oct 10 21:02:52 2024 UTC

# Line 141 | Line 141 | RadSimulManager::AddHeader(int ac, char *av[])
141          return true;
142   }
143  
144 + // Look for specific header keyword, return value
145 + const char *
146 + RadSimulManager::GetHeadStr(const char *key, bool inOK) const
147 + {
148 +        if (!key | !hlen || strchr(key, '\n'))
149 +                return NULL;
150 +        if (inOK)                       // skip leading spaces?
151 +                while (isspace(*key)) key++;
152 +
153 +        const int       klen = strlen(key);
154 +        if (!klen)
155 +                return NULL;
156 +        const char *    cp = header;
157 +        while (*cp) {
158 +                if (inOK) {             // skip leading spaces?
159 +                        while (isspace(*cp) && *cp++ != '\n')
160 +                                ;
161 +                        if (cp[-1] == '\n')
162 +                                continue;
163 +                }
164 +                if (!strncmp(cp, key, klen))
165 +                        return cp+klen; // found it!
166 +
167 +                while (*cp && *cp++ != '\n')
168 +                        ;
169 +        }
170 +        return NULL;
171 + }
172 +
173   // How many processors are available?
174   int
175   RadSimulManager::GetNCores()
# Line 259 | Line 288 | RtraceSimulManager::UpdateMode()
288          int     misMatch = rtFlags ^ curFlags;
289                                  // updates based on toggled flags
290          if (misMatch & RTtraceSources) {
291 +                int     sn = nsources;
292                  if (rtFlags & RTtraceSources) {
293 <                        for (int sn = 0; sn < nsources; sn++)
293 >                        srcFollowed.NewBitMap(nsources);
294 >                        while (sn--) {
295 >                                if (source[sn].sflags & SFOLLOW)
296 >                                        continue;
297                                  source[sn].sflags |= SFOLLOW;
298 <                } else          // cannot undo this...
299 <                        rtFlags |= RTtraceSources;
298 >                                srcFollowed.Set(sn);
299 >                        }
300 >                } else {
301 >                        while (sn--)
302 >                                if (srcFollowed.Check(sn))
303 >                                        source[sn].sflags &= ~SFOLLOW;
304 >                        srcFollowed.NewBitMap(0);
305 >                }
306          }
307          if (misMatch & RTdoFIFO && FlushQueue() < 0)
308                  return false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines