20 #ifndef D_TREE_POINT_LOCATOR_IMPL_H 21 #define D_TREE_POINT_LOCATOR_IMPL_H 23 #ifndef SHEAF_DLL_SPEC_H 24 #include "SheafSystem/sheaf_dll_spec.h" 27 #ifndef D_TREE_POINT_LOCATOR_H 28 #include "SheafSystem/d_tree_point_locator.h" 31 #ifndef D_BIN_POINT_LOCATOR_IMPL_H 32 #include "SheafSystem/d_bin_point_locator.impl.h" 35 #ifndef D_TREE_POINT_LOCATOR_PATH_H 36 #include "SheafSystem/d_tree_point_locator_path.h" 40 #include "SheafSystem/std_utility.h" 43 #ifndef STD_ALGORITHM_H 44 #include "SheafSystem/std_algorithm.h" 59 template <
int DC,
int DB>
67 require(xcoords.
schema().
df() == DC);
84 template <
int DC,
int DB>
92 require(xcoords.
schema().
df() == DC);
100 static_cast<size_type>((
log(leval_ct)/
log(static_cast<double>(1<<DC))));
104 _depth = ldepth > 1 ? ldepth : 1;
116 template <
int DC,
int DB>
133 template <
int DC,
int DB>
151 template <
int DC,
int DB>
174 template <
int DC,
int DB>
195 template <
int DC,
int DB>
209 result =
node_pool().allocated_size() + 1;
219 template <
int DC,
int DB>
245 template <
int DC,
int DB>
269 template <
int DC,
int DB>
290 for(
int i=0; i<DC; i++)
300 for(
int i=0; i<DC; i++)
312 template <
int DC,
int DB>
338 template <
int DC,
int DB>
352 _root.insert_box(xbox, lpath);
358 ensure(this->
box_ct() == old_box_ct + 1);
365 template <
int DC,
int DB>
380 _root.remove_box(xbox, lpath);
386 ensure(this->
box_ct() == old_box_ct - 1);
393 template <
int DC,
int DB>
401 require(xpt_ub >= this->
dc());
421 template <
int DC,
int DB>
435 result =
_root.contains_box(xbox, lpath);
445 template <
int DC,
int DB>
474 template <
int DC,
int DB>
481 invariance(
depth() > 0);
482 invariance(this->
coordinates().schema().df() == DC);
493 template <
int DC,
int DB>
494 std::ostream& operator<<(std::ostream& xos, const d_tree_point_locator<DC, DB>& xtree)
503 for(
int i=0; i< xtree.dc(); i++)
505 cout <<
" " << xtree.lb()[i];
510 for(
int i=0; i< xtree.dc(); i++)
512 cout <<
" " << xtree.ub()[i];
516 cout <<
"depth = " << xtree.depth() << endl;
517 cout <<
"root = " << xtree.root() << endl;
528 #endif // D_TREE_POINT_LOCATOR_IMPL_H virtual void update()
Updates the search structure to the current values of coordinates(); synonym for update(true);.
size_type depth() const
The number of levels; the length of the longest path from root() to a leaf.
size_type size()
The number of nodes in the tree.
virtual void remove_box(d_bounding_box< DC, DB > *xbox)
Remove xbox from the tree.
virtual bool invariant() const
Class invariant.
sec_ed & coordinates() const
The coordinate section this inverts.
virtual const box_list_type & box_list(sec_vd_value_type *xpt, size_type xpt_ub) const
The list of bounding boxes which may contain xpt.
block< sec_vd_value_type > _one_over_min_bin_size
Reciprocal of the dimensions of the smallest bins.
size_type capacity()
The nodes allocated for use by the tree.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
bool is_empty() const
True if this contains no bounding boxes.
A reallocatable pool of objects of type T. Objects in the pool are either "allocated" or linked toget...
d_tree_point_locator_node< DC, DB > _root
The root node of the tree.
static size_type leftmost_bit_id()
The index of the leftmost bit.
static size_type & default_depth()
The default depth; the depth of a instance created with the default constructor.
Fixed point relative coordinates for a tree domain.
static int_type ub()
The upper bound for components.
ptr_linked_pool< d_tree_point_locator_node< DC, DB > > & node_pool()
Pool for efficiently allocating and deallocating nodes.
virtual ~d_tree_point_locator()
Destructor.
A section of a fiber bundle with a d-dimensional Euclidean vector space fiber.
static size_type max_depth()
The maximum representable number of levels.
block< sec_vd_value_type > _lb
The lower bound of the domain.
block< size_type > _bin_ub
The upper bound for the bin index.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
A bounding box that can be strung together into a list.
void update_bins()
Updates the tree bin parameters.
size_type box_ct() const
The number of bounding boxes stored in the search structure.
SHEAF_DLL_SPEC void log(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute log of x0 (log(x0)) (pre-allocated version).
d_tree_point_locator()
Default constructor; disabled.
size_type _depth
The number of levels in the tree; the length of the longest path from the root to a leaf...
ptr_linked_pool< d_tree_point_locator_node< DC, DB > > _node_pool
Pool for efficiently allocating and deallocating nodes.
A path in an d_tree_point_locator search structure.
virtual void insert_box(d_bounding_box< DC, DB > *xbox)
Insert xbox into the tree.
void relative_position_pa(sec_vd_value_type *xpt, size_type xpt_ub, d_bin_coordinates< DC, DB > &xresult) const
The position of xpt relative to the lower bound, in integer coordinates; pre-allocated version...
size_type _box_ct
The number of bounding boxes stored in the search structure.
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
virtual void clear()
Clear the tree of all bounding boxes and all nodes except the root.
int dc() const
The spatial dimension of the domain; the dimension of the global coordinates.
int evaluation_ct() const
The number of members in the intersection of the evaluation subposet and the down set of the base spa...
const d_tree_point_locator_node< DC, DB > & root() const
The root node.
block< sec_vd_value_type > _ub
The upper bound of the domain.
int df() const
The dimension of the fiber space component.
virtual bool contains_box(d_bounding_box< DC, DB > *xbox) const
True if xbox is in the box list of some bin.
A node in a d_tree_point_locator search structure.
Namespace for geometry component of sheaf system.
SHEAF_DLL_SPEC void pow(const sec_at0 &x0, const vd_value_type &xexponent, sec_at0 &xresult, bool xauto_access)
Compute x0 to power xexponent (pow(x0, xexponent)) (pre-allocated version).
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
bool domain_contains(sec_vd_value_type *xpt, size_type xpt_ub) const
True if the domain contains xpt.
An abstract point location query in domains with global coordinate dimension dc and local coordinate ...
block< sec_vd_value_type > _bin_size
The dimensions of the smallest bins.
Wrapper class for forward_list or slist depending on compiler. The class replicates the minimum subse...