26 template<
short_t d,
class Z>
53 template<
int d,
class T>
57 # define Eigen gsEigen
58 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
63 typedef typename gsEigen::aligned_allocator<gsHBox<d,T>> aalloc;
65 typedef typename std::vector<index_t> RefBox;
66 typedef typename std::list<gsHBox<d,T>,
typename gsHBox<d,T>::aalloc> Container;
67 typedef typename std::vector<gsHBox<d,T>,
typename gsHBox<d,T>::aalloc> SortedContainer;
68 typedef typename std::vector<Container> HContainer;
69 typedef typename Container::iterator Iterator;
70 typedef typename Container::reverse_iterator rIterator;
71 typedef typename Container::const_iterator cIterator;
72 typedef typename HContainer::iterator HIterator;
73 typedef typename HContainer::reverse_iterator rHIterator;
74 typedef typename HContainer::const_iterator cHIterator;
77 typedef memory::shared_ptr< gsHBox >
Ptr;
80 typedef memory::unique_ptr< gsHBox >
uPtr;
375 Container getSiblings()
const;
421 template<gsHNeighborhood _mode>
472 std::ostream&
print( std::ostream& os )
const;
479 RefBox
toBox()
const;
486 RefBox toRefBox(
index_t targetLevel)
const;
487 RefBox toRefBox()
const
489 return this->toRefBox(this->
level()+1);
497 RefBox toCrsBox(
index_t targetLevel)
const;
498 RefBox toCrsBox()
const
500 return this->toCrsBox(this->
level()-1);
504 HContainer boxUnion(
const HContainer & container1,
const HContainer & container2)
const;
506 const gsHTensorBasis<d,T> & basis()
const {
return *m_basis; }
507 void setBasis(
const gsHTensorBasis<d,T> * basis) { m_basis = basis; }
528 void clean(Container & container)
const;
541 void _computeIndices();
542 gsAABB<d, index_t> _computeIndices(
const gsMatrix<T> & coords,
index_t level);
543 gsAABB<d, index_t> _computeIndices(
const gsMatrix<T> & coords,
const gsMatrix<T> & center);
544 gsAABB<d, index_t> _computeIndices(
const gsMatrix<T> & coords);
546 gsAABB<d, index_t> _elevateBox(
const gsAABB<d, index_t> & box)
const;
547 gsAABB<d, index_t> _lowerBox(
const gsAABB<d, index_t> & box)
const;
549 Container _getParents(
typename gsHBox<d,T>::Container & container)
const;
550 HContainer _getParents(
typename gsHBox<d,T>::HContainer & container)
const;
553 Container _boxUnion(
const Container & container1,
const Container & container2)
const;
554 Container _makeUnique(
const Container & container)
const;
556 template<gsHNeighborhood _mode>
557 typename std::enable_if<_mode==gsHNeighborhood::Automatic, typename gsHBox<d,T>::Container>::type
558 getNeighborhood_impl(
index_t m)
560 if (
dynamic_cast<const gsTHBSplineBasis<d,T>*
>(this->basis()))
562 else if (
dynamic_cast<const gsHBSplineBasis<d,T>*
>(this->basis()))
566 template<gsHNeighborhood _mode>
567 typename std::enable_if<_mode==gsHNeighborhood::T, typename gsHBox<d,T>::Container>::type
568 getNeighborhood_impl(
index_t m)
573 template<gsHNeighborhood _mode>
574 typename std::enable_if<_mode==gsHNeighborhood::H, typename gsHBox<d,T>::Container>::type
575 getNeighborhood_impl(
index_t m)
582 gsAABB<d, index_t> m_indices;
585 mutable gsMatrix<T> m_coords;
586 mutable gsMatrix<T> m_center;
587 const gsHTensorBasis<d,T> * m_basis;
598 template<
int d,
class T>
599 std::ostream& operator<<( std::ostream& os, const gsHBox<d,T>& b )
601 return b.print( os );
607 #ifndef GISMO_BUILD_LIB
608 #include GISMO_HPP_HEADER(gsHBox.hpp)
611 #include GISMO_HPP_HEADER(gsHBox.hpp)
612 #undef EXTERN_CLASS_TEMPLATE
613 #define EXTERN_CLASS_TEMPLATE CLASS_TEMPLATE_INST
617 EXTERN_CLASS_TEMPLATE gsHBox<1,real_t>;
618 EXTERN_CLASS_TEMPLATE gsHBox<2,real_t>;
619 EXTERN_CLASS_TEMPLATE gsHBox<3,real_t>;
620 EXTERN_CLASS_TEMPLATE gsHBox<4,real_t>;
622 EXTERN_CLASS_TEMPLATE internal::gsXml< gsHBox<1,real_t> >;
623 EXTERN_CLASS_TEMPLATE internal::gsXml< gsHBox<2,real_t> >;
624 EXTERN_CLASS_TEMPLATE internal::gsXml< gsHBox<3,real_t> >;
625 EXTERN_CLASS_TEMPLATE internal::gsXml< gsHBox<4,real_t> >;
Re-implements gsDomainIterator for iteration over all boundary elements of a hierarchical parameter d...
Definition: gsHDomain.h:24
const point & upperIndex() const
Gets the upper index of the box.
Definition: gsHBox.hpp:281
Provides definition of HTensorBasis abstract interface.
bool isContained(const gsHBox< d, T > &other) const
Checks if the other cell is contained in this cell.
Definition: gsHBox.hpp:167
T projectedErrorRef() const
The error contribution of *this when it is refined.
Definition: gsHBox.hpp:307
Container getHneighborhood(index_t m)
Gets the H-neighborhood.
Definition: gsHBox.hpp:493
Provides declaration of iterator of hierarchical domain.
void clean(Container &container) const
Cleans the container from bad elements (see good())
Definition: gsHBox.hpp:948
gsVector< T, d > lowerCorner() const
Gets the lower corner of the box.
Definition: gsHBox.hpp:247
T projectedErrorCrs() const
The error contribution of *this when it is coarsened.
Definition: gsHBox.hpp:310
memory::unique_ptr< gsHBox > uPtr
Unique pointer for gsHTensorBasis.
Definition: gsHBox.h:80
Container getMultiLevelSupportExtension(index_t k)
Gets the multi-level support extension.
Definition: gsHBox.hpp:477
Provides utility functions for gsHBox and gsHBoxContainer.
void setIndex(index_t index)
Assigns an index to the object.
Definition: gsHBox.hpp:325
bool isActive() const
Determines if the box is active on its current level.
Definition: gsHBox.hpp:213
bool isSame(const gsHBox< d, T > &other) const
Determines whether the this box is the same as the other box.
Definition: gsHBox.hpp:199
Container getTneighborhood(index_t m)
Gets the T-neighborhood.
Definition: gsHBox.hpp:517
gsHBox< d, T > & operator=(const gsHBox< d, T > &other)
Assignment operator.
Definition: gsHBox.hpp:132
bool marked() const
Returns whether the element is marked or not.
Definition: gsHBox.hpp:337
void setAndProjectError(T error, index_t alpha=2, index_t beta=0)
Sets the error of the object and compute the projection of the error on a finer mesh. The projection is performed based on a theoretical rate of convergence of alpha*p+beta.
Definition: gsHBox.hpp:296
void setMark(bool mark)
Sets the mark.
Definition: gsHBox.hpp:340
This class provides a Hierarchical Box (gsHBox)
Definition: gsHBox.h:54
index_t levelInCenter() const
Gets the level in the center of the object.
Definition: gsHBox.hpp:225
RefBox toBox() const
Returns a box representation of the object.
Definition: gsHBox.hpp:776
T getMaxCellLength() const
Return the length of the largest edge of the element.
Definition: gsHBox.hpp:273
index_t level() const
Gets the level of the object.
Definition: gsHBox.hpp:287
const gsMatrix< T > & getCoordinates() const
Gets the coordinates of the box (first column lower corner, second column higher corner).
Definition: gsHBox.hpp:231
#define index_t
Definition: gsConfig.h:32
void computeCoordinates() const
Computes the parametric coordinates of this.
Definition: gsHBox.hpp:633
Container getDescendants(index_t k) const
Gets the descendants of the object on level k.
Definition: gsHBox.hpp:382
gsHBox()
Default constructor.
Definition: gsHBox.hpp:27
index_t patch() const
Gets the patch ID of the object.
Definition: gsHBox.hpp:284
Class representing a (scalar) hierarchical tensor basis of functions .
Definition: gsHTensorBasis.h:74
Container toUnitBoxes() const
Returns unit boxes representation of the object.
Definition: gsHBox.hpp:756
Container getChildren() const
Gets the children of the object.
Definition: gsHBox.hpp:374
T projectedSetBack() const
Gives the projected set-back that can be expected for this.
Definition: gsHBox.hpp:319
gsVector< T, d > upperCorner() const
Gets the upper corner of the box.
Definition: gsHBox.hpp:254
void setError(T error)
Sets the error of the object.
Definition: gsHBox.hpp:290
T projectedImprovement() const
Gives the projected improvement that can be expected for this.
Definition: gsHBox.hpp:313
T getMinCellLength() const
Return the length of the smallest edge of the element.
Definition: gsHBox.hpp:267
std::ostream & print(std::ostream &os) const
Prints the object.
Definition: gsHBox.hpp:612
gsHBox< d, T > getAncestor(index_t k) const
Gets the ancestor of the object on level k.
Definition: gsHBox.hpp:351
memory::shared_ptr< gsHBox > Ptr
Shared pointer for gsHTensorBasis.
Definition: gsHBox.h:77
index_t index() const
Gets the index stored in the object.
Definition: gsHBox.hpp:328
const gsMatrix< T > & getCenter() const
Gets the center of the box.
Definition: gsHBox.hpp:238
void computeCenter() const
Computes the center of this.
Definition: gsHBox.hpp:649
Container toContainer()
Returns a container representation of the object.
Definition: gsHBox.hpp:427
bool good() const
Checks if the box has positive indices.
Definition: gsHBox.hpp:942
Container getCextension(index_t m)
Gets the Coarsening extension, which is the coarsening neighborhood before checking for active elemen...
Definition: gsHBox.hpp:557
Container getSupportExtension()
Gets the support extension.
Definition: gsHBox.hpp:444
gsHBox< d, T > getParent() const
Gets the parent of the object.
Definition: gsHBox.hpp:343
HContainer toHContainer()
Returns a hierarchical container representation of the object.
Definition: gsHBox.hpp:435
gsHBox< d, T >::Container getNeighborhood(index_t m)
Gets the neighborhood.
Definition: gsHBox.h:422
This is the main header file that collects wrappers of Eigen for linear algebra.
T getCellSize() const
Return the diagonal of the element.
Definition: gsHBox.hpp:261
const point & lowerIndex() const
Gets the lower index of the box.
Definition: gsHBox.hpp:279
Provides declaration of input/output XML utilities struct.
void mark()
Marks this element for refinement.
Definition: gsHBox.hpp:331
void unmark()
Unmarks this element for refinement.
Definition: gsHBox.hpp:334
bool isActiveOrContained() const
Determines if active or contained in the active elemebt. In other words; checks if the level of this ...
Definition: gsHBox.hpp:219
Container getCneighborhood(index_t m)
Gets the Coarsening neighborhood.
Definition: gsHBox.hpp:591
bool contains(const gsHBox< d, T > &other) const
Checks if the other cell is contains in this cell.
Definition: gsHBox.hpp:184
T error() const
Gets the error stored in the object.
Definition: gsHBox.hpp:304