34 template<
typename node,
bool isconst = false>
39 typedef typename choose<isconst, const node&, node&>::type reference;
40 typedef typename choose<isconst, const node*, node*>::type pointer;
42 typedef typename node::point::Projection_t point;
44 static const index_t d = point::_Rows;
47 reference operator*()
const {
return *curNode; }
48 pointer operator->()
const {
return curNode; }
60 const unsigned index_level)
61 : m_dir(m_dir), m_pos(_pos), m_last(_last),
m_index_level(index_level)
63 m_stack.push(root_node);
72 while ( ! m_stack.empty() )
74 curNode = m_stack.top();
77 if ( curNode->isLeaf() )
91 if ( curNode->axis == m_dir )
93 if (m_pos < curNode->pos)
94 m_stack.push(curNode->left);
96 m_stack.push(curNode->right);
100 m_stack.push(curNode->left);
101 m_stack.push(curNode->right);
112 bool good()
const {
return curNode != 0; }
118 m_stack.push(root_node);
121 int level()
const {
return curNode->level; }
128 result.topRows (m_dir ) = curNode->box->first.topRows(m_dir );
129 result.bottomRows(d-m_dir) = curNode->box->first.bottomRows(d-m_dir);
131 const int lvl = curNode->level;
133 for (
index_t i = 0; i!= result.size(); ++i )
143 point result = curNode->box->second;
144 result.topRows (m_dir ) = curNode->box->second.topRows(m_dir );
145 result.bottomRows(d-m_dir) = curNode->box->second.bottomRows(d-m_dir);
147 const int lvl = curNode->level;
149 for (
index_t i = 0; i!=result.size(); ++i )
171 std::stack<node*> m_stack;
void startFrom(node *const root_node)
The iteration is done in the sub-tree hanging from node root_node.
Definition: gsHDomainSliceIter.h:115
point upperCorner() const
The upper corner of the sliced box. Note that m_dir is skipped.
Definition: gsHDomainSliceIter.h:141
#define index_t
Definition: gsConfig.h:32
Iterates over the leaves of an gsHDomain (tree) that intersect with a slice position.
Definition: gsHDomainSliceIter.h:35
unsigned m_index_level
The level of the box representation.
Definition: gsHDomainSliceIter.h:168
bool good() const
Returns true iff we are still pointing at a valid leaf.
Definition: gsHDomainSliceIter.h:112
Provides declaration of the tree node.
point lowerCorner() const
The lower corner of the sliced box. Note that m_dir is skipped.
Definition: gsHDomainSliceIter.h:125