MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Traversal statistics structure. More...
#include <OrientedBoxTreeTool.hpp>
Public Member Functions | |
const std::vector< unsigned > & | nodes_visited () const |
const std::vector< unsigned > & | leaves_visited () const |
return counts of tree leaves visited, indexed by tree depth | |
const std::vector< unsigned > & | traversals_ended () const |
return counts of traversals ended, indexed by tree depth | |
unsigned int | ray_tri_tests () const |
void | reset () |
reset all counters on this structure | |
void | print (std::ostream &str) const |
print the contents of this structure to given stream | |
TrvStats () | |
Private Member Functions | |
void | increment (unsigned depth) |
void | increment_leaf (unsigned depth) |
void | end_traversal (unsigned depth) |
Private Attributes | |
std::vector< unsigned > | nodes_visited_count |
std::vector< unsigned > | leaves_visited_count |
std::vector< unsigned > | traversals_ended_count |
unsigned int | ray_tri_tests_count |
Friends | |
class | OrientedBoxTreeTool |
Traversal statistics structure.
Structure to accumulate statistics on traversal performance. Passed optionally to query functions, this structure contains the count of nodes visited at each level in a tree, and the count of traversals that ended at each level. One TrvStats structure can be used with multiple OBB trees or multiple queries, or used on only a single tree or a single query.
Note that these traversal statistics are not related to the stats() query below, which calculates static information about a tree. These statistics relate to a tree's dynamic behavior on particular operations.
Definition at line 151 of file OrientedBoxTreeTool.hpp.
moab::OrientedBoxTreeTool::TrvStats::TrvStats | ( | ) | [inline] |
Definition at line 181 of file OrientedBoxTreeTool.hpp.
: ray_tri_tests_count( 0 ) {}
void moab::OrientedBoxTreeTool::TrvStats::end_traversal | ( | unsigned | depth | ) | [private] |
Definition at line 1695 of file OrientedBoxTreeTool.cpp.
Referenced by moab::OrientedBoxTreeTool::closest_to_location(), moab::OrientedBoxTreeTool::preorder_traverse(), and moab::OrientedBoxTreeTool::sphere_intersect_triangles().
{ // assume safe depth, because increment is always called on a given // tree level first traversals_ended_count[depth] += 1; }
void moab::OrientedBoxTreeTool::TrvStats::increment | ( | unsigned | depth | ) | [private] |
Definition at line 1677 of file OrientedBoxTreeTool.cpp.
Referenced by moab::OrientedBoxTreeTool::closest_to_location(), moab::OrientedBoxTreeTool::preorder_traverse(), and moab::OrientedBoxTreeTool::sphere_intersect_triangles().
{ while( nodes_visited_count.size() <= depth ) { nodes_visited_count.push_back( 0 ); leaves_visited_count.push_back( 0 ); traversals_ended_count.push_back( 0 ); } nodes_visited_count[depth] += 1; }
void moab::OrientedBoxTreeTool::TrvStats::increment_leaf | ( | unsigned | depth | ) | [private] |
Definition at line 1689 of file OrientedBoxTreeTool.cpp.
Referenced by moab::OrientedBoxTreeTool::closest_to_location(), moab::OrientedBoxTreeTool::preorder_traverse(), and moab::OrientedBoxTreeTool::sphere_intersect_triangles().
{ // assume safe depth, because increment is called first leaves_visited_count[depth] += 1; }
const std::vector< unsigned >& moab::OrientedBoxTreeTool::TrvStats::leaves_visited | ( | ) | const [inline] |
return counts of tree leaves visited, indexed by tree depth
Definition at line 161 of file OrientedBoxTreeTool.hpp.
References leaves_visited_count.
{ return leaves_visited_count; }
const std::vector< unsigned >& moab::OrientedBoxTreeTool::TrvStats::nodes_visited | ( | ) | const [inline] |
return counts of nodes visited, indexed by tree depth. the counts include both leaves and interior nodes
Definition at line 156 of file OrientedBoxTreeTool.hpp.
References nodes_visited_count.
{ return nodes_visited_count; }
void moab::OrientedBoxTreeTool::TrvStats::print | ( | std::ostream & | str | ) | const |
print the contents of this structure to given stream
Definition at line 1702 of file OrientedBoxTreeTool.cpp.
Referenced by do_closest_point_test(), do_ray_fire_test(), and main().
{ const std::string h1 = "OBBTree Depth"; const std::string h2 = " - NodesVisited"; const std::string h3 = " - LeavesVisited"; const std::string h4 = " - TraversalsEnded"; str << h1 << h2 << h3 << h4 << std::endl; unsigned num_visited = 0, num_leaves = 0, num_traversals = 0; for( unsigned i = 0; i < traversals_ended_count.size(); ++i ) { num_visited += nodes_visited_count[i]; num_leaves += leaves_visited_count[i]; num_traversals += traversals_ended_count[i]; str << std::setw( h1.length() ) << i << std::setw( h2.length() ) << nodes_visited_count[i] << std::setw( h3.length() ) << leaves_visited_count[i] << std::setw( h4.length() ) << traversals_ended_count[i] << std::endl; } str << std::setw( h1.length() ) << "---- Totals:" << std::setw( h2.length() ) << num_visited << std::setw( h3.length() ) << num_leaves << std::setw( h4.length() ) << num_traversals << std::endl; if( ray_tri_tests_count ) { str << std::setw( h1.length() ) << "---- Total ray-tri tests: " << ray_tri_tests_count << std::endl; } }
unsigned int moab::OrientedBoxTreeTool::TrvStats::ray_tri_tests | ( | ) | const [inline] |
return total number of ray-triangle intersection tests performed in calls made with this TrvStats
Definition at line 172 of file OrientedBoxTreeTool.hpp.
References ray_tri_tests_count.
{ return ray_tri_tests_count; }
reset all counters on this structure
Definition at line 1669 of file OrientedBoxTreeTool.cpp.
References leaves_visited_count, nodes_visited_count, ray_tri_tests_count, and traversals_ended_count.
{ nodes_visited_count.clear(); leaves_visited_count.clear(); traversals_ended_count.clear(); ray_tri_tests_count = 0; }
const std::vector< unsigned >& moab::OrientedBoxTreeTool::TrvStats::traversals_ended | ( | ) | const [inline] |
return counts of traversals ended, indexed by tree depth
Definition at line 166 of file OrientedBoxTreeTool.hpp.
References traversals_ended_count.
{ return traversals_ended_count; }
friend class OrientedBoxTreeTool [friend] |
Definition at line 193 of file OrientedBoxTreeTool.hpp.
std::vector< unsigned > moab::OrientedBoxTreeTool::TrvStats::leaves_visited_count [private] |
Definition at line 185 of file OrientedBoxTreeTool.hpp.
Referenced by leaves_visited(), and reset().
std::vector< unsigned > moab::OrientedBoxTreeTool::TrvStats::nodes_visited_count [private] |
Definition at line 184 of file OrientedBoxTreeTool.hpp.
Referenced by nodes_visited(), and reset().
unsigned int moab::OrientedBoxTreeTool::TrvStats::ray_tri_tests_count [private] |
Definition at line 187 of file OrientedBoxTreeTool.hpp.
Referenced by moab::OrientedBoxTreeTool::ray_intersect_sets(), moab::OrientedBoxTreeTool::ray_intersect_triangles(), ray_tri_tests(), and reset().
std::vector< unsigned > moab::OrientedBoxTreeTool::TrvStats::traversals_ended_count [private] |
Definition at line 186 of file OrientedBoxTreeTool.hpp.
Referenced by reset(), and traversals_ended().