Helios++
Helios software for LiDAR simulations
MultiThreadSAHKDTreeFactory.h
1 #pragma once
2 
3 #include <MultiThreadKDTreeFactory.h>
4 #include <SAHKDTreeFactory.h>
5 
6 using std::shared_ptr;
7 
17 private:
18  // *** SERIALIZATION *** //
19  // *********************** //
20  friend class boost::serialization::access;
28  template <class Archive>
29  void serialize(Archive &ar, unsigned int const version){
30  boost::serialization::void_cast_register<
33  >();
34  ar &boost::serialization::base_object<MultiThreadKDTreeFactory>(*this);
35  ar &sahkdtf;
36  }
37 
38 protected:
39  // *** ATTRIBUTES *** //
40  // ******************** //
45  std::shared_ptr<SAHKDTreeFactory> sahkdtf;
54  boost::mutex ilotCacheMutex;
61  std::unique_ptr<boost::unique_lock<boost::mutex>> ilotCacheLock;
62 
63 public:
64  // *** CONSTRUCTION / DESTRUCTION *** //
65  // ************************************ //
71  shared_ptr<SimpleKDTreeFactory> const kdtf,
72  shared_ptr<SimpleKDTreeGeometricStrategy> const gs,
73  size_t const numJobs=2,
74  size_t const geomJobs=2
75  );
76  virtual ~MultiThreadSAHKDTreeFactory() = default;
77 
78  // *** CLONE *** //
79  // *************** //
83  KDTreeFactory * clone() const override;
88  void _clone(KDTreeFactory *kdtf) const override;
89 
90 };
Class that must be extended by any class which provides factory methods for k-dimensional trees....
Definition: KDTreeFactory.h:22
Decorator for any KDTree factory which provides support for multi thread KDTree building.
Definition: MultiThreadKDTreeFactory.h:34
size_t numJobs
The maximum number of jobs (threads/workers) that this factory is allowed to use.
Definition: MultiThreadKDTreeFactory.h:98
shared_ptr< SimpleKDTreeFactory > kdtf
The SimpleKDTreeFactory or derived to be used to build tree nodes.
Definition: MultiThreadKDTreeFactory.h:70
shared_ptr< SimpleKDTreeGeometricStrategy > gs
The SimpleKDTreeGeometricStrategy or derived to be used to handle geometry-level parallelization duri...
Definition: MultiThreadKDTreeFactory.h:75
size_t geomJobs
The number of jobs (threads/workers) that this factory must use when building upper KDTree nodes (geo...
Definition: MultiThreadKDTreeFactory.h:103
Decorator for any SAH KDTree which provides support for multi thread KDTree building.
Definition: MultiThreadSAHKDTreeFactory.h:15
std::shared_ptr< SAHKDTreeFactory > sahkdtf
Pointer to SAH KDTree as a casting of kdtf pointer.
Definition: MultiThreadSAHKDTreeFactory.h:45
boost::mutex ilotCacheMutex
Mutex for the ILOT cache.
Definition: MultiThreadSAHKDTreeFactory.h:54
std::unique_ptr< boost::unique_lock< boost::mutex > > ilotCacheLock
Unique pointer to store unique lock for ILOT cache.
Definition: MultiThreadSAHKDTreeFactory.h:61
KDTreeFactory * clone() const override
Definition: MultiThreadSAHKDTreeFactory.cpp:28
void serialize(Archive &ar, unsigned int const version)
Serialize a multi thread SAH KDTree factory to a stream of bytes.
Definition: MultiThreadSAHKDTreeFactory.h:29
shared_ptr< SimpleKDTreeFactory > kdtf
The SimpleKDTreeFactory or derived to be used to build tree nodes.
Definition: MultiThreadKDTreeFactory.h:70
MultiThreadSAHKDTreeFactory(shared_ptr< SimpleKDTreeFactory > const kdtf, shared_ptr< SimpleKDTreeGeometricStrategy > const gs, size_t const numJobs=2, size_t const geomJobs=2)
MultiThreadSAHKDTreeFactory default constructor.
Definition: MultiThreadSAHKDTreeFactory.cpp:5
void _clone(KDTreeFactory *kdtf) const override
Assign attributes from MultiThreadSAHKDTreeFactory to its clone.
Definition: MultiThreadSAHKDTreeFactory.cpp:42