22 |
|
/// Multi-threaded simulation manager base class |
23 |
|
class RadSimulManager { |
24 |
|
int nThreads; // number of active threads |
25 |
+ |
protected: |
26 |
+ |
/// How many cores are there? |
27 |
+ |
static int GetNCores(); |
28 |
|
public: |
29 |
|
RadSimulManager(const char *octn = NULL) { |
30 |
|
LoadOctree(octn); |
77 |
|
traceCall = NULL; tcData = NULL; |
78 |
|
} |
79 |
|
~RtraceSimulManager() {} |
80 |
+ |
/// Set number of computation threads (0 => #cores) |
81 |
+ |
int SetThreadCount(int nt = 0) { |
82 |
+ |
if (nt <= 0) nt = GetNCores(); |
83 |
+ |
if (nt == NThreads()) return nt; |
84 |
+ |
FlushQueue(); |
85 |
+ |
return RadSimulManager::SetThreadCount(nt); |
86 |
+ |
} |
87 |
|
/// Add ray bundle to queue w/ optional 1st ray ID |
88 |
|
int EnqueueBundle(const FVECT orig_direc[], int n, |
89 |
|
RNUMBER rID0 = 0); |