MRPTree v0.5.0.0 lib 0.5.0.0
MR 2^P Trees (MRPTree)
|
Template Class used to house an MR_rect_tree. More...
#include <MR_rect_tree.hpp>
Template Parameter Types | |
typedef MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim > | this_t |
Externally exposed typedef for spc_real_t. | |
typedef spc_real_t | src_t |
Externally exposed typedef for spc_real_t. | |
Domain Real Coordinates | |
typedef std::vector< src_t > | drtv_t |
std::vector for values in the domain space. | |
typedef std::array< src_t, dom_dim > | drta_t |
An std::array for points in the domain space. | |
typedef std::conditional< std::cmp_equal(dom_dim, 1), src_t, drta_t >::type | drpt_t |
For values in the domain space. | |
typedef drpt_t | real_domain_t |
A nicely descriptive typedef for drpt_t. | |
Range Real Coordinates | |
typedef std::vector< src_t > | rrtv_t |
std::vector for values in the range space. | |
typedef std::array< src_t, rng_dim > | rrta_t |
An std::array for points in the range space. | |
typedef std::conditional< std::cmp_equal(rng_dim, 1), src_t, rrta_t >::type | rrpt_t |
For values in the range space. | |
typedef rrpt_t | real_range_t |
A nicely descriptive typedef for rrpt_t. | |
Domain Integer Coordinates | |
typedef priv_dic_t | dic_t |
Unsigned integer type large large enough to hold an integer coordiante component. | |
typedef priv_diti_t | diti_t |
Unsigned integer type large large enough to hold an integer coordiante tuple. | |
typedef std::array< dic_t, 3 > | dita_t |
Domain point given as an std::array integer tuple. | |
typedef std::vector< dic_t > | ditv_t |
Domain point given as an std::vector integer tuple. | |
typedef std::vector< diti_t > | diti_list_t |
A std::vector used to pass lists of diti_t types around. | |
typedef std::conditional< std::cmp_greater_equal(CHAR_BIT *sizeof(int8_t), dic_bits), uint8_t, typenamestd::conditional< std::cmp_greater_equal(CHAR_BIT *sizeof(int16_t), dic_bits), uint16_t, typenamestd::conditional< std::cmp_greater_equal(CHAR_BIT *sizeof(int32_t), dic_bits), uint32_t, uint64_t >::type >::type >::type | priv_dic_t |
typedef std::conditional< std::cmp_greater_equal(CHAR_BIT *sizeof(int8_t), diti_bits), uint8_t, typenamestd::conditional< std::cmp_greater_equal(CHAR_BIT *sizeof(int16_t), diti_bits), uint16_t, typenamestd::conditional< std::cmp_greater_equal(CHAR_BIT *sizeof(int32_t), diti_bits), uint32_t, uint64_t >::type >::type >::type | priv_diti_t |
static constexpr int | dic_bits = max_level+1 |
The number of bits used by a single component of an integer coordinate tuple. | |
static constexpr int | diti_bits = dic_bits * dom_dim |
The number of bits used by an entire integer coordinate tuple. | |
static constexpr dic_t | dic_max = (static_cast<dic_t>(1) << max_level) |
Maximum allowd for a dic_t. | |
static constexpr dic_t | dic_ctr = (static_cast<dic_t>(1) << (max_level-1)) |
Center value for a dic_t. | |
static constexpr dic_t | dic_min = 0 |
Minimum allowd for a dic_t. | |
static constexpr diti_t | diti_ones = ~static_cast<diti_t>(0) |
static constexpr diti_t | diti_msk0 = static_cast<diti_t>(~(diti_ones << dic_bits)) |
Function Types | |
typedef std::function< rrpt_t(drpt_t)> | drpt2rrpt_func_t |
Real input sample function. | |
typedef std::function< bool(diti_t)> | diti2bool_func_t |
Integer input predicate function. | |
typedef std::function< bool(drpt_t)> | drpt2bool_func_t |
Real input predicate function. | |
typedef std::function< src_t(drpt_t)> | drpt2real_func_t |
Real input, single real variable output function. | |
Template Parameter Constants | |
static constexpr int | domain_dimension = dom_dim |
The value of the template parameter dom_dim. | |
static constexpr int | range_dimension = rng_dim |
The value of the template parameter rng_dim. | |
static constexpr int | maximum_level = max_level |
The value of the template parameter max_level. | |
Data Members | |
drpt_t | bbox_min |
Holds the minimal point for the real domain range. | |
drpt_t | bbox_max |
Holds the maximal point for the real domain range. | |
drpt_t | bbox_delta |
The wdith of the real domain range. | |
std::unordered_map< diti_t, rrpt_t > | samples |
Holds the sampled data. | |
Constructors | |
MR_rect_tree () | |
Set real coordinates to defaults. | |
MR_rect_tree (drpt_t new_bbox_min, drpt_t new_bbox_max) | |
Set real coordinate as specified. | |
Construction Helpers | |
void | update_bbox_delta () |
Update the value of bbox_delta. | |
void | set_bbox (drpt_t new_bbox_min, drpt_t new_bbox_max) |
Set the bounding box. | |
void | set_bbox_default () |
Set the bounding box to the default: -1 for all minimum components and +1 for all maximum components. | |
void | set_bbox_min (drpt_t new_bbox_min) |
Set the bounding box minimum. | |
void | set_bbox_max (drpt_t new_bbox_max) |
Set the bounding box max_level. | |
Basic Class Info | |
drpt_t | get_bbox_min () const |
Return the bounding box minimum point. | |
drpt_t | get_bbox_max () const |
Return the bounding box minimum point. | |
drpt_t | get_bbox_delta () const |
Return the bounding box minimum point. | |
rrpt_t | get_sample (diti_t vertex) const |
Return the sample value for vertex. | |
rrta_t | get_sample_rrta (diti_t vertex) const |
Return the sample value for vertex as an rrta_t (an std::array) | |
std::unordered_map< diti_t, rrpt_t >::const_iterator | cbegin_samples () |
Provide a constant forward iterator for the sample data. | |
std::unordered_map< diti_t, rrpt_t >::const_iterator | cend_samples () |
Provide a constant end iterator for the sample data. | |
Cell Oriented Coordinate Computation | |
These functions compute theoretical values based on a given cell center coordinate, and have nothing to do with sample state. For example, the ccc_get_top_cell() function returns the coordinates that would be used to identify the tree's top cell; however, this function tells us nothing about if that cell exists (as been sampled) in the tree. In general these routines are optimized for performance, and do not preform any error checking.
| |
diti_t | ccc_get_top_cell () const |
Compute the top cell coordinates for the tree. | |
dic_t | ccc_cell_level (diti_t cell) const |
Compute cell level. | |
dic_t | ccc_cell_quarter_width (diti_t cell) const |
Compute cell quarter width. | |
dic_t | ccc_cell_half_width (diti_t cell) const |
Compute cell half width. | |
dic_t | ccc_cell_full_width (diti_t cell) const |
Compute cell full width. | |
diti_t | ccc_cell_get_corner_min (diti_t cell) const |
Cell first corner. | |
diti_t | ccc_cell_get_corner_max (diti_t cell) const |
Cell last corner. | |
diti_list_t | ccc_get_corners (diti_t cell) const |
Return a list of the corners of the given cell. | |
diti_list_t | ccc_get_corners (diti_t cell, int index, int direction) const |
Return a list of the corners of the given cell. | |
diti_list_t | ccc_get_neighbors (diti_t cell) const |
Return a list of potential neighbor cells of the specified cell Note the cells are not in canonical order! | |
diti_t | ccc_get_neighbor (diti_t cell, int index, int direction) const |
Return the potential neighbor cell along the given axis in the specified direction. | |
diti_list_t | ccc_get_children (diti_t cell) const |
Return a list of child cells of the specified cell. | |
diti_list_t | ccc_get_children (diti_t cell, int index, int direction) const |
Return a list of child cells of the specified cell An empty vector is returned if no children are possible. | |
diti_list_t | ccc_get_vertexes (diti_t cell) const |
Return a list of the vertexes (corners and center) of the given cell. | |
Low Level Integer Tuple Computation | |
These functions encapsulate various coordinate computations. In general these routines are optimized for performance, and do not preform any error checking. For example it is possible to underflow/overflow with inappropriate values. | |
dic_t | cuc_get_crd (diti_t diti, int index) const |
Extract a component from a tuple. | |
diti_t | cuc_inc_crd (diti_t diti, int index, dic_t value) const |
Incriment a component in a a tuple. | |
diti_t | cuc_dec_crd (diti_t diti, int index, dic_t value) const |
Decriment a component in a a tuple. | |
diti_t | cuc_dec_all_crd (diti_t diti, dic_t value) const |
Decriment all components in a a tuple. | |
diti_t | cuc_inc_all_crd (diti_t diti, dic_t value) const |
Incriment all components in a a tuple. | |
diti_t | cuc_set_all_crd (dic_t value) const |
Set all components in a a tuple to a constant. | |
diti_list_t | cuc_two_cross (diti_t diti, dic_t delta) const |
Compute cross product points centered at diti and delta away Examples: | |
diti_list_t | cuc_two_cross (diti_t diti, dic_t delta, int index, int direction) const |
Compute directional cross product points centered at diti and delta away. | |
diti_list_t | cuc_axis_cross (diti_t diti, dic_t delta) const |
Compute axis aligned cross points centered at diti and delta away Axis aligned cross points that fall outside of the domain will not be returned. | |
Easy way to treat rrpt_t & drpt_t types as indexable regardless of dom_dim & rng_dim. | |
src_t | rng_at (rrpt_t value, int index) const |
src_t | dom_at (drpt_t value, int index) const |
Packed Integer Tuple <-> std::array of Integer Tuple Conversions | |
diti_t | dita_to_diti (const dita_t &dita) const |
Convert an std::array of integer coordinate tuple to an packed integer coordinate tuple. | |
dita_t | diti_to_dita (diti_t diti) const |
Convert a packed integer coordinate tuple to an std::array of integer coordinate tuple Note dita_t is always an std::array even when dom_dim==1. | |
Integer Tuple to Domain Space Tuple Conversion | |
drpt_t | diti_to_drpt (diti_t diti) const |
Convert a packed integer coordinate tuple to the coorisponding coordinate in drpt_t Note this function might return a scalar (float, double, etc...) or a std::array! | |
drta_t | diti_to_drta (diti_t diti) const |
Convert a packed integer coordinate tuple to the coorisponding std::array tuple of src_t Unlike diti_to_drpt, this function ALWAYS returns an std::array! | |
Function Sampleing | |
Note that refine_grid() is a hybrid in that it can be used for both refinement and for sampling. | |
void | sample_cell (diti_t cell, drpt2rrpt_func_t func) |
Sample a cell. | |
void | sample_cell (drpt2rrpt_func_t func) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | sample_point_maybe (diti_t diti, drpt2rrpt_func_t func) |
Sample a point if it has not already been sampled. | |
void | sample_point (diti_t diti, drpt2rrpt_func_t func) |
Sample, or resample, a point. | |
Real Range Space Computation | |
bool | rrpt_is_nan (rrpt_t val) const |
Test if a point in the range space contains a NaN coordinate value. | |
src_t | rrpt_distance_inf (rrpt_t val1, rrpt_t val2) const |
Distance between two points in the range space using the infinity norm (max absolute value) | |
Real Domain Space Computation | |
src_t | drpt_distance_inf (drpt_t val1, drpt_t val2) const |
Distance between two points in the domain space using the infinity norm (max absolute value) | |
drpt_t | drpt_midpoint (drpt_t val1, drpt_t val2) const |
Return the midpoint between two points in the domain space. | |
Tree/Cell Refinement | |
Three general function smalpling stratigies are provided:
| |
bool | refine_once (diti_t cell, drpt2rrpt_func_t func) |
Refine a cell if possible. | |
void | refine_grid (diti_t cell, int level_delta, drpt2rrpt_func_t func) |
Sample a function uniformly across given cell to the given level. | |
void | refine_grid (int level_delta, drpt2rrpt_func_t func) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | refine_recursive (diti_t cell, int level, drpt2rrpt_func_t func) |
Refine a cell until refined cells reach specified level. | |
void | refine_recursive (int level, drpt2rrpt_func_t func) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | refine_recursive_cell_pred (diti_t cell, int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
Refine a cells matching predicate until refined cells reach specified level. | |
void | refine_leaves_recursive_cell_pred (diti_t cell, int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
Refine a cells matching predicate until refined cells reach specified level. | |
void | refine_leaves_recursive_cell_pred (int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
int | refine_leaves_once_if_cell_pred (diti_t cell, int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
Refine each leaf cell if pred returns true and the cell level is less than the given level value. | |
int | refine_leaves_once_if_cell_pred (int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
int | refine_leaves_atomically_if_cell_pred (diti_t cell, int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
Repeatedly refine leaves of the given cell for which pred is true. | |
int | refine_leaves_atomically_if_cell_pred (int level, drpt2rrpt_func_t func, diti2bool_func_t pred) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | refine_recursive_if_cell_vertex_is_nan (int level, drpt2rrpt_func_t func) |
Refine a cells with NaNs until refined cells reach specified level. | |
int | refine_leaves_once_if_unbalanced (int level_delta, drpt2rrpt_func_t func) |
Refine leaf cells if they are unbalanced at the given level. | |
void | balance_tree (int level_delta, drpt2rrpt_func_t func) |
Balance the cell to the given level. | |
Cell Predicates | |
bool | cell_good_cords (diti_t cell) const |
Check if cell coordinates are in range to be a cell center. | |
bool | cell_exists (diti_t cell) const |
Test if a cell has been sampled. | |
bool | cell_is_sampled (diti_t cell) const |
Test if a cell has been sampled. | |
bool | cell_vertex_is_nan (diti_t cell) |
Test if a cell has a vertex with a NaN value for a sample. | |
bool | cell_corner_is_nan (diti_t cell) |
Test if a cell has an corner with a NaN value for a sample. | |
bool | cell_has_child (diti_t cell) const |
Test if a cell has children. | |
bool | cell_has_no_child (diti_t cell) const |
Test if a cell has no children. | |
bool | cell_can_have_children (diti_t cell) const |
Test if a cell can have children (it not of minimal size) | |
bool | cell_has_neighbor (diti_t cell, int index, int direction) |
Test if the specified neighbor cell exixts (is smapled). | |
bool | cell_cross_sdf (diti_t cell, drpt2real_func_t sdf) |
Test if a cell crosses, or is on, a signed distance function boundry. | |
bool | cell_near_domain_point (drpt_t domain_point, src_t epsilon, diti_t cell) |
Test if a cell contains, or is close to, a point in the domain. | |
bool | cell_near_domain_level (diti_t cell, int domain_index, src_t domain_level, src_t epsilon) |
Test if a cell crosses the given domain component value. | |
bool | cell_below_domain_level (diti_t cell, int domain_index, src_t domain_level) |
Test if a cell is below the given domain component value. | |
bool | cell_above_domain_level (diti_t cell, int domain_index, src_t domain_level) |
Test if a cell above the given domain component value. | |
bool | cell_cross_range_level (diti_t cell, int range_index, src_t range_level) |
Test if a cell crosses the given range component value. | |
bool | cell_below_range_level (diti_t cell, int range_index, src_t range_level) |
Test if a cell is below given range component value. | |
bool | cell_above_range_level (diti_t cell, int range_index, src_t range_level) |
Test if a cell is above given range component value. | |
bool | cell_is_unbalanced (int level_delta, diti_t cell) |
Test if a cell is unbalanced at the given level. | |
Vertex Predicates | |
bool | vertex_is_nan (diti_t vertex) |
Test if a vertex is NaN or, when it is an std::array, if it contains a NaN element. | |
bool | vertex_exists (diti_t vertex) const |
Point has been sampled. | |
Extract Cells | |
diti_list_t | get_leaf_cells (diti_t cell) const |
Extract a list of all leaf cells starting from the given cell. | |
diti_list_t | get_leaf_cells () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
diti_list_t | get_leaf_cells_pred (diti_t cell, diti2bool_func_t pred) const |
Extract a list of all leaf cells starting from the given cell that match the given predicate. | |
diti_list_t | get_leaf_cells (diti_t cell, int index, int direction) const |
Extract a list of all leaf cells starting from the given cell. | |
int | count_leaf_cells (diti_t cell) const |
Count the number of leaf cells starting from the given cell. | |
diti_list_t | get_existing_neighbor (diti_t cell, int index, int direction) const |
Return a list of sampled neighbors to the given cell. | |
int | get_smallest_neighbor_level (diti_t cell) const |
Return the level of the smallest, existing neighbor. | |
Debug | |
std::string | diti_to_string (diti_t diti, bool include_domain, bool do_hex) const |
Convert a diti_t to a string representation. | |
std::string | diti_to_string (diti_t diti, bool include_domain) const |
std::string | diti_to_string (diti_t diti) const |
std::string | drpt_to_string (drpt_t x) const |
Convert a drpt_t to a string representation. | |
std::string | rrpt_to_string (rrpt_t x) const |
Convert rrpt value to a string representation. | |
void | dump_tree (int max_num_print) const |
Dump tree to STDOUT. | |
int | dump_tree_datafile (std::string file_name) const |
Dump tree points to file – one tuple per line with domain coordinates followed by range values. | |
Template Class used to house an MR_rect_tree.
This class forms the primary component of the MR \(2^P\mathrm{-Tree}\) library (also known as "MRPTree"). In terms of this library, a quadtree is a \(2^2\mathrm{-Tree}\) and an octree is a \(2^3\mathrm{-Tree}\) – in essence this class implements a universal data structure capable of holding such trees of any dimension. Contrary to the name, this is all achieved without using any tree-like data structures at all!
The dom_dim
template parameter corresponds to the "@f$P@f$" in the exponent. If one wishes to implement a quadtree, then dom_dim should be set to 2. For octrees the value of dom_dim should be set to 3. We are not limited to dimensions 2 & 3 – for example, we could make 1D "bitrees" or a 4D "space
time trees".
This class makes the unusual assumption that the sampled data stored in the tree is a finite, real vector space. So instead of using a template parameter to specify the type of the sampled data, we provide 1) a type for the vector space scalar (spc_real_t) and 2) a dimension (rng_dim). In other words these trees are optimized to model model functions \(f:\mathbb{R}^d\rightarrow\mathbb{R}^r\) where \(d\) and \(r\) are template parameters(dom_dim
& rng_dim
respectively).
The max_level
parameter will seem odd for anyone who has used a traditional quadtree/octree library. As a practical matter trees in traditional libraries are limited to a shallow depths (say 10 or 12 levels); however, the code bases themselves don't usually place an explicit limit on depth. In this library the maximum depth must be specified from the start.
As an example, suppose we have a function \(f:\mathbb{R}^2\rightarrow\mathbb{R}^3\) we wish to sample. For this application we might use the following values:
spc_real_t = double
dom_dim = 2
rng_dim = 3
max_level = 15
We could use an alternate value for max_level
, but I think 15 is a good balance. We can do quadtrees at this depth using 32-bit integer keys, and we can do octrees with 64-bit integer keys.
dom_dim
or rng_dim
element std::arraydom_dim
or rng_dim
element std::vectordim==1
, and an array otherwise Function arguments of type "`foo_t`" are frequently called "`foo`".max_level | The maximum depth of the tree – use one minus a power of two for highest performance. |
spc_real_t | The base floating type to use for both domain & range. |
dom_dim | Domain dimension. |
rng_dim | Range dimension. |
Definition at line 134 of file MR_rect_tree.hpp.
priv_dic_t mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::dic_t |
Unsigned integer type large large enough to hold an integer coordiante component.
Definition at line 238 of file MR_rect_tree.hpp.
std::array<dic_t, 3> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::dita_t |
Domain point given as an std::array integer tuple.
Definition at line 244 of file MR_rect_tree.hpp.
std::function<bool(diti_t)> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti2bool_func_t |
Integer input predicate function.
Definition at line 267 of file MR_rect_tree.hpp.
std::vector<diti_t> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti_list_t |
A std::vector used to pass lists of diti_t types around.
Definition at line 250 of file MR_rect_tree.hpp.
priv_diti_t mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti_t |
Unsigned integer type large large enough to hold an integer coordiante tuple.
Definition at line 241 of file MR_rect_tree.hpp.
std::vector<dic_t> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::ditv_t |
Domain point given as an std::vector integer tuple.
Definition at line 247 of file MR_rect_tree.hpp.
std::function<bool(drpt_t)> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::drpt2bool_func_t |
Real input predicate function.
Definition at line 270 of file MR_rect_tree.hpp.
std::function<src_t(drpt_t)> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::drpt2real_func_t |
Real input, single real variable output function.
Definition at line 273 of file MR_rect_tree.hpp.
std::function<rrpt_t(drpt_t)> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::drpt2rrpt_func_t |
Real input sample function.
Definition at line 264 of file MR_rect_tree.hpp.
std::conditional<std::cmp_equal(dom_dim,1),src_t,drta_t>::type mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::drpt_t |
For values in the domain space.
Definition at line 172 of file MR_rect_tree.hpp.
std::array<src_t, dom_dim> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::drta_t |
An std::array for points in the domain space.
Definition at line 167 of file MR_rect_tree.hpp.
std::vector<src_t> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::drtv_t |
std::vector for values in the domain space.
Definition at line 164 of file MR_rect_tree.hpp.
|
private |
Definition at line 221 of file MR_rect_tree.hpp.
|
private |
Definition at line 228 of file MR_rect_tree.hpp.
drpt_t mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::real_domain_t |
A nicely descriptive typedef for drpt_t.
Definition at line 175 of file MR_rect_tree.hpp.
rrpt_t mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::real_range_t |
A nicely descriptive typedef for rrpt_t.
Definition at line 194 of file MR_rect_tree.hpp.
std::conditional<std::cmp_equal(rng_dim,1),src_t,rrta_t>::type mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::rrpt_t |
For values in the range space.
Definition at line 191 of file MR_rect_tree.hpp.
std::array<src_t, rng_dim> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::rrta_t |
An std::array for points in the range space.
Definition at line 186 of file MR_rect_tree.hpp.
std::vector<src_t> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::rrtv_t |
std::vector for values in the range space.
Definition at line 183 of file MR_rect_tree.hpp.
spc_real_t mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::src_t |
Externally exposed typedef for spc_real_t.
Definition at line 156 of file MR_rect_tree.hpp.
MR_rect_tree<max_level, spc_real_t, dom_dim, rng_dim> mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::this_t |
Externally exposed typedef for spc_real_t.
Definition at line 153 of file MR_rect_tree.hpp.
|
inline |
Set real coordinates to defaults.
see: set_bbox_default().
Definition at line 305 of file MR_rect_tree.hpp.
|
inline |
Set real coordinate as specified.
new_bbox_min | Value to use for bounding box minimum point |
new_bbox_max | Value to use for bounding box maximum point |
Definition at line 310 of file MR_rect_tree.hpp.
|
inline |
Balance the cell to the given level.
This is a convenience function combining refine_leaves_atomically_if_cell_pred(), cell_is_unbalanced(), & ccc_get_top_cell().
level_delta | The Level. |
func | Function to sample |
Definition at line 1146 of file MR_rect_tree.hpp.
|
inline |
Provide a constant forward iterator for the sample data.
Sample data is stored as a pair with the first element being the packed integer domain coordinates and the second being the sampled data.
Definition at line 397 of file MR_rect_tree.hpp.
|
inline |
Compute cell full width.
cell | Input cell |
Definition at line 448 of file MR_rect_tree.hpp.
|
inline |
Cell last corner.
cell | Input cell |
Definition at line 460 of file MR_rect_tree.hpp.
|
inline |
Cell first corner.
cell | Input cell |
Definition at line 454 of file MR_rect_tree.hpp.
|
inline |
Compute cell half width.
cell | Input cell |
Definition at line 442 of file MR_rect_tree.hpp.
|
inline |
Compute cell level.
cell | Input cell |
Definition at line 430 of file MR_rect_tree.hpp.
|
inline |
Compute cell quarter width.
cell | Input cell |
Definition at line 436 of file MR_rect_tree.hpp.
|
inline |
Return a list of child cells of the specified cell.
cell | Input cell |
Definition at line 504 of file MR_rect_tree.hpp.
|
inline |
Return a list of child cells of the specified cell An empty vector is returned if no children are possible.
cell | Input cell |
index | The index of the axis. Must be in [0, dom_dim-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
Definition at line 519 of file MR_rect_tree.hpp.
|
inline |
Return a list of the corners of the given cell.
cell | Input cell |
Definition at line 465 of file MR_rect_tree.hpp.
|
inline |
Return a list of the corners of the given cell.
cell | Input cell |
index | The index of the axis. Must be in [0, dom_dim-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
Definition at line 472 of file MR_rect_tree.hpp.
|
inline |
Return the potential neighbor cell along the given axis in the specified direction.
cell | Input cell |
index | The index of the axis. Must be in [0, dom_dim-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
Definition at line 486 of file MR_rect_tree.hpp.
|
inline |
Return a list of potential neighbor cells of the specified cell Note the cells are not in canonical order!
cell | Input cell |
Definition at line 478 of file MR_rect_tree.hpp.
|
inline |
Compute the top cell coordinates for the tree.
Definition at line 423 of file MR_rect_tree.hpp.
|
inline |
Return a list of the vertexes (corners and center) of the given cell.
cell | Input cell |
Definition at line 529 of file MR_rect_tree.hpp.
|
inline |
Test if a cell above the given domain component value.
cell | Input Cell |
domain_index | The index of the domain component we are testing |
domain_level | The level, or value, of the domain component we are testing |
Definition at line 1303 of file MR_rect_tree.hpp.
|
inline |
Test if a cell is above given range component value.
cell | Input Cell |
range_index | The index of the range component we are testing |
range_level | The level, or value, of the range component we are testing |
Definition at line 1338 of file MR_rect_tree.hpp.
|
inline |
Test if a cell is below the given domain component value.
cell | Input Cell |
domain_index | The index of the domain component we are testing |
domain_level | The level, or value, of the domain component we are testing |
Definition at line 1294 of file MR_rect_tree.hpp.
|
inline |
Test if a cell is below given range component value.
cell | Input Cell |
range_index | The index of the range component we are testing |
range_level | The level, or value, of the range component we are testing |
Definition at line 1328 of file MR_rect_tree.hpp.
|
inline |
Test if a cell can have children (it not of minimal size)
cell | Input cell |
Definition at line 1220 of file MR_rect_tree.hpp.
|
inline |
Test if a cell has an corner with a NaN value for a sample.
cell | Input cell |
Definition at line 1199 of file MR_rect_tree.hpp.
|
inline |
Test if a cell crosses the given range component value.
See cell_cross_sdf for algorithm notes.
cell | Input Cell |
range_index | The index of the range component we are testing |
range_level | The level, or value, of the range component we are testing |
Definition at line 1313 of file MR_rect_tree.hpp.
|
inline |
Test if a cell crosses, or is on, a signed distance function boundry.
"Crossing" is defined as: The center is zero or any corner has a diffrent sign from the center.
cell | Input Cell |
sdf | Signed distance function |
Definition at line 1242 of file MR_rect_tree.hpp.
|
inline |
Test if a cell has been sampled.
cell | Input cell |
Definition at line 1178 of file MR_rect_tree.hpp.
|
inline |
Check if cell coordinates are in range to be a cell center.
cell | Input cell |
Definition at line 1159 of file MR_rect_tree.hpp.
|
inline |
Test if a cell has children.
cell | Input cell |
Definition at line 1207 of file MR_rect_tree.hpp.
|
inline |
Test if the specified neighbor cell exixts (is smapled).
index | The index of the axis. Must be in [0, dom_dim-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
cell | Input cell |
Definition at line 1228 of file MR_rect_tree.hpp.
|
inline |
Test if a cell has no children.
cell | Input cell |
Definition at line 1214 of file MR_rect_tree.hpp.
|
inline |
Test if a cell has been sampled.
cell | Input cell |
Definition at line 1185 of file MR_rect_tree.hpp.
|
inline |
Test if a cell is unbalanced at the given level.
cell | Input Cell |
level_delta | Signed distance function |
Definition at line 1347 of file MR_rect_tree.hpp.
|
inline |
Test if a cell crosses the given domain component value.
cell | Input Cell |
domain_index | The index of the domain component we are testing |
domain_level | The level, or value, of the domain component we are testing |
epsilon | Used to fuzz floating point comparisons |
Definition at line 1284 of file MR_rect_tree.hpp.
|
inline |
Test if a cell contains, or is close to, a point in the domain.
domain_point | The point in the domain |
epsilon | How close the point must be |
cell | Input Cell |
Definition at line 1266 of file MR_rect_tree.hpp.
|
inline |
Test if a cell has a vertex with a NaN value for a sample.
cell | Input cell |
Definition at line 1192 of file MR_rect_tree.hpp.
Referenced by mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::refine_recursive_if_cell_vertex_is_nan().
|
inline |
Provide a constant end iterator for the sample data.
see: cbegin_samples().
Definition at line 401 of file MR_rect_tree.hpp.
|
inline |
Count the number of leaf cells starting from the given cell.
cell | Starting cell |
Definition at line 1434 of file MR_rect_tree.hpp.
|
inline |
Compute axis aligned cross points centered at diti and delta away Axis aligned cross points that fall outside of the domain will not be returned.
For example, if diti=0, then we get no points to the left. Examples:
diti | Center coordinates for the cross |
delta | The Distance for the cross points |
Definition at line 685 of file MR_rect_tree.hpp.
|
inline |
Decriment all components in a a tuple.
diti | The input tuple |
value | Amout by which to decrement each component |
Definition at line 568 of file MR_rect_tree.hpp.
|
inline |
Decriment a component in a a tuple.
diti | The input tuple |
index | Which component to incriment |
value | Amout by which to decrement the component |
Definition at line 562 of file MR_rect_tree.hpp.
|
inline |
Extract a component from a tuple.
diti | The input tuple |
index | Which component to extract |
Definition at line 548 of file MR_rect_tree.hpp.
|
inline |
Incriment all components in a a tuple.
diti | The input tuple |
value | Amout by which to increment each component |
Definition at line 586 of file MR_rect_tree.hpp.
|
inline |
Incriment a component in a a tuple.
diti | The input tuple |
index | Which component to incriment |
value | Amout by which to increment the component |
Definition at line 555 of file MR_rect_tree.hpp.
|
inline |
Set all components in a a tuple to a constant.
value | The value for each component |
Definition at line 603 of file MR_rect_tree.hpp.
|
inline |
Compute cross product points centered at diti and delta away Examples:
diti | Center coordinates for the cross product points |
delta | The Distance for the cross product points |
Definition at line 623 of file MR_rect_tree.hpp.
|
inline |
Compute directional cross product points centered at diti and delta away.
diti | Center coordinates for the cross product points |
delta | The Distance for the cross product points. |
index | The index to hold constant. Must be in [0, dom_dom-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
Definition at line 654 of file MR_rect_tree.hpp.
|
inline |
Convert an std::array of integer coordinate tuple to an packed integer coordinate tuple.
dita | The std::array of integer coordinate |
Definition at line 733 of file MR_rect_tree.hpp.
|
inline |
Convert a packed integer coordinate tuple to an std::array of integer coordinate tuple Note dita_t is always an std::array even when dom_dim==1.
diti | Packed integer coordinate tuple |
Definition at line 748 of file MR_rect_tree.hpp.
|
inline |
Convert a packed integer coordinate tuple to the coorisponding coordinate in drpt_t Note this function might return a scalar (float, double, etc...) or a std::array!
diti | Input integer tuple |
Definition at line 768 of file MR_rect_tree.hpp.
|
inline |
Convert a packed integer coordinate tuple to the coorisponding std::array tuple of src_t Unlike diti_to_drpt, this function ALWAYS returns an std::array!
diti | Input integer tuple |
Definition at line 785 of file MR_rect_tree.hpp.
|
inline |
Definition at line 1519 of file MR_rect_tree.hpp.
References mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti_to_string().
Referenced by mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti_to_string().
|
inline |
Definition at line 1517 of file MR_rect_tree.hpp.
References mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti_to_string().
Referenced by mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::diti_to_string().
|
inline |
Convert a diti_t to a string representation.
diti | The diti_t to convert |
do_hex | Print hex if true |
include_domain | When true, also include the real coordinates in the string representation. |
Definition at line 1501 of file MR_rect_tree.hpp.
|
inline |
Definition at line 717 of file MR_rect_tree.hpp.
|
inline |
Distance between two points in the domain space using the infinity norm (max absolute value)
val1 | Value in domain space |
val2 | Value in domain space |
Definition at line 881 of file MR_rect_tree.hpp.
|
inline |
Return the midpoint between two points in the domain space.
val1 | Value in domain space |
val2 | Value in domain space |
Definition at line 895 of file MR_rect_tree.hpp.
|
inline |
Convert a drpt_t to a string representation.
Definition at line 1522 of file MR_rect_tree.hpp.
|
inline |
Dump tree to STDOUT.
max_num_print | Maximum number of samples to print. Use 0 to print all samples. |
Definition at line 1551 of file MR_rect_tree.hpp.
|
inline |
Dump tree points to file – one tuple per line with domain coordinates followed by range values.
Definition at line 1576 of file MR_rect_tree.hpp.
|
inline |
Return the bounding box minimum point.
Definition at line 378 of file MR_rect_tree.hpp.
|
inline |
Return the bounding box minimum point.
Definition at line 375 of file MR_rect_tree.hpp.
|
inline |
Return the bounding box minimum point.
Definition at line 372 of file MR_rect_tree.hpp.
|
inline |
Return a list of sampled neighbors to the given cell.
cell | Input cell. Must be a valid cell. – no error checking. |
index | The index of the axis. Must be in [0, dom_dim-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
Definition at line 1453 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1399 of file MR_rect_tree.hpp.
|
inline |
Extract a list of all leaf cells starting from the given cell.
cell | Starting cell |
Definition at line 1385 of file MR_rect_tree.hpp.
|
inline |
Extract a list of all leaf cells starting from the given cell.
cell | Input cell. Must be a valid cell. – no error checking. |
index | The index of the axis. Must be in [0, dom_dim-1]. No error checking. |
direction | The direction on the given index. Must be 1 or -1. No error checking. |
Definition at line 1419 of file MR_rect_tree.hpp.
|
inline |
Extract a list of all leaf cells starting from the given cell that match the given predicate.
cell | Starting cell |
pred | Predicate function. |
Definition at line 1407 of file MR_rect_tree.hpp.
|
inline |
Return the sample value for vertex.
vertex | Input vertex |
Definition at line 382 of file MR_rect_tree.hpp.
|
inline |
Return the sample value for vertex as an rrta_t (an std::array)
vertex | Input vertex |
Definition at line 386 of file MR_rect_tree.hpp.
|
inline |
Return the level of the smallest, existing neighbor.
Returns -1 if no neighbors exist.
cell | Input cell. Must be a valid cell. – no error checking. |
Definition at line 1468 of file MR_rect_tree.hpp.
|
inline |
Sample a function uniformly across given cell to the given level.
The given cell need not exist in the tree yet.
cell | The cell to sample within |
level_delta | The relative level at which to sample level_delta=0 is equivalent to calling sample_cell(cell, func). level_delta=1 is equivalent to calling sample_cell(cell, func) followed by refine_once(cell, func). |
func | Function to use for samples |
Definition at line 946 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1004 of file MR_rect_tree.hpp.
|
inline |
Repeatedly refine leaves of the given cell for which pred is true.
Apply refine_leaves_once_if_cell_pred() repeatedly untill no new cells are refined.
cell | Input cell. Must be a valid cell. – no error checking. |
level | Maximum level of refinded cells. -1 means refine to the limit. |
func | Function to sample |
pred | Predicate function. |
Definition at line 1106 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1114 of file MR_rect_tree.hpp.
|
inline |
Refine each leaf cell if pred returns true and the cell level is less than the given level value.
All leaf cells are tested with the predicate first. Then the list of cells requiring refinement are refined. This guarantees that no leaf cell will be refined more than once even if the refinement process would impact the value of the predicate. This can produce qualitatively different behavior than refine_leaves_recursive_cell_pred() when used with predicates like cell_is_unbalanced().
cell | Input cell. Must be a valid cell. – no error checking. |
level | Maximum level of refinded cells. -1 means refine to the limit. |
func | Function to sample |
pred | Predicate function. |
Definition at line 1080 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1094 of file MR_rect_tree.hpp.
|
inline |
Refine leaf cells if they are unbalanced at the given level.
This is a convenience function combining refine_leaves_atomically_if_cell_pred(), cell_is_unbalanced(), & ccc_get_top_cell().
The primary use case is to demonstrate the step wise balancing of a tree.
level_delta | The Level. |
func | Function to sample |
Definition at line 1136 of file MR_rect_tree.hpp.
|
inline |
Refine a cells matching predicate until refined cells reach specified level.
cell | Cell to refine |
level | Maximum level of refinded cells. -1 means refine to the limit. |
func | Function to use for samples |
pred | Predicate function. |
Definition at line 1060 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1066 of file MR_rect_tree.hpp.
|
inline |
Refine a cell if possible.
cell | Cell to refine – no error checking!! |
func | Function to use for samples |
Definition at line 925 of file MR_rect_tree.hpp.
|
inline |
Refine a cell until refined cells reach specified level.
cell | Cell to refine |
level | Maximum level of refined cells. -1 means refine to the limit. |
func | Function to use for samples |
Definition at line 1016 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1027 of file MR_rect_tree.hpp.
|
inline |
Refine a cells matching predicate until refined cells reach specified level.
cell | Cell to refine |
level | Maximum level of refinded cells. -1 means refine to the limit. |
func | Function to use for samples |
pred | Predicate function. |
Definition at line 1043 of file MR_rect_tree.hpp.
|
inline |
Refine a cells with NaNs until refined cells reach specified level.
This is a convenience function combining refine_recursive_cell_pred(), cell_vertex_is_nan(), & ccc_get_top_cell().
level | Maximum level of refinded cells. -1 means refine to the limit. |
func | Function to use for samples |
Definition at line 1124 of file MR_rect_tree.hpp.
References mjr::MR_rect_tree< max_level, spc_real_t, dom_dim, rng_dim >::cell_vertex_is_nan().
|
inline |
Definition at line 708 of file MR_rect_tree.hpp.
|
inline |
Distance between two points in the range space using the infinity norm (max absolute value)
val1 | Value in range space |
val2 | Value in range space |
Definition at line 862 of file MR_rect_tree.hpp.
|
inline |
Test if a point in the range space contains a NaN coordinate value.
val | Value in space |
Definition at line 851 of file MR_rect_tree.hpp.
|
inline |
Convert rrpt value to a string representation.
Definition at line 1536 of file MR_rect_tree.hpp.
|
inline |
Sample a cell.
cell | Cell to sample |
func | Function to use for samples |
Definition at line 807 of file MR_rect_tree.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 816 of file MR_rect_tree.hpp.
|
inline |
Sample, or resample, a point.
diti | Point at which to sample |
func | Function to sample |
Definition at line 838 of file MR_rect_tree.hpp.
|
inline |
Sample a point if it has not already been sampled.
diti | Point at which to sample |
func | Function to sample |
Definition at line 824 of file MR_rect_tree.hpp.
|
inline |
Set the bounding box.
new_bbox_min | Value to use for bounding box minimum point |
new_bbox_max | Value to use for bounding box maximum point |
Definition at line 340 of file MR_rect_tree.hpp.
|
inline |
Set the bounding box to the default: -1 for all minimum components and +1 for all maximum components.
Definition at line 347 of file MR_rect_tree.hpp.
|
inline |
Set the bounding box max_level.
new_bbox_max | Value to use for bounding box maximum point |
Definition at line 364 of file MR_rect_tree.hpp.
|
inline |
Set the bounding box minimum.
new_bbox_min | Value to use for bounding box minimum point |
Definition at line 360 of file MR_rect_tree.hpp.
|
inline |
Update the value of bbox_delta.
Use this after modifying the value of bbox_min or bbox_max.
Definition at line 319 of file MR_rect_tree.hpp.
|
inline |
Point has been sampled.
vertex | Input vertex |
Definition at line 1374 of file MR_rect_tree.hpp.
|
inline |
Test if a vertex is NaN or, when it is an std::array, if it contains a NaN element.
vertex | Input vertex |
Definition at line 1364 of file MR_rect_tree.hpp.
|
private |
The wdith of the real domain range.
Definition at line 293 of file MR_rect_tree.hpp.
|
private |
Holds the maximal point for the real domain range.
Definition at line 292 of file MR_rect_tree.hpp.
|
private |
Holds the minimal point for the real domain range.
Definition at line 291 of file MR_rect_tree.hpp.
|
staticconstexpr |
The number of bits used by a single component of an integer coordinate tuple.
Definition at line 203 of file MR_rect_tree.hpp.
|
staticconstexpr |
Center value for a dic_t.
Definition at line 254 of file MR_rect_tree.hpp.
|
staticconstexpr |
Maximum allowd for a dic_t.
Definition at line 252 of file MR_rect_tree.hpp.
|
staticconstexpr |
Minimum allowd for a dic_t.
Definition at line 256 of file MR_rect_tree.hpp.
|
staticconstexpr |
The number of bits used by an entire integer coordinate tuple.
Definition at line 207 of file MR_rect_tree.hpp.
|
staticconstexprprivate |
Definition at line 284 of file MR_rect_tree.hpp.
|
staticconstexprprivate |
Definition at line 282 of file MR_rect_tree.hpp.
|
staticconstexpr |
The value of the template parameter dom_dim.
Definition at line 141 of file MR_rect_tree.hpp.
|
staticconstexpr |
The value of the template parameter max_level.
Definition at line 145 of file MR_rect_tree.hpp.
|
staticconstexpr |
The value of the template parameter rng_dim.
Definition at line 143 of file MR_rect_tree.hpp.
|
private |
Holds the sampled data.
Definition at line 295 of file MR_rect_tree.hpp.