42 : r_gen(123), mesh_(mesh), leaf_size_limit(soft_leaf_size_limit)
44 ASSERT(mesh !=
nullptr,
" ");
82 double left_bound=node_box.
min(axis);
83 double right_bound=node_box.
max(axis);
87 left_bound = std::max( left_bound,
elements_[ *
left ].max(axis) );
94 right_bound = std::min( right_bound,
elements_[ *
right ].min(axis) );
104 left_bound = std::max( left_bound,
elements_[ *
left ].max(axis) );
109 right_bound = std::min( right_bound,
elements_[ *
right ].min(axis) );
115 unsigned int right_end = node.
leaf_end();
116 unsigned int depth = node.
depth()+1;
120 nodes_.back().set_leaf(left_begin, left_end, left_bound, depth);
122 nodes_.back().set_leaf(left_end, right_end, right_bound, depth);
169 unsigned int median_idx;
170 unsigned int n_elements = node.
leaf_size();
174 std::uniform_int_distribution<unsigned int> distribution(node.
leaf_begin(), node.
leaf_end()-1);
176 for (
unsigned int i=0; i<
coors_.size(); i++) {
177 median_idx = distribution(this->
r_gen);
185 coors_.resize(n_elements);
186 for (
unsigned int i=0; i<
coors_.size(); i++) {
193 unsigned int median_position = (
unsigned int)(
coors_.size() / 2);
197 return coors_[median_position];
213 std::stack<unsigned int, std::vector<unsigned int> > node_stack;
217 while (! node_stack.empty()) {
243 node_stack.push( node.
child(0) );
248 node_stack.push( node.
child(1) );
257 sort(result_list.begin(), result_list.end());
258 it = unique(result_list.begin(), result_list.end());
259 ASSERT_EQUAL(searsearchedElements.size() , it - result_list.begin());