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>
25#include <rmm/resource_ref.hpp>
27#include <thrust/iterator/zip_iterator.h>
28#include <thrust/tuple.h>
41 rmm::device_uvector<uint32_t> key;
43 rmm::device_uvector<uint8_t> level;
45 rmm::device_uvector<bool> internal_node_flag;
47 rmm::device_uvector<uint32_t> length;
49 rmm::device_uvector<uint32_t> offset;
53 using key_iterator =
decltype(point_quadtree::key)::const_iterator;
54 using level_iterator =
decltype(point_quadtree::level)::const_iterator;
55 using internal_node_flag_iterator =
decltype(point_quadtree::internal_node_flag)::const_iterator;
56 using length_iterator =
decltype(point_quadtree::length)::const_iterator;
57 using offset_iterator =
decltype(point_quadtree::offset)::const_iterator;
61 : _key_begin(quadtree.key.begin()),
62 _key_end(quadtree.key.end()),
63 _level_begin(quadtree.level.begin()),
64 _level_end(quadtree.level.end()),
65 _internal_node_flag_begin(quadtree.internal_node_flag.begin()),
66 _internal_node_flag_end(quadtree.internal_node_flag.end()),
67 _length_begin(quadtree.length.begin()),
68 _length_end(quadtree.length.end()),
69 _offset_begin(quadtree.offset.begin()),
70 _offset_end(quadtree.offset.end())
95 CUSPATIAL_HOST_DEVICE
auto num_nodes()
const {
return std::distance(_key_begin, _key_end); }
98 CUSPATIAL_HOST_DEVICE
auto key_begin()
const {
return _key_begin; }
100 CUSPATIAL_HOST_DEVICE
auto key_end()
const {
return _key_end; }
103 CUSPATIAL_HOST_DEVICE
auto level_begin()
const {
return _level_begin; }
105 CUSPATIAL_HOST_DEVICE
auto level_end()
const {
return _level_end; }
113 CUSPATIAL_HOST_DEVICE
auto length_begin()
const {
return _length_begin; }
115 CUSPATIAL_HOST_DEVICE
auto length_end()
const {
return _length_end; }
118 CUSPATIAL_HOST_DEVICE
auto offset_begin()
const {
return _offset_begin; }
120 CUSPATIAL_HOST_DEVICE
auto offset_end()
const {
return _offset_end; }
123 key_iterator _key_begin;
124 key_iterator _key_end;
125 level_iterator _level_begin;
126 level_iterator _level_end;
127 internal_node_flag_iterator _internal_node_flag_begin;
128 internal_node_flag_iterator _internal_node_flag_end;
129 length_iterator _length_begin;
130 length_iterator _length_end;
131 offset_iterator _offset_begin;
132 offset_iterator _offset_end;
170template <
class Po
intIterator,
class T =
typename cuspatial::iterator_value_type<Po
intIterator>>
172 PointIterator points_first,
173 PointIterator points_last,
179 rmm::cuda_stream_view stream = rmm::cuda_stream_default,
180 rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
188#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::device_async_resource_ref 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.