NEST main@caf0ae8
 
Loading...
Searching...
No Matches
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>

Collaboration diagram for nest::Ntree< D, T, max_capacity, max_depth >:
[legend]

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_type & reference
 
typedef const value_type & const_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.
 
 ~Ntree ()
 Delete Ntree recursively.
 
iterator insert (Position< D > pos, const T &node)
 Traverse quadtree structure from current ntree.
 
iterator insert (const value_type &val)
 std::multimap like insert method
 
iterator insert (iterator, const value_type &val)
 STL container compatible insert method (the first argument is ignored)
 
void push_back (const value_type &val)
 STL container compatible push_back method.
 
std::vector< value_type > get_nodes ()
 
std::vector< value_type > get_nodes (const Mask< D > &mask, const Position< D > &anchor)
 Applies a Mask to this ntree.
 
iterator begin ()
 This function returns a node iterator which will traverse the subtree below this Ntree.
 
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.
 
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.
 
void append_nodes_ (std::vector< value_type > &)
 Append this ntree's nodes to the vector.
 
void append_nodes_ (std::vector< value_type > &, const Mask< D > &, const Position< D > &)
 Append this ntree's nodes inside the mask to the vector.
 
int subquad_ (const Position< D > &)
 

Protected Attributes

Position< D > lower_left_
 
Position< D > extent_
 
bool leaf_
 
std::vector< value_type > nodes_
 
Ntree * parent_
 
int my_subquad_
 This Ntree's subquad number within parent.
 
int my_depth_
 This Ntree's depth in the tree.
 
Ntree * children_ [N]
 
std::bitset< D > periodic_
 periodic b.c.
 

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

◆ const_reference

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

◆ key_type

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

◆ mapped_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

◆ reference

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

◆ value_type

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

◆ Ntree()

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.

◆ ~Ntree()

template<int D, class T , int max_capacity, int max_depth>
nest::Ntree< D, T, max_capacity, max_depth >::~Ntree ( )

Delete Ntree recursively.

Member Function Documentation

◆ append_nodes_() [1/2]

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(), and nest::Ntree< D, T, max_capacity, max_depth >::get_nodes().

Here is the caller graph for this function:

◆ append_nodes_() [2/2]

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.

◆ begin()

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

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

Returns
iterator for nodes in quadtree.

◆ end()

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

◆ get_nodes() [1/2]

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_().

Here is the call graph for this function:

◆ get_nodes() [2/2]

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_().

Here is the call graph for this function:

◆ insert() [1/3]

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

◆ insert() [2/3]

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)

◆ insert() [3/3]

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 
)

Traverse quadtree structure from current ntree.

Inserts node in correct leaf in quadtree.

Returns
iterator pointing to inserted node.

References nest::Ntree< D, T, max_capacity, max_depth >::children_, nest::Ntree< D, T, max_capacity, max_depth >::extent_, nest::Ntree< D, T, max_capacity, max_depth >::insert(), nest::Ntree< D, T, max_capacity, max_depth >::leaf_, nest::Ntree< D, T, max_capacity, max_depth >::lower_left_, nest::Ntree< D, T, max_capacity, max_depth >::my_depth_, nest::Ntree< D, T, max_capacity, max_depth >::nodes_, nest::Ntree< D, T, max_capacity, max_depth >::periodic_, nest::Ntree< D, T, max_capacity, max_depth >::split_(), and nest::Ntree< D, T, max_capacity, max_depth >::subquad_().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_leaf()

template<int D, class T , int max_capacity, int max_depth>
bool nest::Ntree< D, T, max_capacity, max_depth >::is_leaf ( ) const
Returns
true if ntree is a leaf.

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

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

Here is the caller graph for this function:

◆ masked_begin()

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.

◆ masked_end()

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

◆ push_back()

template<int D, class T , int max_capacity, int max_depth>
void nest::Ntree< D, T, max_capacity, max_depth >::push_back ( const value_type &  val)

STL container compatible push_back method.

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

Here is the call graph for this function:

◆ split_()

template<int D, class T , int max_capacity, int max_depth>
void nest::Ntree< D, T, max_capacity, max_depth >::split_ ( )
protected

Change a leaf ntree to a regular ntree with four children regions.

References nest::Ntree< D, T, max_capacity, max_depth >::children_, nest::Ntree< D, T, max_capacity, max_depth >::extent_, nest::Ntree< D, T, max_capacity, max_depth >::insert(), nest::Ntree< D, T, max_capacity, max_depth >::leaf_, nest::Ntree< D, T, max_capacity, max_depth >::lower_left_, nest::Ntree< D, T, max_capacity, max_depth >::N, nest::Ntree< D, T, max_capacity, max_depth >::nodes_, and nest::Ntree< D, T, max_capacity, max_depth >::subquad_().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subquad_()

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
Returns
the subquad number for this position

References nest::Ntree< D, T, max_capacity, max_depth >::extent_, and nest::Ntree< D, T, max_capacity, max_depth >::lower_left_.

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

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ iterator

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

◆ masked_iterator

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

Member Data Documentation

◆ children_

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

◆ extent_

◆ leaf_

◆ lower_left_

◆ my_depth_

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().

◆ my_subquad_

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.

◆ N

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

◆ nodes_

◆ parent_

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

◆ periodic_

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: