MOAB: Mesh Oriented datABase
(version 5.5.0)
|
#include "moab/Core.hpp"
#include "moab/AdaptiveKDTree.hpp"
#include "moab/CartVect.hpp"
#include "moab/GeomUtil.hpp"
#include "moab/Range.hpp"
#include "TestUtil.hpp"
#include <iostream>
#include <algorithm>
#include <sstream>
Go to the source code of this file.
Macros | |
#define | CHECK_RAY_XSECTS(PT, DIR, T_IN, T_OUT) |
#define CHECK_RAY_XSECTS | ( | PT, | |
DIR, | |||
T_IN, | |||
T_OUT | |||
) |
Definition at line 1060 of file adaptive_kd_tree_tests.cpp.
bool box_equal | ( | const AdaptiveKDTreeIter & | iter, |
double | x_min, | ||
double | y_min, | ||
double | z_min, | ||
double | x_max, | ||
double | y_max, | ||
double | z_max | ||
) |
Definition at line 19 of file adaptive_kd_tree_tests.cpp.
References moab::AdaptiveKDTreeIter::box_max(), and moab::AdaptiveKDTreeIter::box_min().
Referenced by create_simple_2d_tree(), leaf_iterator_test(), and test_tree_merge_nodes().
Definition at line 67 of file adaptive_kd_tree_tests.cpp.
References build_triangles().
Referenced by test_build_tree_bisect_triangles(), test_closest_triangle(), and test_sphere_intersect_triangles().
Definition at line 54 of file adaptive_kd_tree_tests.cpp.
References build_triangles().
Referenced by test_build_tree_bisect_triangles(), test_closest_triangle(), test_ray_intersect_triangles(), and test_sphere_intersect_triangles().
Definition at line 115 of file adaptive_kd_tree_tests.cpp.
References build_triangles().
Referenced by test_build_tree_bisect_triangles().
void build_triangles | ( | Interface * | moab, |
Range & | tris, | ||
int | num_vert, | ||
const double * | coords, | ||
int | num_tri, | ||
const unsigned * | conn | ||
) |
Definition at line 31 of file adaptive_kd_tree_tests.cpp.
References moab::Range::insert(), and MBTRI.
Referenced by build_triangle_box_large(), build_triangle_box_small(), and build_triangle_octahedron().
void check_common_vertex | ( | Interface * | moab, |
const EntityHandle * | tris, | ||
unsigned | num_tri, | ||
CartVect | point | ||
) |
Definition at line 161 of file adaptive_kd_tree_tests.cpp.
References CHECK, ErrorCode, MB_SUCCESS, MBTRI, and tri_coords().
Referenced by test_closest_triangle(), and test_sphere_intersect_triangles().
void check_point_in_triangles | ( | Interface * | moab, |
const EntityHandle * | tris, | ||
unsigned | num_tris, | ||
CartVect | point | ||
) |
Definition at line 194 of file adaptive_kd_tree_tests.cpp.
References CHECK, moab::GeomUtil::closest_location_on_tri(), ErrorCode, MB_SUCCESS, MBTRI, and tri_coords().
Referenced by test_closest_triangle(), and test_ray_intersect_triangles().
void create_simple_2d_tree | ( | AdaptiveKDTree & | tool, |
EntityHandle & | root, | ||
EntityHandle | leaves[9] = 0 |
||
) |
Definition at line 238 of file adaptive_kd_tree_tests.cpp.
References box_equal(), CHECK, moab::AdaptiveKDTree::Plane::coord, moab::Tree::create_root(), ErrorCode, moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::handle(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::AdaptiveKDTree::Plane::norm, moab::AdaptiveKDTree::split_leaf(), moab::AdaptiveKDTreeIter::step(), moab::AdaptiveKDTree::X, and moab::AdaptiveKDTree::Y.
Referenced by leaf_iterator_test(), test_leaf_sibling(), test_leaf_volume(), and test_tree_merge_nodes().
void leaf_iterator_test | ( | ) |
Definition at line 352 of file adaptive_kd_tree_tests.cpp.
References box_equal(), CHECK, moab::Tree::create_root(), create_simple_2d_tree(), ErrorCode, moab::AdaptiveKDTreeIter::get_neighbors(), moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::handle(), mb, MB_ENTITY_NOT_FOUND, MB_SUCCESS, moab::AdaptiveKDTree::reset_tree(), moab::AdaptiveKDTreeIter::step(), swap(), moab::AdaptiveKDTree::X, moab::AdaptiveKDTree::Y, and moab::AdaptiveKDTree::Z.
Referenced by main().
int main | ( | ) |
Definition at line 1131 of file adaptive_kd_tree_tests.cpp.
References error_count, moab::fail(), leaf_iterator_test(), RUN_TEST, test_build_tree_bisect_triangles(), test_closest_triangle(), test_leaf_intersects_plane(), test_leaf_intersects_ray(), test_leaf_sibling(), test_leaf_volume(), test_ray_intersect_triangles(), test_sphere_intersect_triangles(), and test_tree_merge_nodes().
void test_build_tree_bisect_triangles | ( | ) |
Definition at line 552 of file adaptive_kd_tree_tests.cpp.
References moab::AdaptiveKDTree::build_tree(), build_triangle_box_large(), build_triangle_box_small(), build_triangle_octahedron(), CHECK, moab::Range::clear(), ErrorCode, MB_SUCCESS, moab::AdaptiveKDTree::reset_tree(), and test_valid_tree().
Referenced by main().
void test_closest_triangle | ( | ) |
Definition at line 597 of file adaptive_kd_tree_tests.cpp.
References moab::CartVect::array(), moab::AdaptiveKDTree::build_tree(), build_triangle_box_large(), build_triangle_box_small(), CHECK, check_common_vertex(), check_point_in_triangles(), moab::Range::clear(), moab::AdaptiveKDTree::closest_triangle(), ErrorCode, MB_SUCCESS, moab::Tree::moab(), moab::AdaptiveKDTree::reset_tree(), and test_valid_tree().
Referenced by main().
void test_leaf_intersects_plane | ( | ) |
Definition at line 1006 of file adaptive_kd_tree_tests.cpp.
References CHECK, CHECK_ERR, moab::Tree::create_root(), ErrorCode, moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::intersects(), moab::AdaptiveKDTree::X, moab::AdaptiveKDTree::Y, and moab::AdaptiveKDTree::Z.
Referenced by main().
void test_leaf_intersects_ray | ( | ) |
Definition at line 1068 of file adaptive_kd_tree_tests.cpp.
References CHECK, CHECK_ERR, CHECK_RAY_XSECTS, moab::Tree::create_root(), ErrorCode, moab::AdaptiveKDTree::get_tree_iterator(), and moab::AdaptiveKDTreeIter::intersect_ray().
Referenced by main().
void test_leaf_sibling | ( | ) |
Definition at line 953 of file adaptive_kd_tree_tests.cpp.
References CHECK, CHECK_EQUAL, CHECK_ERR, create_simple_2d_tree(), ErrorCode, moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::handle(), moab::AdaptiveKDTreeIter::is_sibling(), moab::AdaptiveKDTreeIter::sibling_is_forward(), and moab::AdaptiveKDTreeIter::step().
Referenced by main().
void test_leaf_volume | ( | ) |
Definition at line 926 of file adaptive_kd_tree_tests.cpp.
References CHECK_ERR, CHECK_REAL_EQUAL, create_simple_2d_tree(), ErrorCode, moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::step(), and moab::AdaptiveKDTreeIter::volume().
Referenced by main().
void test_ray_intersect_triangles | ( | ) |
Definition at line 790 of file adaptive_kd_tree_tests.cpp.
References moab::CartVect::array(), moab::AdaptiveKDTree::build_tree(), build_triangle_box_small(), CHECK, check_point_in_triangles(), moab::Range::clear(), ErrorCode, MB_SUCCESS, moab::AdaptiveKDTree::ray_intersect_triangles(), and test_valid_tree().
Referenced by main().
void test_sphere_intersect_triangles | ( | ) |
Definition at line 724 of file adaptive_kd_tree_tests.cpp.
References moab::AdaptiveKDTree::build_tree(), build_triangle_box_large(), build_triangle_box_small(), center(), CHECK, check_common_vertex(), moab::Range::clear(), ErrorCode, MB_SUCCESS, moab::Tree::moab(), moab::AdaptiveKDTree::reset_tree(), moab::AdaptiveKDTree::sphere_intersect_triangles(), and test_valid_tree().
Referenced by main().
void test_tree_merge_nodes | ( | ) |
Definition at line 518 of file adaptive_kd_tree_tests.cpp.
References box_equal(), CHECK, create_simple_2d_tree(), ErrorCode, moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::handle(), mb, MB_SUCCESS, moab::AdaptiveKDTree::merge_leaf(), and moab::AdaptiveKDTreeIter::step().
Referenced by main().
void test_valid_tree | ( | AdaptiveKDTree * | tool, |
EntityHandle | root, | ||
FileOptions & | options, | ||
const Range & | expected_tris | ||
) |
Definition at line 123 of file adaptive_kd_tree_tests.cpp.
References moab::CartVect::array(), moab::Range::begin(), moab::AdaptiveKDTreeIter::box_max(), moab::AdaptiveKDTreeIter::box_min(), moab::GeomUtil::box_tri_overlap(), CHECK, moab::AdaptiveKDTreeIter::depth(), moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_type(), moab::Tree::get_max_depth(), moab::FileOptions::get_real_option(), moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::handle(), MB_ENTITY_NOT_FOUND, MB_SUCCESS, MBTRI, moab::Range::merge(), moab::Tree::moab(), and moab::AdaptiveKDTreeIter::step().
Referenced by test_build_tree_bisect_triangles(), test_closest_triangle(), test_ray_intersect_triangles(), and test_sphere_intersect_triangles().