Parent class of various tree types in MOAB. More...
#include <Tree.hpp>
Public Member Functions | |
Tree (Interface *iface) | |
Constructor (bare) More... | |
virtual | ~Tree () |
Destructor. More... | |
virtual ErrorCode | reset_tree ()=0 |
Destroy the tree maintained by this object, optionally checking we have the right root. More... | |
ErrorCode | delete_tree_sets () |
Delete the entity sets associated with the tree, starting with the root and traversing children. More... | |
virtual ErrorCode | build_tree (const Range &entities, EntityHandle *tree_root_set=NULL, FileOptions *options=NULL)=0 |
virtual ErrorCode | get_bounding_box (BoundBox &box, EntityHandle *tree_node=NULL) const |
Get bounding box for tree below tree_node, or entire tree If no tree has been built yet, returns +/- DBL_MAX for all dimensions. Note for some tree types, boxes are not available for non-root nodes, and this function will return failure if non-root is passed in. More... | |
virtual ErrorCode | get_info (EntityHandle root, double min[3], double max[3], unsigned int &max_dep) |
Return some basic information about the tree Stats are returned for tree starting from input node or tree root (root = 0) More... | |
ErrorCode | find_all_trees (Range &results) |
Find all trees, by bounding box tag. More... | |
virtual ErrorCode | point_search (const double *point, EntityHandle &leaf_out, const double iter_tol=1.0e-10, const double inside_tol=1.0e-6, bool *multiple_leaves=NULL, EntityHandle *start_node=NULL, CartVect *params=NULL)=0 |
Get leaf containing input position. More... | |
virtual ErrorCode | distance_search (const double *point, const double distance, std::vector< EntityHandle > &leaves_out, const double iter_tol=1.0e-10, const double inside_tol=1.0e-6, std::vector< double > *dists_out=NULL, std::vector< CartVect > *params_out=NULL, EntityHandle *start_node=NULL)=0 |
Find all leaves within a given distance from point If dists_out input non-NULL, also returns distances from each leaf; if point i is inside leaf, 0 is given as dists_out[i]. If params_out is non-NULL and myEval is non-NULL, will evaluate individual entities in tree nodes and return containing entities in leaves_out. In those cases, if params_out is also non-NULL, will return parameters in those elements in that vector. More... | |
Interface * | moab () |
Return the MOAB interface associated with this tree. More... | |
const Interface * | moab () const |
Return the MOAB interface associated with this tree. More... | |
double | get_max_depth () |
Get max depth set on tree. More... | |
double | get_max_per_leaf () |
Get max entities per leaf set on tree. More... | |
TreeStats & | tree_stats () |
Get tree traversal stats object. More... | |
const TreeStats & | tree_stats () const |
Get tree traversal stats object. More... | |
ErrorCode | create_root (const double box_min[3], const double box_max[3], EntityHandle &root_handle) |
Create tree root and tag with bounding box. More... | |
virtual ErrorCode | print ()=0 |
print various things about this tree More... | |
ElemEvaluator * | get_eval () |
get/set the ElemEvaluator More... | |
void | set_eval (ElemEvaluator *eval) |
get/set the ElemEvaluator More... | |
virtual ErrorCode | parse_options (FileOptions &opts)=0 |
Parse options for this tree, including common options for all trees. More... | |
Protected Member Functions | |
ErrorCode | parse_common_options (FileOptions &options) |
Parse options common to all trees. More... | |
Tag | get_box_tag (bool create_if_missing=true) |
Get the box tag, possibly constructing it first. More... | |
Protected Attributes | |
Interface * | mbImpl |
BoundBox | boundBox |
int | maxPerLeaf |
int | maxDepth |
int | treeDepth |
double | minWidth |
unsigned int | meshsetFlags |
bool | cleanUp |
EntityHandle | myRoot |
Tag | boxTag |
std::string | boxTagName |
TreeStats | treeStats |
ElemEvaluator * | myEval |
|
inline |
|
pure virtual |
Build the tree Build a tree with the entities input. If a non-NULL tree_root_set pointer is input, use the pointed-to set as the root of this tree (*tree_root_set!=0) otherwise construct a new root set and pass its handle back in *tree_root_set. Options vary by tree type, with a few common to all types of trees. Common options: MAX_PER_LEAF: max entities per leaf; default = 6 MAX_DEPTH: max depth of the tree; default = 30 MIN_WIDTH: minimum width of box, used like a tolerance; default = 1.0e-10 MESHSET_FLAGS: flags passed into meshset creation for tree nodes; should be a value from ENTITY_SET_PROPERTY (see Types.hpp); default = MESHSET_SET CLEAN_UP: if false, do not delete tree sets upon tree class destruction; default = true TAG_NAME: tag name to store tree information on tree nodes; default determined by tree type
entities | Entities with which to build the tree |
tree_root | Root set for tree (see function description) |
opts | Options for tree (see function description) |
Implemented in moab::BVHTree, and moab::AdaptiveKDTree.
Referenced by moab::SpatialLocator::add_elems(), and moab::SpatialLocator::SpatialLocator().
ErrorCode moab::Tree::create_root | ( | const double | box_min[3], |
const double | box_max[3], | ||
EntityHandle & | root_handle | ||
) |
Create tree root and tag with bounding box.
Definition at line 63 of file Tree.cpp.
References moab::BoundBox::bMax, moab::BoundBox::bMin, boundBox, box_max(), box_min(), moab::Interface::create_meshset(), ErrorCode, get_box_tag(), MB_SUCCESS, mbImpl, meshsetFlags, myRoot, and moab::Interface::tag_set_data().
Referenced by moab::AdaptiveKDTree::build_tree(), and moab::BVHTree::build_tree().
ErrorCode moab::Tree::delete_tree_sets | ( | ) |
Delete the entity sets associated with the tree, starting with the root and traversing children.
Definition at line 85 of file Tree.cpp.
References boxTag, children, moab::Interface::delete_entities(), ErrorCode, moab::Interface::get_child_meshsets(), MB_SUCCESS, mbImpl, myRoot, and moab::Interface::tag_delete_data().
Referenced by moab::AdaptiveKDTree::reset_tree(), and moab::BVHTree::reset_tree().
|
pure virtual |
Find all leaves within a given distance from point If dists_out input non-NULL, also returns distances from each leaf; if point i is inside leaf, 0 is given as dists_out[i]. If params_out is non-NULL and myEval is non-NULL, will evaluate individual entities in tree nodes and return containing entities in leaves_out. In those cases, if params_out is also non-NULL, will return parameters in those elements in that vector.
point | Point to be located in tree |
distance | Distance within which to query |
leaves_out | Leaves within distance or containing point |
iter_tol | Tolerance for convergence of point search |
inside_tol | Tolerance for inside element calculation |
dists_out | If non-NULL, will contain distsances to leaves |
params_out | If non-NULL, will contain parameters of the point in the ents in leaves_out |
start_node | Start from this tree node (non-NULL) instead of tree root (NULL) |
Implemented in moab::AdaptiveKDTree.
Find all trees, by bounding box tag.
Definition at line 47 of file Tree.cpp.
References moab::Range::begin(), boundBox, moab::Range::empty(), ErrorCode, get_box_tag(), moab::Interface::get_entities_by_type_and_tag(), MB_SUCCESS, MBENTITYSET, moab(), myRoot, moab::Range::size(), moab::Interface::tag_get_data(), and moab::BoundBox::update().
Referenced by main().
|
inlinevirtual |
Get bounding box for tree below tree_node, or entire tree If no tree has been built yet, returns +/- DBL_MAX for all dimensions. Note for some tree types, boxes are not available for non-root nodes, and this function will return failure if non-root is passed in.
box | The box for this tree |
tree_node | If non-NULL, node for which box is requested, tree root if NULL |
Reimplemented in moab::BVHTree.
Definition at line 265 of file Tree.hpp.
References boundBox, MB_SUCCESS, and myRoot.
Referenced by moab::AdaptiveKDTree::distance_search(), moab::AdaptiveKDTree::get_info(), moab::Coupler::initialize_tree(), moab::AdaptiveKDTree::point_search(), moab::AdaptiveKDTree::print(), moab::AdaptiveKDTree::ray_intersect_triangles(), moab::SpatialLocator::SpatialLocator(), and moab::Coupler::test_local_box().
|
inlineprotected |
Get the box tag, possibly constructing it first.
create_if_missing | If true and it has not been made yet, make it |
Definition at line 284 of file Tree.hpp.
References boxTag, boxTagName, ErrorCode, MB_INVALID_SIZE, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_SPARSE, MB_TYPE_DOUBLE, moab(), moab::Interface::tag_delete(), and moab::Interface::tag_get_handle().
Referenced by create_root(), and find_all_trees().
|
inline |
get/set the ElemEvaluator
Definition at line 187 of file Tree.hpp.
References myEval.
Referenced by moab::SpatialLocator::locate_points().
|
inlinevirtual |
Return some basic information about the tree Stats are returned for tree starting from input node or tree root (root = 0)
root | If non-0, give stats below and including root |
min | Minimum corner of bounding box |
max | Maximum corner of bounding box |
max_dep | Maximum depth of tree below root |
Reimplemented in moab::AdaptiveKDTree.
Definition at line 276 of file Tree.hpp.
References MB_NOT_IMPLEMENTED.
|
inline |
|
inline |
Get max entities per leaf set on tree.
Definition at line 162 of file Tree.hpp.
References maxPerLeaf.
|
inline |
Return the MOAB interface associated with this tree.
Definition at line 143 of file Tree.hpp.
References mbImpl.
Referenced by moab::AdaptiveKDTree::best_subdivision_plane(), moab::AdaptiveKDTree::best_subdivision_snap_plane(), moab::AdaptiveKDTree::best_vertex_median_plane(), moab::AdaptiveKDTree::best_vertex_sample_plane(), moab::AdaptiveKDTree::build_tree(), moab::BVHTree::build_tree(), moab::AdaptiveKDTree::closest_triangle(), moab::AdaptiveKDTree::compute_depth(), moab::AdaptiveKDTree::distance_search(), find_all_trees(), moab::AdaptiveKDTree::find_close_triangle(), get_box_tag(), moab::AdaptiveKDTree::get_last_iterator(), moab::AdaptiveKDTreeIter::get_neighbors(), moab::AdaptiveKDTree::get_split_plane(), moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTree::init(), moab::AdaptiveKDTree::intersect_children_with_elems(), moab::AdaptiveKDTreeIter::is_sibling(), moab::AdaptiveKDTree::merge_leaf(), moab::AdaptiveKDTree::point_search(), moab::AdaptiveKDTree::print(), moab::AdaptiveKDTree::ray_intersect_triangles(), moab::AdaptiveKDTree::set_split_plane(), moab::AdaptiveKDTreeIter::sibling_is_forward(), moab::AdaptiveKDTreeIter::sibling_side(), moab::AdaptiveKDTree::sphere_intersect_triangles(), moab::AdaptiveKDTree::split_leaf(), moab::AdaptiveKDTreeIter::step(), and moab::AdaptiveKDTreeIter::step_to_first_leaf().
|
inline |
|
protected |
Parse options common to all trees.
options | Options for representing tree; see Tree::build_tree() and subclass build_tree() functions for allowed options |
Definition at line 9 of file Tree.cpp.
References boxTagName, cleanUp, ErrorCode, moab::FileOptions::get_int_option(), moab::FileOptions::get_real_option(), moab::FileOptions::get_str_option(), moab::FileOptions::get_toggle_option(), maxDepth, maxPerLeaf, MB_SUCCESS, meshsetFlags, and minWidth.
Referenced by moab::AdaptiveKDTree::parse_options(), and moab::BVHTree::parse_options().
|
pure virtual |
Parse options for this tree, including common options for all trees.
opts | Options |
Implemented in moab::BVHTree, and moab::AdaptiveKDTree.
|
pure virtual |
Get leaf containing input position.
Does not take into account global bounding box of tree.
point | Point to be located in tree |
leaf_out | Leaf containing point |
iter_tol | Tolerance for convergence of point search |
inside_tol | Tolerance for inside element calculation |
multiple_leaves | Some tree types can have multiple leaves containing a point; if non-NULL, this parameter is returned true if multiple leaves contain the input point |
start_node | Start from this tree node (non-NULL) instead of tree root (NULL) |
Implemented in moab::BVHTree, and moab::AdaptiveKDTree.
Referenced by moab::SpatialLocator::locate_points().
|
pure virtual |
print various things about this tree
Implemented in moab::BVHTree, and moab::AdaptiveKDTree.
|
pure virtual |
Destroy the tree maintained by this object, optionally checking we have the right root.
root | If non-NULL, check that this is the root, return failure if not |
Implemented in moab::BVHTree, and moab::AdaptiveKDTree.
|
inline |
get/set the ElemEvaluator
Definition at line 193 of file Tree.hpp.
References myEval.
Referenced by moab::SpatialLocator::elem_eval(), and moab::SpatialLocator::locate_points().
|
inline |
Get tree traversal stats object.
Definition at line 168 of file Tree.hpp.
References treeStats.
Referenced by DeformMeshRemap::execute(), and moab::AdaptiveKDTree::intersect_children_with_elems().
|
inline |
|
protected |
Definition at line 221 of file Tree.hpp.
Referenced by moab::BVHTree::build_tree(), create_root(), find_all_trees(), moab::BVHTree::get_bounding_box(), get_bounding_box(), and moab::AdaptiveKDTree::point_search().
|
protected |
Definition at line 245 of file Tree.hpp.
Referenced by delete_tree_sets(), get_box_tag(), moab::AdaptiveKDTree::get_last_iterator(), and moab::AdaptiveKDTree::get_tree_iterator().
|
protected |
Definition at line 248 of file Tree.hpp.
Referenced by moab::AdaptiveKDTree::AdaptiveKDTree(), moab::BVHTree::BVHTree(), get_box_tag(), moab::AdaptiveKDTree::init(), and parse_common_options().
|
protected |
Definition at line 239 of file Tree.hpp.
Referenced by parse_common_options(), and moab::AdaptiveKDTree::~AdaptiveKDTree().
|
protected |
Definition at line 227 of file Tree.hpp.
Referenced by moab::AdaptiveKDTree::build_tree(), moab::AdaptiveKDTree::distance_search(), moab::BVHTree::distance_search(), get_max_depth(), moab::BVHTree::local_build_tree(), and parse_common_options().
|
protected |
Definition at line 224 of file Tree.hpp.
Referenced by moab::AdaptiveKDTree::build_tree(), moab::BVHTree::build_tree(), get_max_per_leaf(), moab::BVHTree::local_build_tree(), and parse_common_options().
|
protected |
Definition at line 218 of file Tree.hpp.
Referenced by moab::AdaptiveKDTree::build_tree(), moab::BVHTree::build_tree(), moab::BVHTree::construct_element_vec(), moab::BVHTree::convert_tree(), create_root(), delete_tree_sets(), moab::BVHTree::find_point(), moab::AdaptiveKDTree::init(), and moab().
|
protected |
Definition at line 236 of file Tree.hpp.
Referenced by moab::BVHTree::convert_tree(), create_root(), parse_common_options(), and moab::AdaptiveKDTree::split_leaf().
|
protected |
Definition at line 233 of file Tree.hpp.
Referenced by moab::AdaptiveKDTree::build_tree(), and parse_common_options().
|
protected |
Definition at line 254 of file Tree.hpp.
Referenced by moab::BVHTree::bruteforce_find(), moab::AdaptiveKDTree::distance_search(), moab::BVHTree::distance_search(), moab::BVHTree::find_point(), get_eval(), moab::AdaptiveKDTree::point_search(), moab::BVHTree::point_search(), and set_eval().
|
protected |
Definition at line 242 of file Tree.hpp.
Referenced by moab::AdaptiveKDTree::build_tree(), create_root(), delete_tree_sets(), moab::AdaptiveKDTree::distance_search(), moab::BVHTree::distance_search(), find_all_trees(), get_bounding_box(), moab::AdaptiveKDTree::point_search(), moab::BVHTree::point_search(), moab::AdaptiveKDTree::print(), and moab::AdaptiveKDTree::~AdaptiveKDTree().
|
protected |
Definition at line 230 of file Tree.hpp.
Referenced by moab::BVHTree::build_tree().
|
protected |
Definition at line 251 of file Tree.hpp.
Referenced by moab::BVHTree::bruteforce_find(), moab::AdaptiveKDTree::build_tree(), moab::BVHTree::build_tree(), moab::AdaptiveKDTree::distance_search(), moab::BVHTree::distance_search(), moab::BVHTree::find_point(), moab::AdaptiveKDTreeIter::intersect_ray(), moab::AdaptiveKDTree::point_search(), moab::BVHTree::point_search(), moab::AdaptiveKDTreeIter::step(), moab::AdaptiveKDTreeIter::step_to_first_leaf(), and tree_stats().