NEST  2.6.0,not_revisioned_source_dir@0
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
nest::Ntree< D, T, max_capacity, max_depth > Class Template Reference

A Ntree object represents a subtree or leaf in a Ntree structure. More...

#include <ntree.h>

Classes

class  iterator
 Iterator iterating the nodes in a Quadtree. More...
 
class  masked_iterator
 Iterator iterating the nodes in a Quadtree inside a Mask. More...
 

Public Types

typedef Position< D > key_type
 
typedef T mapped_type
 
typedef std::pair< Position< D >
, T > 
value_type
 
typedef value_typereference
 
typedef const value_typeconst_reference
 

Public Member Functions

 Ntree (const Position< D > &lower_left, const Position< D > &extent, std::bitset< D > periodic=0, Ntree *parent=0, int subquad=0)
 Create a Ntree that covers the region defined by the two input positions. More...
 
 ~Ntree ()
 Delete Ntree recursively. More...
 
iterator insert (Position< D > pos, const T &node)
 Traverse quadtree structure from current ntree. More...
 
iterator insert (const value_type &val)
 std::multimap like insert method More...
 
iterator insert (iterator, const value_type &val)
 STL container compatible insert method (the first argument is ignored) More...
 
std::vector< value_typeget_nodes ()
 
std::vector< value_typeget_nodes (const Mask< D > &mask, const Position< D > &anchor)
 Applies a Mask to this ntree. More...
 
iterator begin ()
 This function returns a node iterator which will traverse the subtree below this Ntree. More...
 
iterator end ()
 
masked_iterator masked_begin (const Mask< D > &mask, const Position< D > &anchor)
 This function returns a masked node iterator which will traverse the subtree below this Ntree, skipping nodes outside the mask. More...
 
masked_iterator masked_end ()
 
bool is_leaf () const
 

Static Public Attributes

static const int N = 1<<D
 

Protected Member Functions

void split_ ()
 Change a leaf ntree to a regular ntree with four children regions. More...
 
void append_nodes_ (std::vector< value_type > &)
 Append this ntree's nodes to the vector. More...
 
void append_nodes_ (std::vector< value_type > &, const Mask< D > &, const Position< D > &)
 Append this ntree's nodes inside the mask to the vector. More...
 
int subquad_ (const Position< D > &)
 

Protected Attributes

Position< D > lower_left_
 
Position< D > extent_
 
bool leaf_
 
std::vector< value_typenodes_
 
Ntreeparent_
 
int my_subquad_
 This Ntree's subquad number within parent. More...
 
int my_depth_
 This Ntree's depth in the tree. More...
 
Ntreechildren_ [N]
 
std::bitset< D > periodic_
 periodic b.c. More...
 

Friends

class iterator
 
class masked_iterator
 

Detailed Description

template<int D, class T, int max_capacity = 100, int max_depth = 10>
class nest::Ntree< D, T, max_capacity, max_depth >

A Ntree object represents a subtree or leaf in a Ntree structure.

Any ntree covers a specific region in space. A leaf ntree contains a list of items and their corresponding positions. A branch ntree contains a list of N=1<<D other ntrees, each covering a region corresponding to the upper-left, lower-left, upper-right and lower-left corner of their mother ntree.

Member Typedef Documentation

template<int D, class T, int max_capacity = 100, int max_depth = 10>
typedef const value_type& nest::Ntree< D, T, max_capacity, max_depth >::const_reference
template<int D, class T, int max_capacity = 100, int max_depth = 10>
typedef Position<D> nest::Ntree< D, T, max_capacity, max_depth >::key_type
template<int D, class T, int max_capacity = 100, int max_depth = 10>
typedef T nest::Ntree< D, T, max_capacity, max_depth >::mapped_type
template<int D, class T, int max_capacity = 100, int max_depth = 10>
typedef value_type& nest::Ntree< D, T, max_capacity, max_depth >::reference
template<int D, class T, int max_capacity = 100, int max_depth = 10>
typedef std::pair<Position<D>,T> nest::Ntree< D, T, max_capacity, max_depth >::value_type

Constructor & Destructor Documentation

template<int D, class T , int max_capacity, int max_depth>
nest::Ntree< D, T, max_capacity, max_depth >::Ntree ( const Position< D > &  lower_left,
const Position< D > &  extent,
std::bitset< D >  periodic = 0,
Ntree< D, T, max_capacity, max_depth > *  parent = 0,
int  subquad = 0 
)

Create a Ntree that covers the region defined by the two input positions.

Parameters
lower_leftLower left corner of ntree.
extentSize (width,height) of ntree.
template<int D, class T , int max_capacity, int max_depth>
nest::Ntree< D, T, max_capacity, max_depth >::~Ntree ( )

Delete Ntree recursively.

References nest::names::n, and nest::names::N.

Member Function Documentation

template<int D, class T, int max_capacity = 100, int max_depth = 10>
void nest::Ntree< D, T, max_capacity, max_depth >::append_nodes_ ( std::vector< value_type > &  )
protected

Append this ntree's nodes to the vector.

Referenced by nest::Ntree< D, T, max_capacity, max_depth >::get_nodes().

template<int D, class T, int max_capacity = 100, int max_depth = 10>
void nest::Ntree< D, T, max_capacity, max_depth >::append_nodes_ ( std::vector< value_type > &  ,
const Mask< D > &  ,
const Position< D > &   
)
protected

Append this ntree's nodes inside the mask to the vector.

template<int D, class T, int max_capacity = 100, int max_depth = 10>
iterator nest::Ntree< D, T, max_capacity, max_depth >::begin ( void  )
inline

This function returns a node iterator which will traverse the subtree below this Ntree.

Returns
iterator for nodes in quadtree.

References nest::Ntree< D, T, max_capacity, max_depth >::iterator.

template<int D, class T, int max_capacity = 100, int max_depth = 10>
iterator nest::Ntree< D, T, max_capacity, max_depth >::end ( void  )
inline
template<int D, class T , int max_capacity, int max_depth>
std::vector< std::pair< Position< D >, T > > nest::Ntree< D, T, max_capacity, max_depth >::get_nodes ( )
Returns
member nodes in ntree and their position.

References nest::Ntree< D, T, max_capacity, max_depth >::append_nodes_().

template<int D, class T , int max_capacity, int max_depth>
std::vector< std::pair< Position< D >, T > > nest::Ntree< D, T, max_capacity, max_depth >::get_nodes ( const Mask< D > &  mask,
const Position< D > &  anchor 
)

Applies a Mask to this ntree.

Parameters
maskmask to apply.
anchorposition to center mask in.
Returns
member nodes in ntree inside mask.

References nest::Ntree< D, T, max_capacity, max_depth >::append_nodes_().

template<int D, class T , int max_capacity, int max_depth>
Ntree< D, T, max_capacity, max_depth >::iterator nest::Ntree< D, T, max_capacity, max_depth >::insert ( Position< D >  pos,
const T &  node 
)
template<int D, class T, int max_capacity = 100, int max_depth = 10>
iterator nest::Ntree< D, T, max_capacity, max_depth >::insert ( const value_type val)

std::multimap like insert method

template<int D, class T, int max_capacity = 100, int max_depth = 10>
iterator nest::Ntree< D, T, max_capacity, max_depth >::insert ( iterator  ,
const value_type val 
)

STL container compatible insert method (the first argument is ignored)

template<int D, class T , int max_capacity, int max_depth>
bool nest::Ntree< D, T, max_capacity, max_depth >::is_leaf ( ) const
template<int D, class T, int max_capacity = 100, int max_depth = 10>
masked_iterator nest::Ntree< D, T, max_capacity, max_depth >::masked_begin ( const Mask< D > &  mask,
const Position< D > &  anchor 
)
inline

This function returns a masked node iterator which will traverse the subtree below this Ntree, skipping nodes outside the mask.

Returns
iterator for nodes in quadtree.

References nest::Ntree< D, T, max_capacity, max_depth >::masked_iterator.

template<int D, class T, int max_capacity = 100, int max_depth = 10>
masked_iterator nest::Ntree< D, T, max_capacity, max_depth >::masked_end ( )
inline
template<int D, class T , int max_capacity, int max_depth>
void nest::Ntree< D, T, max_capacity, max_depth >::split_ ( )
protected
template<int D, class T , int max_capacity, int max_depth>
int nest::Ntree< D, T, max_capacity, max_depth >::subquad_ ( const Position< D > &  pos)
protected

Friends And Related Function Documentation

template<int D, class T, int max_capacity = 100, int max_depth = 10>
friend class iterator
friend
template<int D, class T, int max_capacity = 100, int max_depth = 10>
friend class masked_iterator
friend

Member Data Documentation

template<int D, class T, int max_capacity = 100, int max_depth = 10>
Ntree* nest::Ntree< D, T, max_capacity, max_depth >::children_[N]
protected
template<int D, class T, int max_capacity = 100, int max_depth = 10>
Position<D> nest::Ntree< D, T, max_capacity, max_depth >::extent_
protected
template<int D, class T, int max_capacity = 100, int max_depth = 10>
bool nest::Ntree< D, T, max_capacity, max_depth >::leaf_
protected
template<int D, class T, int max_capacity = 100, int max_depth = 10>
Position<D> nest::Ntree< D, T, max_capacity, max_depth >::lower_left_
protected
template<int D, class T, int max_capacity = 100, int max_depth = 10>
int nest::Ntree< D, T, max_capacity, max_depth >::my_depth_
protected

This Ntree's depth in the tree.

Referenced by nest::Ntree< D, T, max_capacity, max_depth >::insert().

template<int D, class T, int max_capacity = 100, int max_depth = 10>
int nest::Ntree< D, T, max_capacity, max_depth >::my_subquad_
protected

This Ntree's subquad number within parent.

template<int D, class T, int max_capacity = 100, int max_depth = 10>
const int nest::Ntree< D, T, max_capacity, max_depth >::N = 1<<D
static
template<int D, class T, int max_capacity = 100, int max_depth = 10>
std::vector<value_type> nest::Ntree< D, T, max_capacity, max_depth >::nodes_
protected
template<int D, class T, int max_capacity = 100, int max_depth = 10>
Ntree* nest::Ntree< D, T, max_capacity, max_depth >::parent_
protected
template<int D, class T, int max_capacity = 100, int max_depth = 10>
std::bitset<D> nest::Ntree< D, T, max_capacity, max_depth >::periodic_
protected

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