node< _CELL > Class Template Reference

#include <node.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes

Protected Member Functions


Detailed Description

template<class _CELL>
class mmx::shape::node< _CELL >

Definition at line 22 of file node.hpp.


Member Typedef Documentation

typedef _CELL Cell

Definition at line 28 of file node.hpp.

typedef _CELL CELL

Definition at line 27 of file node.hpp.


Member Enumeration Documentation

enum NODE_TYPE
Enumerator:
LEFT 
RIGHT 

Definition at line 25 of file node.hpp.

00025 { LEFT, RIGHT } ;


Constructor & Destructor Documentation

node ( void   )  [inline]

Definition at line 81 of file node.hpp.

References node< _CELL >::depth, node< _CELL >::index, node< _CELL >::LEFT, node< _CELL >::m_cell, node< _CELL >::m_left, node< _CELL >::m_parent, node< _CELL >::m_right, node< _CELL >::m_type, and node< _CELL >::m_var.

00082 { 
00083     m_type   = LEFT ;
00084     m_var    = 0 ;
00085 
00086     m_parent = NULL ;
00087     m_left   = NULL;
00088     m_right  = NULL;
00089 
00090     m_cell   = NULL ;
00091 
00092 
00093     depth = 0;
00094     index = 0;
00095 } 

node ( CELL  cl  )  [inline]

Definition at line 97 of file node.hpp.

References node< _CELL >::depth, node< _CELL >::index, node< _CELL >::LEFT, node< _CELL >::m_cell, node< _CELL >::m_left, node< _CELL >::m_parent, node< _CELL >::m_right, node< _CELL >::m_type, and node< _CELL >::m_var.

00098 { 
00099     this->m_type   = LEFT ;
00100     this->m_var    = 0 ;
00101 
00102     this->m_parent = NULL ;
00103     this->m_left   = NULL;
00104     this->m_right  = NULL;
00105 
00106     this->m_cell   = cl ;
00107 //    m_objects.push_back(object) ;
00108 
00109     depth = 0;
00110     index = 0;
00111 } 

node ( node< CELL > *  parent,
CELL cl,
NODE_TYPE  nodeType,
int  v = 0 
) [inline]

Definition at line 125 of file node.hpp.

References node< _CELL >::depth, node< _CELL >::LEFT, node< _CELL >::m_cell, node< _CELL >::m_left, node< _CELL >::m_parent, node< _CELL >::m_right, node< _CELL >::m_type, node< _CELL >::m_var, and node< _CELL >::RIGHT.

00126 {  
00127     this->m_cell   = cl ;
00128     this->m_type   = type ;
00129     this->m_var    = v ;
00130     this->m_parent = parent ;
00131 
00132     this->m_left   = NULL;
00133     this->m_right  = NULL;
00134 
00135     depth = parent->depth+1 ;
00136 
00137     switch(type) {
00138     case LEFT : parent->set_leftchild(this) ; break ;
00139     case RIGHT: parent->set_rightchild(this) ; break ;
00140     default: std::cerr << "Error : the node's type isn't appropriate \n" ; break ;
00141     }
00142 }

node ( node< CELL > *  left,
node< CELL > *  right,
CELL  cl,
int  v = 0 
) [inline]

Definition at line 113 of file node.hpp.

References node< _CELL >::depth, node< _CELL >::LEFT, node< _CELL >::m_cell, node< _CELL >::m_left, node< _CELL >::m_parent, node< _CELL >::m_right, node< _CELL >::m_var, node< _CELL >::RIGHT, and node< _CELL >::type().

00113                                                          {
00114 
00115     this->m_parent = NULL ;
00116     this->m_cell   = cl ;
00117     this->m_var    = v ;
00118 
00119     left->type  = LEFT ;  left->parent = this ; m_left = left;
00120     right->type = RIGHT; right->parent = this ; m_right= right;
00121 
00122     depth = left->depth-1 ;
00123 }

node ( node< CELL > &  node  )  [protected]

Member Function Documentation

CELL& get_cell ( void   )  [inline]

Definition at line 47 of file node.hpp.

00047 { return m_cell ; }

const CELL& get_cell ( void   )  const [inline]
bool is_leaf ( void   )  const [inline]

Definition at line 144 of file node.hpp.

References node< _CELL >::m_left, and node< _CELL >::m_right.

Referenced by dualize< C, V, Cell >::get_dual_cell(), dualize< C, V, Cell >::get_dual_edge(), dualize< C, V, Cell >::get_dual_face(), dualize< C, V, Cell >::get_dual_vertex(), and node< _CELL >::leaf_distance().

00145 {
00146     if((m_left == NULL) && (m_right == NULL) )
00147         return true;
00148     return false;
00149 } 

size_t leaf_distance ( void   )  const [inline]

Definition at line 151 of file node.hpp.

References node< _CELL >::is_leaf(), node< _CELL >::m_left, node< _CELL >::m_right, mmx::min(), and NODE.

00152 {
00153     if ( this->is_leaf() )
00154         return 0;
00155 
00156     struct inner {
00157         size_t operator()( const NODE* node ) {
00158             if ( node == 0 )
00159                 return 0;
00160             else
00161                 return node->leaf_distance();
00162         }
00163     } I;
00164 
00165     size_t d = 0;
00166     d = std::min( d, I(m_left)  );
00167     d = std::min( d, I(m_right) );
00168 
00169     return d+1;
00170 }

const node<CELL>* left ( void   )  const [inline]

Definition at line 58 of file node.hpp.

00058 { return m_left ; }

node<CELL>* left ( void   )  [inline]
const node<CELL>* parent ( void   )  const [inline]

Definition at line 60 of file node.hpp.

00060 { return m_parent ; }

node<CELL>* parent ( void   )  [inline]

Definition at line 56 of file node.hpp.

00056 { return m_parent ; }

const node<CELL>* right ( void   )  const [inline]

Definition at line 59 of file node.hpp.

00059 { return m_right ; }

node<CELL>* right ( void   )  [inline]
void set_cell ( const CELL c  )  [inline]
void set_leftchild ( node< CELL > *  n  )  [inline]

Definition at line 43 of file node.hpp.

00043 { m_left = n ; }

void set_parent ( node< CELL > *  n  )  [inline]

Definition at line 41 of file node.hpp.

Referenced by kdtree< CELL * >::kdtree().

00041 { m_parent = n ; }

void set_rightchild ( node< CELL > *  n  )  [inline]

Definition at line 44 of file node.hpp.

00044 { m_right = n ; }

int split_dir ( void   )  const [inline]

Definition at line 52 of file node.hpp.

00052 { return m_var; }

NODE_TYPE type ( void   )  const [inline]

Definition at line 51 of file node.hpp.

Referenced by node< _CELL >::node().

00051 { return m_type ; }

int var ( void   )  const [inline]

Definition at line 62 of file node.hpp.

00062 {return this->m_var;}


Member Data Documentation

int depth

Definition at line 76 of file node.hpp.

Referenced by node< _CELL >::node().

int index

Definition at line 77 of file node.hpp.

Referenced by node< _CELL >::node().

Definition at line 69 of file node.hpp.

Referenced by node< _CELL >::node(), and node< CELL * >::type().

int m_var

Definition at line 70 of file node.hpp.

Referenced by node< _CELL >::node(), node< CELL * >::split_dir(), and node< CELL * >::var().


The documentation for this class was generated from the following file:

Generated on 6 Dec 2012 for shape by  doxygen 1.6.1