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();
115 m_leaf = hbs->
tree().beginLeafIterator();
126 return m_leaf.level();
131 gsVector<index_t> elementMultiIndex()
const
133 gsVector<index_t> res(d);
136 res[i] =
std::distance(m_breaks[i].begin(), m_curElement[i]);
161 const point & lower = m_leaf.lowerCorner();
162 const point & upper = m_leaf.upperCorner();
166 const int level2 = m_leaf.level();
174 if (basis().manualLevels() )
177 _diadicIndexToKnotIndex(level2,
dim,start);
179 _diadicIndexToKnotIndex(level2,
dim,end);
188 m_breaks[
dim].clear();
189 for (
index_t index = start; index <= end; ++index)
190 m_breaks[
dim].push_back( kv(index) );
193 m_meshStart(
dim) = m_breaks[
dim].begin();
196 m_meshEnd(
dim) = m_breaks[
dim].end() - 1;
206 for (
unsigned i = 0; i < d ; ++i)
208 m_lower[i] = *m_curElement[i];
209 m_upper[i] = *(m_curElement[i]+1);
210 center[i] = (T)(0.5) * (m_lower[i] + m_upper[i]);
222 using gsDomainIterator<T>::center;
223 using gsDomainIterator<T>::m_basis;
225 # define Eigen gsEigen
226 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
230 using gsDomainIterator<T>::m_id;
239 std::vector< std::vector<T> > m_breaks;
242 gsVector<uiter, d> m_meshStart, m_meshEnd;
245 gsVector<uiter, d> m_curElement;
248 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:146
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:122
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:159
void updateElement()
Definition: gsHDomainIterator.h:203
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:120
Provides declaration of TensorBSplineBasis abstract interface.