Helios++
Helios software for LiDAR simulations
SimpleKDTreeComputeRootNodeBoundariesSubTask.h
1 #pragma once
2 
3 #include <SharedSubTask.h>
4 #include <SharedTaskSequencer.h>
5 
6 
19 protected:
20  // *** ATTRIBUTES *** //
21  // ******************** //
25  vector<Primitive *> const &primitives;
30  size_t const startPrimitive;
35  size_t const endPrimitive;
39  double &ax;
43  double &ay;
47  double &az;
51  double &bx;
55  double &by;
59  double &bz;
64  std::function<void(
65  Primitive *primitive,
66  double &ax,
67  double &ay,
68  double &az,
69  double &bx,
70  double &by,
71  double &bz
73 
74 public:
75  // *** CONSTRUCTION / DESTRUCTION *** //
76  // ************************************ //
82  std::shared_ptr<SharedTaskSequencer> ch,
83  vector<Primitive *> const &primitives,
84  size_t const startPrimitive,
85  size_t const endPrimitive,
86  double &ax,
87  double &ay,
88  double &az,
89  double &bx,
90  double &by,
91  double &bz,
92  std::function<void(
93  Primitive *primitive,
94  double &ax,
95  double &ay,
96  double &az,
97  double &bx,
98  double &by,
99  double &bz
101  ) :
102  SharedSubTask(ch),
106  ax(ax), ay(ay), az(az),
107  bx(bx), by(by), bz(bz),
109  {}
111 
112  // *** RUNNABLE SHARED TASK *** //
113  // ****************************** //
120  void run() override{
121  for(size_t pi = startPrimitive ; pi < endPrimitive ; ++pi){
123  primitives[pi],
124  ax, ay, az,
125  bx, by, bz
126  );
127  }
128  }
129 };
Abstract class defining the common behavior for all primitives.
Definition: Primitive.h:24
A shared task is said to be a collection of shared sub-tasks. Each shared sub-task can be computed in...
Definition: SharedSubTask.h:16
std::shared_ptr< SharedSubTaskCompletionHandler > ch
The shared sub-task completion handler that handles what must be done after a shared sub-task executi...
Definition: SharedSubTask.h:28
Shared sub-task to compute root node boundaries when building a Simple KDTree. It is meant to be used...
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:18
double & by
coordinate of max vertex
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:55
double & bx
coordinate of max vertex
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:51
double & ay
coordinate of min vertex
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:43
vector< Primitive * > const & primitives
Vector of primitives inside given root node.
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:25
void run() override
Implementation of the compute node boundaries method but for the root node only.
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:120
size_t const startPrimitive
Index of primitive (inclusive) at which the sub-task must start to iterate.
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:30
double & bz
coordinate of max vertex
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:59
double & ax
coordinate of min vertex
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:39
size_t const endPrimitive
Index of primitive (exclusive) at which the sub-task must end iterating.
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:35
SimpleKDTreeComputeRootNodeBoundariesSubTask(std::shared_ptr< SharedTaskSequencer > ch, vector< Primitive * > const &primitives, size_t const startPrimitive, size_t const endPrimitive, double &ax, double &ay, double &az, double &bx, double &by, double &bz, std::function< void(Primitive *primitive, double &ax, double &ay, double &az, double &bx, double &by, double &bz)> onRootBoundariesDigestPrimitive)
Main constructor for Simple KDTree compute root node boundaries sub-task.
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:81
std::function< void(Primitive *primitive, double &ax, double &ay, double &az, double &bx, double &by, double &bz)> onRootBoundariesDigestPrimitive
Function to digest a primitive when computing boundaries for root node.
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:72
double & az
coordinate of min vertex
Definition: SimpleKDTreeComputeRootNodeBoundariesSubTask.h:47