Helios++
Helios software for LiDAR simulations
BuddingScanningPulseProcess.h
1 #pragma once
2 
3 #include <scanner/ScanningPulseProcess.h>
4 #include <PulseTaskDropper.h>
5 #include <PulseThreadPool.h>
6 #include <TimeWatcher.h>
7 
18 #ifdef DATA_ANALYTICS
19 public:
20 #else
21 protected:
22 #endif
23  // *** ATTRIBUTES *** //
24  // ******************** //
39  std::function<void(SimulatedPulse const &sp)> handler;
40 
46  std::vector<std::vector<double>> apMatrix;
62 
66  long lastIdleNanos = 0;
72  long const idleTh = 100000;
78  long const idleEps = 100000;
79 
85 
86 #ifdef BUDDING_METRICS
87 #include <fstream>
88  std::ofstream ofsBudding;
89 #endif
90 
91 public:
92  // *** CONSTRUCTION / DESTRUCTION *** //
93  // ************************************ //
106  std::shared_ptr<Scanner> scanner,
112  );
113  virtual ~BuddingScanningPulseProcess() = default;
114 
115  // *** PULSE COMPUTATION *** //
116  // *************************** //
126  inline void handlePulseComputation(SimulatedPulse const & sp) override {
127  this->handler(sp);
128  }
133  void onLegComplete() override;
139  void onSimulationFinished() override;
140 
141 protected:
142  // *** INNER PULSE COMPUTATION *** //
143  // ********************************* //
150  virtual void handlePulseComputationSequential(SimulatedPulse const &sp);
159  SimulatedPulse const &sp
160  );
169  SimulatedPulse const &sp
170  );
171 
172 };
Class implementing a scanning pulse process which works with a pulse task dropper based on budding ta...
Definition: BuddingScanningPulseProcess.h:17
long const idleTh
Threshold so idle times which are below its value are not considered. Instead, they are discarded as ...
Definition: BuddingScanningPulseProcess.h:72
TimeWatcher idleTimer
Scan idle timer to work with thread pool idle time.
Definition: BuddingScanningPulseProcess.h:84
void handlePulseComputation(SimulatedPulse const &sp) override
Implementation of handle pulse computation method for the pair budding task dropper and pulse thread ...
Definition: BuddingScanningPulseProcess.h:126
long lastIdleNanos
Length in nanoseconds of the last idle thread time interval.
Definition: BuddingScanningPulseProcess.h:66
std::function< void(SimulatedPulse const &sp)> handler
Pulse computation handling function. It will be configured at construction depending on thread pool s...
Definition: BuddingScanningPulseProcess.h:39
void onSimulationFinished() override
Handle closing of output file stream for budding metrics when it is called with -DBUDDING_METRICS=1.
Definition: BuddingScanningPulseProcess.cpp:64
BuddingScanningPulseProcess(std::shared_ptr< Scanner > scanner, PulseTaskDropper &dropper, PulseThreadPool &pool, RandomnessGenerator< double > &randGen1, RandomnessGenerator< double > &randGen2, UniformNoiseSource< double > &intersectionHandlingNoiseSource)
Constructor for budding scanning pulse process.
Definition: BuddingScanningPulseProcess.cpp:6
std::vector< std::vector< double > > apMatrix
Alpha-Prime Matrix for sequential executions (either single thread or main thread workload)
Definition: BuddingScanningPulseProcess.h:46
void onLegComplete() override
Handle sequential computation of a chunk of pulses through task dropper.
Definition: BuddingScanningPulseProcess.cpp:47
RandomnessGenerator< double > & randGen1
First randomness generator for single thread mode.
Definition: BuddingScanningPulseProcess.h:51
long const idleEps
Tolerance so idle times differences below this threshold will not change sign of budding task dropper...
Definition: BuddingScanningPulseProcess.h:78
RandomnessGenerator< double > & randGen2
Second randomness generator for single thread mode.
Definition: BuddingScanningPulseProcess.h:56
PulseTaskDropper & dropper
The task dropper used to handle job chunks.
Definition: BuddingScanningPulseProcess.h:28
virtual void handlePulseComputationParallelStatic(SimulatedPulse const &sp)
Handle a parallel computation of scanning pulse using a static chunk-size based strategy.
Definition: BuddingScanningPulseProcess.cpp:139
UniformNoiseSource< double > & intersectionHandlingNoiseSource
Uniform noise source for single thread mode.
Definition: BuddingScanningPulseProcess.h:61
virtual void handlePulseComputationSequential(SimulatedPulse const &sp)
Handle sequential computation of scanning pulses.
Definition: BuddingScanningPulseProcess.cpp:72
virtual void handlePulseComputationParallelDynamic(SimulatedPulse const &sp)
Handle parallel computation of scanning pulses using a dynamic chunk-size based strategy.
Definition: BuddingScanningPulseProcess.cpp:84
PulseThreadPool & pool
Thread pool to be used to handle multi threading pulse computation.
Definition: BuddingScanningPulseProcess.h:33
Class implementing a task dropper to deal with pulse tasks.
Definition: PulseTaskDropper.h:27
Class implementing a thread pool to deal with pulse tasks.
Definition: PulseThreadPool.h:22
Class defining the scanning pulse process interface.
Definition: ScanningPulseProcess.h:18
std::shared_ptr< Scanner > scanner
The scanner emitting the pulses.
Definition: ScanningPulseProcess.h:31
Class representing a simulated laser pulse.
Definition: SimulatedPulse.h:10
A time watcher can be used to perform and report time measures.
Definition: TimeWatcher.h:13