28 #include <cugar/radixtree/cuda/radixtree.h> 31 #include <thrust/transform.h> 38 template <
typename integer>
42 struct Morton_bits<uint32> {
static const uint32 value = 30u; };
45 struct Morton_bits<uint64> {
static const uint32 value = 60u; };
52 typename bvh_node_type,
54 typename range_vector,
55 typename index_vector>
56 template <
typename Iterator>
59 const Iterator points_begin,
60 const Iterator points_end,
61 const uint32 max_leaf_size,
64 const uint32 n_points = uint32( points_end - points_begin );
67 need_space( m_codes, n_points );
68 need_space( *m_index, n_points );
69 need_space( m_temp_codes, n_points );
70 need_space( m_temp_index, n_points );
74 stats->morton_time.
start();
81 points_begin + n_points,
87 thrust::counting_iterator<uint32>(0),
88 thrust::counting_iterator<uint32>(0) + n_points,
94 stats->morton_time.
stop();
95 stats->sorting_time.
start();
103 sort_buffers.keys[1] =
raw_pointer( m_temp_codes );
105 sort_buffers.values[1] =
raw_pointer( m_temp_index );
108 sort_enactor.sort( n_points, sort_buffers );
111 if (sort_buffers.selector)
113 thrust::copy( m_temp_codes.begin(), m_temp_codes.begin() + n_points, m_codes.begin() );
114 thrust::copy( m_temp_index.begin(), m_temp_index.begin() + n_points, m_index->begin() );
120 stats->sorting_time.
stop();
121 stats->build_time.
start();
126 tree_writer.set_nodes( m_nodes );
127 tree_writer.set_leaf_ranges( m_leaf_ranges );
128 tree_writer.set_leaf_pointers( m_leaf_pointers );
129 tree_writer.set_parents( m_parents );
130 tree_writer.set_skip_nodes( m_skip_nodes );
131 tree_writer.set_node_ranges( m_node_ranges );
145 m_leaf_count = m_kd_context.m_leaves;
146 m_node_count = m_kd_context.m_nodes;
149 stats->build_time.
stop();
void transform(const uint32 n, const Iterator in, const Output out, const Functor functor)
Definition: primitives_inl.h:357
Defines some general purpose algorithms.
Definition: lbvh_builder_inline.h:39
T * raw_pointer(thrust::device_vector< T, Alloc > &vec)
Definition: thrust_view.h:69
Define CUDA based sort primitives.
void start()
Definition: timer.h:103
Definition: bintree_writer.h:177
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
void build(const Bbox3f bbox, const Iterator points_begin, const Iterator points_end, const uint32 max_leaf_size, Stats *stats=NULL)
Definition: lbvh_builder_inline.h:57
Definition: lbvh_builder.h:51
void generate_radix_tree(const uint32 n_codes, const Integer *codes, const uint32 bits, const uint32 max_leaf_size, const bool keep_singletons, const bool middle_splits, Tree_writer &tree)
Definition: radixtree_inline.h:381
void stop()
Definition: timer.h:110