53template <
int D,
class T,
int max_capacity = 100,
int max_depth = 10 >
57 static const int N = 1 << D;
129 return other.ntree_ ==
ntree_ and ( other.node_ ==
node_ );
134 return ( other.ntree_ !=
ntree_ ) or ( other.node_ !=
node_ );
216 return other.ntree_ ==
ntree_ and ( other.node_ ==
node_ );
221 return ( other.ntree_ !=
ntree_ ) or ( other.node_ !=
node_ );
282 std::bitset< D > periodic = 0,
409template <
int D,
class T,
int max_capacity,
int max_depth >
412 std::bitset< D > periodic,
415 : lower_left_( lower_left )
419 , my_subquad_( subquad )
420 , my_depth_( parent ? parent->my_depth_ + 1 : 0 )
421 , periodic_( periodic )
425template <
int D,
class T,
int max_capacity,
int max_depth >
434 for (
size_t n = 0; n < static_cast< size_t >( N ); ++n )
436 delete children_[ n ];
440template <
int D,
class T,
int max_capacity,
int max_depth >
455template <
int D,
class T,
int max_capacity,
int max_depth >
463template <
int D,
class T,
int max_capacity,
int max_depth >
464std::vector< std::pair< Position< D >, T > >
467 std::vector< std::pair< Position< D >, T > > result;
472template <
int D,
class T,
int max_capacity,
int max_depth >
473std::vector< std::pair< Position< D >, T > >
476 std::vector< std::pair< Position< D >, T > > result;
481template <
int D,
class T,
int max_capacity,
int max_depth >
485 return insert( val.first, val.second );
488template <
int D,
class T,
int max_capacity,
int max_depth >
489typename Ntree< D, T, max_capacity, max_depth >::iterator
492 return insert( val.first, val.second );
495template <
int D,
class T,
int max_capacity,
int max_depth >
Abstract base class for masks with given dimension.
Definition mask.h:101
Iterator iterating the nodes in a Quadtree.
Definition ntree.h:69
iterator & operator++()
Move the iterator to the next node within the tree.
Definition ntree_impl.h:61
Ntree * ntree_
Definition ntree.h:144
value_type * operator->()
Definition ntree.h:100
Ntree * top_
Definition ntree.h:145
bool operator==(const iterator &other) const
Iterators are equal if they point to the same node in the same ntree.
Definition ntree.h:127
size_t node_
Definition ntree.h:146
iterator()
Initialize an invalid iterator.
Definition ntree.h:74
bool operator!=(const iterator &other) const
Definition ntree.h:132
iterator operator++(int)
Postfix increment operator.
Definition ntree.h:115
value_type & operator*()
Definition ntree.h:95
void next_leaf_()
Move to the next leaf quadrant, or set ntree_ to 0 if there are no more leaves.
Definition ntree_impl.h:82
Iterator iterating the nodes in a Quadtree inside a Mask.
Definition ntree.h:153
Ntree * ntree_
Definition ntree.h:262
value_type * operator->()
Definition ntree.h:184
std::vector< Position< D > > anchors_
Definition ntree.h:269
masked_iterator operator++(int)
Postfix increment operator.
Definition ntree.h:202
value_type * pointer
Definition ntree.h:157
void first_leaf_inside_()
Set the allin_top_ to the current quadrant, and find the first leaf below the current quadrant.
Definition ntree_impl.h:333
void init_()
Initialize.
Definition ntree_impl.h:176
value_type & operator*()
Definition ntree.h:179
masked_iterator & operator++()
Move the iterator to the next node inside the mask within the tree.
Definition ntree_impl.h:346
long int difference_type
Definition ntree.h:159
const Mask< D > * mask_
Definition ntree.h:266
Ntree * allin_top_
Definition ntree.h:264
bool operator!=(const masked_iterator &other) const
Definition ntree.h:219
masked_iterator()
Initialize an invalid iterator.
Definition ntree.h:163
std::pair< Position< D >, T > value_type
Definition ntree.h:156
Position< D > anchor_
Definition ntree.h:267
bool operator==(const masked_iterator &other) const
Iterators are equal if they point to the same node in the same ntree.
Definition ntree.h:214
size_t current_anchor_
Definition ntree.h:270
Ntree * top_
Definition ntree.h:263
void next_leaf_()
Find the next leaf which is not outside the mask.
Definition ntree_impl.h:226
void next_anchor_()
Go to the next anchor image.
Definition ntree_impl.h:208
value_type & reference
Definition ntree.h:158
void first_leaf_()
Find the first leaf which is not outside the mask.
Definition ntree_impl.h:311
Position< D > anchored_position_
Definition ntree.h:268
std::forward_iterator_tag iterator_category
Definition ntree.h:155
size_t node_
Definition ntree.h:265
bool anchored_position_inside_mask(const Position< D > &position)
Definition ntree.h:254
A Ntree object represents a subtree or leaf in a Ntree structure.
Definition ntree.h:55
value_type & reference
Definition ntree.h:62
iterator insert(Position< D > pos, const T &node)
Traverse quadtree structure from current ntree.
Definition ntree_impl.h:453
Position< D > lower_left_
Definition ntree.h:392
Ntree * parent_
Definition ntree.h:399
bool is_leaf() const
Definition ntree.h:457
std::pair< Position< D >, T > value_type
Definition ntree.h:61
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.
Definition ntree.h:410
T mapped_type
Definition ntree.h:60
iterator insert(const value_type &val)
std::multimap like insert method
masked_iterator masked_end()
Definition ntree.h:360
int my_subquad_
This Ntree's subquad number within parent.
Definition ntree.h:400
void push_back(const value_type &val)
STL container compatible push_back method.
Definition ntree.h:497
Position< D > extent_
Definition ntree.h:393
void split_()
Change a leaf ntree to a regular ntree with four children regions.
Definition ntree_impl.h:502
int my_depth_
This Ntree's depth in the tree.
Definition ntree.h:401
~Ntree()
Delete Ntree recursively.
Definition ntree.h:426
int subquad_(const Position< D > &)
Definition ntree_impl.h:384
Position< D > key_type
Definition ntree.h:59
static const int N
Definition ntree.h:57
Ntree * children_[N]
Definition ntree.h:402
iterator insert(iterator, const value_type &val)
STL container compatible insert method (the first argument is ignored)
iterator begin()
This function returns a node iterator which will traverse the subtree below this Ntree.
Definition ntree.h:336
std::vector< value_type > nodes_
Definition ntree.h:397
std::vector< value_type > get_nodes()
Definition ntree.h:465
std::bitset< D > periodic_
periodic b.c.
Definition ntree.h:403
void append_nodes_(std::vector< value_type > &, const Mask< D > &, const Position< D > &)
Append this ntree's nodes inside the mask to the vector.
void append_nodes_(std::vector< value_type > &)
Append this ntree's nodes to the vector.
const value_type & const_reference
Definition ntree.h:63
iterator end()
Definition ntree.h:342
bool leaf_
Definition ntree.h:395
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,...
Definition ntree.h:354
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33