mesh::LooseOctree< NodeType > Class Template Reference

#include <looseoctree.h>

List of all members.

Public Types

typedef bool(NodeType::*) filter (const Vector3 &) const

Public Member Functions

 LooseOctree (const Vector3 &center, double length, int max_depth)
 ~LooseOctree ()
Octant< NodeType > * add_node (NodeType *node, Octant< NodeType > *start=0, int depth=0)
void find_nodes_by_point (const Vector3 &coord, std::vector< NodeType * > &node_list, int &nof_visited, LooseOctree::filter filter, Octant< NodeType > *octant=0)
NodeType * find_one_node_by_point (const Vector3 &coord, int &nof_visited, LooseOctree::filter filter, Octant< NodeType > *octant=0)
void get_statistics (int &max_depth, double &avg_node_depth, int &nof_octants, int &nof_nodes)
void export_vtk ()
void export_vtk_level (int level, std::string filename)

Protected Member Functions

void get_statistics_recursive (Octant< NodeType > *octant, int depth, int &max_depth, double &sum_depth, int &nof_octants, int &nof_nodes)
void export_vtk_recursive (Octant< NodeType > *octant, int depth, int x, int y, int z, int target_depth, std::vector< int > &cells)

Private Attributes

Octant< NodeType > * _root
int _max_depth


Detailed Description

template<typename NodeType>
class mesh::LooseOctree< NodeType >

Octree with overlapping octants
Parameters:
NodeType Type of nodes that are stored in the LooseOctree. Pointers to NodeType are stored in the Octree to reference NodeType objects. NodeType must define a member function NodeType::get_bounding_box(node_center, node_extent) that computes the bounding box of a node and stores its center and its extent (the box sides halved) in node_center and node_extent respectively.
Author:
Roman Geus

Definition at line 38 of file looseoctree.h.


Member Typedef Documentation

template<typename NodeType>
typedef bool(NodeType::*) mesh::LooseOctree< NodeType >::filter(const Vector3 &) const

Filter function deciding whether a point is inside a an OctreeNode

Definition at line 42 of file looseoctree.h.


Constructor & Destructor Documentation

template<typename NodeType>
mesh::LooseOctree< NodeType >::LooseOctree ( const Vector3 center,
double  length,
int  max_depth 
)

Constructor: Initialise a LooseOctree living in a bounding box defined by "center" and "length".

Definition at line 124 of file looseoctree.h.

References mesh::LooseOctree< NodeType >::_root.

template<typename NodeType>
mesh::LooseOctree< NodeType >::~LooseOctree (  ) 

Destructor: recursively deletes all Octants

Definition at line 131 of file looseoctree.h.

References mesh::LooseOctree< NodeType >::_root.


Member Function Documentation

template<typename NodeType>
Octant< NodeType > * mesh::LooseOctree< NodeType >::add_node ( NodeType *  node,
Octant< NodeType > *  start = 0,
int  depth = 0 
)

Add a new node, starting at the given Octree, and recursing at max to level _max_depth. The return value is a pointer to the Octant storing the node.

Definition at line 137 of file looseoctree.h.

References mesh::Octant< NodeType >::_children, mesh::Octant< NodeType >::_length, mesh::LooseOctree< NodeType >::_max_depth, mesh::LooseOctree< NodeType >::_root, mesh::Octant< NodeType >::add_node(), mesh::Octant< NodeType >::get_child_index_for_point(), mesh::Vector3::x, mesh::Vector3::y, and mesh::Vector3::z.

Here is the call graph for this function:

template<typename NodeType>
void mesh::LooseOctree< NodeType >::export_vtk (  ) 

Export LooseOctree to a series of VTK files (one for each level).

The VTK files are named "octree_lX.vtk", where X is the level number. The root Octant has level 0.

Definition at line 278 of file looseoctree.h.

References mesh::LooseOctree< NodeType >::export_vtk_level(), and mesh::LooseOctree< NodeType >::get_statistics().

Here is the call graph for this function:

template<typename NodeType>
void mesh::LooseOctree< NodeType >::export_vtk_level ( int  level,
std::string  filename 
)

Export one level of the LooseOctree to a VTK file.

Definition at line 293 of file looseoctree.h.

References mesh::LooseOctree< NodeType >::_root, mesh::LooseOctree< NodeType >::export_vtk_recursive(), mesh::Vector3::x, x, mesh::Vector3::y, y, and mesh::Vector3::z.

Referenced by mesh::LooseOctree< NodeType >::export_vtk().

Here is the call graph for this function:

template<typename NodeType>
void mesh::LooseOctree< NodeType >::export_vtk_recursive ( Octant< NodeType > *  octant,
int  depth,
int  x,
int  y,
int  z,
int  target_depth,
std::vector< int > &  cells 
) [protected]

Definition at line 354 of file looseoctree.h.

References mesh::Octant< NodeType >::_children.

Referenced by mesh::LooseOctree< NodeType >::export_vtk_level().

template<typename NodeType>
void mesh::LooseOctree< NodeType >::find_nodes_by_point ( const Vector3 coord,
std::vector< NodeType * > &  node_list,
int &  nof_visited,
LooseOctree< NodeType >::filter  filter,
Octant< NodeType > *  octant = 0 
)

Find nodes who contain the given point. For determining whether a node contains the point the "filter" function is called. All found nodes are appended to "node_list". "nof_visited" is a variable which is incremented each time a node is checked. On input "nof_visited" should be set to zero. "octant" specifies the starting octant. By default the search starts at the root node.

template<typename NodeType>
NodeType* mesh::LooseOctree< NodeType >::find_one_node_by_point ( const Vector3 coord,
int &  nof_visited,
LooseOctree< NodeType >::filter  filter,
Octant< NodeType > *  octant = 0 
)

Finds a node who contain the given point. For determining whether a node contains the point the "filter" function is called. "nof_visited" is a variable which is incremented each time a node is checked. On input "nof_visited" should be set to zero. "octant" specifies the starting octant. By default the search starts at the root node. If no node was found, 0 is returned.

template<typename NodeType>
void mesh::LooseOctree< NodeType >::get_statistics ( int &  max_depth,
double &  avg_node_depth,
int &  nof_octants,
int &  nof_nodes 
)

Compute statistics on the octree (maximum depth over all octants, average depth over all nodes, number of octants, number of nodes).

Definition at line 240 of file looseoctree.h.

References mesh::LooseOctree< NodeType >::_root, and mesh::LooseOctree< NodeType >::get_statistics_recursive().

Referenced by mesh::LooseOctree< NodeType >::export_vtk().

Here is the call graph for this function:

template<typename NodeType>
void mesh::LooseOctree< NodeType >::get_statistics_recursive ( Octant< NodeType > *  octant,
int  depth,
int &  max_depth,
double &  sum_depth,
int &  nof_octants,
int &  nof_nodes 
) [protected]

Definition at line 257 of file looseoctree.h.

References mesh::Octant< NodeType >::_children, and mesh::Octant< NodeType >::_nodes.

Referenced by mesh::LooseOctree< NodeType >::get_statistics().


Member Data Documentation

template<typename NodeType>
int mesh::LooseOctree< NodeType >::_max_depth [private]

Maximum tree depth

Definition at line 119 of file looseoctree.h.

Referenced by mesh::LooseOctree< NodeType >::add_node().

template<typename NodeType>
Octant<NodeType>* mesh::LooseOctree< NodeType >::_root [private]

Root Octant

Definition at line 117 of file looseoctree.h.

Referenced by mesh::LooseOctree< NodeType >::add_node(), mesh::LooseOctree< NodeType >::export_vtk_level(), mesh::LooseOctree< NodeType >::get_statistics(), mesh::LooseOctree< NodeType >::LooseOctree(), and mesh::LooseOctree< NodeType >::~LooseOctree().


The documentation for this class was generated from the following file:
Generated on Fri Oct 26 13:35:17 2007 for FEMAXX (Finite Element Maxwell Eigensolver) by  doxygen 1.4.7