20#include <cuspatial/traits.hpp>
22#include <rmm/cuda_stream_view.hpp>
23#include <rmm/device_uvector.hpp>
24#include <rmm/mr/device/per_device_resource.hpp>
26#include <thrust/iterator/zip_iterator.h>
27#include <thrust/tuple.h>
40 rmm::device_uvector<uint32_t> key;
42 rmm::device_uvector<uint8_t> level;
44 rmm::device_uvector<bool> internal_node_flag;
46 rmm::device_uvector<uint32_t> length;
48 rmm::device_uvector<uint32_t> offset;
52 using key_iterator =
decltype(point_quadtree::key)::const_iterator;
53 using level_iterator =
decltype(point_quadtree::level)::const_iterator;
54 using internal_node_flag_iterator =
decltype(point_quadtree::internal_node_flag)::const_iterator;
55 using length_iterator =
decltype(point_quadtree::length)::const_iterator;
56 using offset_iterator =
decltype(point_quadtree::offset)::const_iterator;
60 : _key_begin(quadtree.key.begin()),
61 _key_end(quadtree.key.end()),
62 _level_begin(quadtree.level.begin()),
63 _level_end(quadtree.level.end()),
64 _internal_node_flag_begin(quadtree.internal_node_flag.begin()),
65 _internal_node_flag_end(quadtree.internal_node_flag.end()),
66 _length_begin(quadtree.length.begin()),
67 _length_end(quadtree.length.end()),
68 _offset_begin(quadtree.offset.begin()),
69 _offset_end(quadtree.offset.end())
94 CUSPATIAL_HOST_DEVICE
auto num_nodes()
const {
return std::distance(_key_begin, _key_end); }
97 CUSPATIAL_HOST_DEVICE
auto key_begin()
const {
return _key_begin; }
99 CUSPATIAL_HOST_DEVICE
auto key_end()
const {
return _key_end; }
102 CUSPATIAL_HOST_DEVICE
auto level_begin()
const {
return _level_begin; }
104 CUSPATIAL_HOST_DEVICE
auto level_end()
const {
return _level_end; }
112 CUSPATIAL_HOST_DEVICE
auto length_begin()
const {
return _length_begin; }
114 CUSPATIAL_HOST_DEVICE
auto length_end()
const {
return _length_end; }
117 CUSPATIAL_HOST_DEVICE
auto offset_begin()
const {
return _offset_begin; }
119 CUSPATIAL_HOST_DEVICE
auto offset_end()
const {
return _offset_end; }
122 key_iterator _key_begin;
123 key_iterator _key_end;
124 level_iterator _level_begin;
125 level_iterator _level_end;
126 internal_node_flag_iterator _internal_node_flag_begin;
127 internal_node_flag_iterator _internal_node_flag_end;
128 length_iterator _length_begin;
129 length_iterator _length_end;
130 offset_iterator _offset_begin;
131 offset_iterator _offset_end;
169template <
class Po
intIterator,
class T =
typename cuspatial::iterator_value_type<Po
intIterator>>
171 PointIterator points_first,
172 PointIterator points_last,
178 rmm::cuda_stream_view stream = rmm::cuda_stream_default,
179 rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
187#include <cuspatial/detail/point_quadtree.cuh>
std::pair< rmm::device_uvector< uint32_t >, point_quadtree > quadtree_on_points(PointIterator points_first, PointIterator points_last, vec_2d< T > vertex_1, vec_2d< T > vertex_2, T scale, int8_t max_depth, int32_t max_size, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a quadtree structure from points.
CUSPATIAL_HOST_DEVICE auto length_begin() const
Return iterator to the first length of the quadtree.
CUSPATIAL_HOST_DEVICE auto offset_end() const
Return iterator to the last child / point offset of the quadtree.
CUSPATIAL_HOST_DEVICE auto length_end() const
Return iterator to the last length of the quadtree.
CUSPATIAL_HOST_DEVICE auto offset_begin() const
Return iterator to the first child / point offset of the quadtree.
CUSPATIAL_HOST_DEVICE auto internal_node_flag_begin() const
Return iterator to the first internal node flag of the quadtree.
CUSPATIAL_HOST_DEVICE auto key_begin() const
Return iterator to the first ring of the quadtree.
CUSPATIAL_HOST_DEVICE auto num_nodes() const
Return the number of keys in the quadtree.
CUSPATIAL_HOST_DEVICE auto key_end() const
Return iterator to the last ring of the quadtree.
CUSPATIAL_HOST_DEVICE auto internal_node_flag_end() const
Return iterator to the last internal node flag of the quadtree.
point_quadtree_ref(key_iterator key_begin, key_iterator key_end, level_iterator level_begin, internal_node_flag_iterator internal_node_flag_begin, length_iterator length_begin, offset_iterator offset_begin)
Construct from iterators and size.
point_quadtree_ref(point_quadtree const &quadtree)
Construct from a point_quadtree struct.
CUSPATIAL_HOST_DEVICE auto level_end() const
Return iterator to the last level of the quadtree.
CUSPATIAL_HOST_DEVICE auto level_begin() const
Return iterator to the first level of the quadtree.