31 template<
int D,
class T,
int max_capacity,
int max_depth>
33 ntree_(&q), top_(&q), node_(0)
48 template<
int D,
class T,
int max_capacity,
int max_depth>
53 while (node_ >= ntree_->nodes_.size()) {
59 if (ntree_ == 0)
break;
66 template<
int D,
class T,
int max_capacity,
int max_depth>
71 while(ntree_ && (ntree_ != top_) && (ntree_->my_subquad_ ==
N-1)) {
72 ntree_ = ntree_->parent_;
85 ntree_ = ntree_->parent_->children_[ntree_->my_subquad_+1];
88 while(!ntree_->is_leaf())
89 ntree_ = ntree_->children_[0];
102 template<
int D,
class T,
int max_capacity,
int max_depth>
104 ntree_(&q), top_(&q), allin_top_(0), node_(0), mask_(&mask), anchor_(anchor), anchors_(), current_anchor_(0)
110 for(
int i=0;i<D;++i) {
119 for(
int i=0;i<D;++i) {
123 for(
int j=0;j<
n;++j) {
142 template<
int D,
class T,
int max_capacity,
int max_depth>
149 if (mask_->outside(
Box<D>(ntree_->lower_left_-anchor_,ntree_->lower_left_-anchor_+ntree_->extent_))) {
155 if (mask_->inside(
Box<D>(ntree_->lower_left_-anchor_, ntree_->lower_left_-anchor_+ntree_->extent_))) {
156 first_leaf_inside_();
161 if ( ntree_->nodes_.empty() || (!mask_->inside(ntree_->nodes_[node_].first-anchor_))) {
167 template<
int D,
class T,
int max_capacity,
int max_depth>
171 if (current_anchor_ >= anchors_.size()) {
176 anchor_ = anchors_[current_anchor_];
181 template<
int D,
class T,
int max_capacity,
int max_depth>
201 while(ntree_ && (ntree_ != allin_top_) && (ntree_->my_subquad_ ==
N-1)) {
202 ntree_ = ntree_->parent_;
209 if (ntree_ != allin_top_) {
212 ntree_ = ntree_->parent_->children_[ntree_->my_subquad_+1];
215 while(!ntree_->is_leaf())
216 ntree_ = ntree_->children_[0];
232 while(ntree_ && (ntree_ != top_) && (ntree_->my_subquad_ ==
N-1)) {
233 ntree_ = ntree_->parent_;
240 if (ntree_ == top_) {
241 return next_anchor_();
245 ntree_ = ntree_->parent_->children_[ntree_->my_subquad_+1];
247 if (mask_->inside(
Box<D>(ntree_->lower_left_-anchor_, ntree_->lower_left_-anchor_+ntree_->extent_))) {
248 return first_leaf_inside_();
251 }
while (mask_->outside(
Box<D>(ntree_->lower_left_-anchor_, ntree_->lower_left_-anchor_+ntree_->extent_)));
253 return first_leaf_();
256 template<
int D,
class T,
int max_capacity,
int max_depth>
259 while(!ntree_->is_leaf()) {
261 ntree_ = ntree_->children_[0];
263 if (mask_->inside(
Box<D>(ntree_->lower_left_-anchor_, ntree_->lower_left_-anchor_+ntree_->extent_))) {
264 return first_leaf_inside_();
267 if (mask_->outside(
Box<D>(ntree_->lower_left_-anchor_,ntree_->lower_left_-anchor_+ntree_->extent_))) {
275 template<
int D,
class T,
int max_capacity,
int max_depth>
281 while(!ntree_->is_leaf()) {
282 ntree_ = ntree_->children_[0];
286 template<
int D,
class T,
int max_capacity,
int max_depth>
291 if (allin_top_ == 0) {
292 while((node_ < ntree_->
nodes_.size()) && (!mask_->inside(ntree_->nodes_[node_].first-anchor_))) {
297 while (node_ >= ntree_->nodes_.size()) {
303 if (ntree_ == 0)
break;
305 if (allin_top_ == 0) {
306 while((node_ < ntree_->
nodes_.size()) && (!mask_->inside(ntree_->nodes_[node_].first-anchor_))) {
315 template<
int D,
class T,
int max_capacity,
int max_depth>
325 template<
int D,
class T,
int max_capacity,
int max_depth>
329 std::copy(
nodes_.begin(),
nodes_.end(), std::back_inserter(v));
331 for (
int i=0;i<
N;++i)
336 template<
int D,
class T,
int max_capacity,
int max_depth>
347 for(
typename std::vector<std::pair<Position<D>,T> >::
iterator i=
nodes_.begin();
349 if (mask.inside(i->first - anchor))
355 for (
int i=0;i<
N;++i)
361 template<
int D,
class T,
int max_capacity,
int max_depth>
369 for(
int i=0;i<D;++i) {
396 template<
int D,
class T,
int max_capacity,
int max_depth>
401 for(
int j=0;j<
N;++j) {
403 for(
int i=0;i<D;++i) {
masked_iterator & operator++()
Move the iterator to the next node inside the mask within the tree.
Definition: ntree_impl.h:287
const Mask< D > * mask_
Definition: ntree.h:203
bool is_leaf() const
Definition: ntree.h:357
Iterator iterating the nodes in a Quadtree inside a Mask.
Definition: ntree.h:128
bool leaf_
Definition: ntree.h:305
void next_leaf_()
Move to the next leaf quadrant, or set ntree_ to 0 if there are no more leaves.
Definition: ntree_impl.h:67
iterator & operator++()
Move the iterator to the next node within the tree.
Definition: ntree_impl.h:49
void next_anchor_()
Go to the next anchor image.
Definition: ntree_impl.h:168
void split_()
Change a leaf ntree to a regular ntree with four children regions.
Definition: ntree_impl.h:397
void next_leaf_()
Find the next leaf which is not outside the mask.
Definition: ntree_impl.h:182
int subquad_(const Position< D > &)
Definition: ntree_impl.h:316
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:276
Abstract base class for masks with given dimension.
Definition: mask.h:90
A Ntree object represents a subtree or leaf in a Ntree structure.
Definition: ntree.h:49
const Name anchor("anchor")
Definition: topology_names.h:50
static const int N
Definition: ntree.h:53
static double_t mod(double_t x, double_t p)
Definition: ntree_impl.h:94
Position< D > lower_left_
Definition: ntree.h:302
iterator insert(Position< D > pos, const T &node)
Traverse quadtree structure from current ntree.
Definition: ntree_impl.h:362
Iterator iterating the nodes in a Quadtree.
Definition: ntree.h:64
void first_leaf_()
Find the first leaf which is not outside the mask.
Definition: ntree_impl.h:257
A box is defined by the lower left corner (minimum coordinates) and the upper right corner (maximum c...
Definition: position.h:289
Position< D > extent_
Definition: ntree.h:303
int my_depth_
This Ntree's depth in the tree.
Definition: ntree.h:311
void init_()
Initialize.
Definition: ntree_impl.h:143
Ntree * ntree_
Definition: ntree.h:120
const Name x("x")
current scaling factor of the synaptic weight [0...1] (Tsodyks2_connection)
Definition: nest_names.h:356
Position< D > upper_right
Definition: position.h:297
std::vector< Position< D > > anchors_
Definition: ntree.h:205
std::bitset< D > periodic_
periodic b.c.
Definition: ntree.h:313
double double_t
Double precision floating point numbers.
Definition: nest.h:93
iterator()
Initialize an invalid iterator.
Definition: ntree.h:69
Position< D > anchor_
Definition: ntree.h:204
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
friend class iterator
Definition: ntree.h:315
std::vector< value_type > nodes_
Definition: ntree.h:307
Ntree * ntree_
Definition: ntree.h:199
Position< D > lower_left
Definition: position.h:296
const Name mask("mask")
Definition: topology_names.h:57
Ntree * children_[N]
Definition: ntree.h:312
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
void append_nodes_(std::vector< value_type > &)
Append this ntree's nodes to the vector.
masked_iterator()
Initialize an invalid iterator.
Definition: ntree.h:133