37 template<
typename T,
unsigned d>
38 class gsHDomainIterator:
public gsDomainIterator<T>
42 typedef gsKdNode<d, index_t> node;
44 typedef typename node::point point;
46 typedef typename std::vector<T>::const_iterator uiter;
48 typedef gsHDomain<d,index_t> hDomain;
50 typedef typename hDomain::const_literator leafIterator;
54 gsHDomainIterator(
const gsHTensorBasis<d, T> & hbs)
55 : gsDomainIterator<T>(hbs)
58 m_meshStart.resize(d);
62 m_curElement.resize(d);
67 m_breaks = std::vector<std::vector<T> >(d, std::vector<T>());
69 m_leaf = hbs.tree().beginLeafIterator();
114 m_leaf = hbs->
tree().beginLeafIterator();
125 return m_leaf.level();
130 gsVector<index_t> elementMultiIndex()
const
132 gsVector<index_t> res(d);
135 res[i] =
std::distance(m_breaks[i].begin(), m_curElement[i]);
160 const point & lower = m_leaf.lowerCorner();
161 const point & upper = m_leaf.upperCorner();
165 const int level2 = m_leaf.level();
173 if (basis().manualLevels() )
176 _diadicIndexToKnotIndex(level2,
dim,start);
178 _diadicIndexToKnotIndex(level2,
dim,end);
187 m_breaks[
dim].clear();
188 for (
index_t index = start; index <= end; ++index)
189 m_breaks[
dim].push_back( kv(index) );
192 m_meshStart(
dim) = m_breaks[
dim].begin();
195 m_meshEnd(
dim) = m_breaks[
dim].end() - 1;
205 for (
unsigned i = 0; i < d ; ++i)
207 m_lower[i] = *m_curElement[i];
208 m_upper[i] = *(m_curElement[i]+1);
209 center[i] = (T)(0.5) * (m_lower[i] + m_upper[i]);
221 using gsDomainIterator<T>::center;
222 using gsDomainIterator<T>::m_basis;
224 # define Eigen gsEigen
225 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
229 using gsDomainIterator<T>::m_id;
238 std::vector< std::vector<T> > m_breaks;
241 gsVector<uiter, d> m_meshStart, m_meshEnd;
244 gsVector<uiter, d> m_curElement;
247 gsVector<T> m_lower, m_upper;
T distance(gsMatrix< T > const &A, gsMatrix< T > const &B, index_t i=0, index_t j=0, bool cols=false)
compute a distance between the point number in the set and the point number <j> in the set ; by def...
bool nextLeaf()
returns true if there is a another leaf with a boundary element
Definition: gsHDomainIterator.h:145
short_t dim() const
Return dimension of the elements.
Definition: gsDomainIterator.h:115
#define index_t
Definition: gsConfig.h:32
const gsHDomain< d > & tree() const
Returns a reference to m_tree.
Definition: gsHTensorBasis.h:601
Provides declaration of the HDomain class.
virtual gsBSplineBasis< T > & component(short_t i)
The 1-d basis for the i-th parameter component at the highest level.
Definition: gsHTensorBasis.h:656
Class representing a (scalar) hierarchical tensor basis of functions .
Definition: gsHTensorBasis.h:74
void reset()
Definition: gsHDomainIterator.h:111
bool next(index_t increment)
Proceeds to the next element (skipping increment elements).
Definition: gsHDomainIterator.h:93
Provides declaration of DomainIterator abstract interface.
bool m_isGood
Definition: gsDomainIterator.h:223
const gsVector< T > & upperCorner() const
Returns the upper corner of the current element.
Definition: gsHDomainIterator.h:121
bool nextLexicographic(Vec &cur, const Vec &size)
Iterates through a tensor lattice with the given size. Updates cur and returns true if another entry ...
Definition: gsCombinatorics.h:196
const gsBasis< T > * m_basis
The basis on which the domain iterator is defined.
Definition: gsDomainIterator.h:219
gsVector< T > center
Coordinates of a central point in the element (in the parameter domain).
Definition: gsDomainIterator.h:215
Class for representing a knot vector.
Definition: gsKnotVector.h:79
void updateLeaf()
Definition: gsHDomainIterator.h:158
void updateElement()
Definition: gsHDomainIterator.h:202
Provides declaration of the tree node.
bool next()
Proceeds to the next element.
Definition: gsHDomainIterator.h:75
bool good() const
Returns true iff we are still pointing at a valid leaf.
Definition: gsHDomainLeafIter.h:81
const gsVector< T > & lowerCorner() const
Returns the lower corner of the current element.
Definition: gsHDomainIterator.h:119
Provides declaration of TensorBSplineBasis abstract interface.