Go to the documentation of this file.
35 : leaf_size_limit(soft_leaf_size_limit)
89 double left_bound=node_box.
min(axis);
90 double right_bound=node_box.
max(axis);
94 left_bound = std::max( left_bound,
elements_[ *
left ].max(axis) );
100 right_bound = std::min( right_bound,
elements_[ *
right ].min(axis) );
109 left_bound = std::max( left_bound,
elements_[ *
left ].max(axis) );
113 right_bound = std::min( right_bound,
elements_[ *
right ].min(axis) );
118 unsigned int right_end = node.
leaf_end();
119 unsigned int depth = node.
depth()+1;
123 nodes_.back().set_leaf(left_begin, left_end, left_bound, depth);
125 nodes_.back().set_leaf(left_end, right_end, right_bound, depth);
152 height = max(height, ht);
173 height = max(height, ht);
187 unsigned int median_idx;
188 unsigned int n_elements = node.
leaf_size();
209 coors_.resize(n_elements);
210 for (
unsigned int i=0; i<
coors_.size(); i++) {
217 unsigned int median_position = (
unsigned int)(
coors_.size() / 2);
220 return coors_[median_position];
239 unsigned int counter = 0;
Armor::ArmaVec< double, spacedim > Point
std::vector< unsigned int > in_leaves_
vector stored element indexes in leaf nodes
void set_max(unsigned int axis, double max)
unsigned char depth() const
return depth of leaf node
uint make_node(const BoundingBox &box, unsigned int node_idx)
#define ASSERT_GT(a, b)
Definition of comparative assert macro (Greater Than) only for debug mode.
bool projection_gt(unsigned int axis, double value) const
std::vector< double > coors_
temporary vector stored values of coordinations for calculating median
std::vector< BIHNode > nodes_
vector of tree nodes
void expand(const Point &point)
void swap(nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value and is_nothrow_move_assignable< nlohmann::json >::value)
exchanges the values of two JSON objects
const BoundingBox & ele_bounding_box(unsigned int ele_idx) const
Gets bounding box of element of given index ele_index.
unsigned char longest_axis() const
std::vector< BoundingBox > elements_
mesh
unsigned int get_element_count() const
Bounding box in 3d ambient space.
void find_point(const Space< 3 >::Point &point, std::vector< unsigned int > &result_list, bool full_list=false) const
const BoundingBox & tree_box() const
unsigned int leaf_end() const
static const double size_reduce_factor
required reduction in size of box to allow further splitting
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
double estimate_median(unsigned char axis, const BIHNode &node)
BIHTree(unsigned int soft_leaf_size_limit=BIHTree::default_leaf_size_limit)
void add_boxes(const std::vector< BoundingBox > &boxes)
unsigned int leaf_size_limit
Maximal number of elements stored in a leaf node of BIH tree.
void set_min(unsigned int axis, double min)
BoundingBox main_box_
Main bounding box. (from mesh)
unsigned int leaf_size() const
Global macros to enhance readability and debugging, general constants.
unsigned int child(unsigned int i_child) const
Return index of child node.
bool projection_lt(unsigned int axis, double value) const
bool is_leaf() const
return true if node is leaf
void find_bounding_box(const BoundingBox &boundingBox, std::vector< unsigned int > &result_list, bool full_list=false) const
const Point & max() const
unsigned int max_n_levels
Maximal count of BIH tree levels.
unsigned int leaf_begin() const
void split_node(const BoundingBox &node_box, unsigned int node_idx)
create bounding boxes of element
static const unsigned int default_leaf_size_limit
Default leaf size limit.
unsigned int axis() const
return axes (coordination of splitting) of inner node
std::vector< unsigned int > node_stack_
Stack for search algorithms.
const Point & min() const