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

Comparing ray/src/rt/RtraceSimulManager.h (file contents):
Revision 2.8 by greg, Thu May 2 22:10:43 2024 UTC vs.
Revision 2.15 by greg, Thu Oct 10 21:02:52 2024 UTC

# Line 13 | Line 13
13   #define RtraceSimulManager_h
14  
15   #include "ray.h"
16 + #include "abitmap.h"
17  
18   extern char *   octname;        // global octree name
19  
# Line 23 | Line 24 | typedef int    RayReportCall(RAY *r, void *cd);
24  
25   /// Multi-threaded simulation manager base class
26   class RadSimulManager {
27 +        char *                  header;                 // header (less intro and format)
28 +        int                     hlen;                   // header string length
29   protected:
30                                  // Assign ray to subthread (fails if NThreads()<2)
31          bool                    SplitRay(RAY *r);
32   public:
33                                  RadSimulManager(const char *octn = NULL) {
34 +                                        header = NULL; hlen = 0;
35                                          LoadOctree(octn);
36                                  }
37                                  ~RadSimulManager() {
# Line 35 | Line 39 | class RadSimulManager { (public)
39                                  }
40                                  /// Load octree and prepare renderer
41          bool                    LoadOctree(const char *octn);
42 +                                /// Prepare header from previous input (or clear)
43 +                                /// Normally called during octree load
44 +        bool                    NewHeader(const char *inspec = NULL);
45 +                                /// Add a line to header (adds newline if none)
46 +        bool                    AddHeader(const char *str);
47 +                                /// Append program line to header
48 +        bool                    AddHeader(int ac, char *av[]);
49 +                                /// Get header lines or empty string
50 +        const char *            GetHeadStr() const {
51 +                                        return hlen ? header : "";
52 +                                }
53 +                                /// Look for specific header keyword, return value
54 +        const char *            GetHeadStr(const char *key, bool inOK = false) const;
55                                  /// How many cores are available?
56          static int              GetNCores();
57                                  /// Set number of computation threads (0 => #cores)
# Line 67 | Line 84 | class RtraceSimulManager : public RadSimulManager {
84          RayReportCall *         traceCall;      // call for every ray in tree
85          void *                  tcData;         // client data for traced rays
86          int                     curFlags;       // current operating flags
87 +        ABitMap                 srcFollowed;    // source flags changed
88                                  // Call-back for global ray-tracing context
89          static void             RTracer(RAY *r);
90                                  // Call-back for FIFO
# Line 91 | Line 109 | class RtraceSimulManager : public RadSimulManager {
109          int                     SetThreadCount(int nt = 0) {
110                                          if (nt <= 0) nt = castonly ? 1 : GetNCores();
111                                          if (nt == NThreads()) return nt;
112 <                                        if (FlushQueue() < 0) return 0;
112 >                                        if (nt < NThreads() && FlushQueue() < 0) return 0;
113                                          return RadSimulManager::SetThreadCount(nt);
114                                  }
115                                  /// Add ray bundle to queue w/ optional 1st ray ID
# Line 113 | Line 131 | class RtraceSimulManager : public RadSimulManager {
131                                          cookedCall = cb;
132                                          ccData = cb ? cd : NULL;
133                                  }
134 <                                /// Set/change trace callback
134 >                                /// Set/change trace callback (before threading)
135          void                    SetTraceCall(RayReportCall *cb, void *cd = NULL) {
136                                          traceCall = cb;
137                                          tcData = cb ? cd : NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines