G+Smo  23.12.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsHBox< d, T > Class Template Reference

Detailed Description

template<int d, class T>
class gismo::gsHBox< d, T >

This class provides a Hierarchical Box (gsHBox)

A gsHBox is a 'smart' object that represents an element or multiple elements in a mesh. It closely relates to the element definition used in gsHTensorBasis::asElements. Using the gsHBox as an element, it can provide its parent and its children on other levels, its support extensions and its refinement neighborhoods. Furthermore, the gsHBox has functions to check if it is equal to or contained in other gsHBoxes.

The gsHBoxContainer is a container of gsHBoxes, that can be used to perform operations on multiple gsHBoxes. Furthermore, it is an object that can be used to store neighborhoods. Other containers are the gsHBox::Container or the gsHBoxSortedContainer.

Operations such as domain intersections, unions, or the sorting of gsHBoxContainers are provided in gsHBoxUtils.

Template Parameters
dDomain dimension
TReal type
+ Collaboration diagram for gsHBox< d, T >:

Public Types

typedef memory::shared_ptr
< gsHBox
Ptr
 Shared pointer for gsHTensorBasis.
 
typedef memory::unique_ptr
< gsHBox
uPtr
 Unique pointer for gsHTensorBasis.
 

Public Member Functions

void clean (Container &container) const
 Cleans the container from bad elements (see good()) More...
 
void computeCenter () const
 Computes the center of this.
 
void computeCoordinates () const
 Computes the parametric coordinates of this.
 
bool contains (const gsHBox< d, T > &other) const
 Checks if the other cell is contains in this cell. More...
 
error () const
 Gets the error stored in the object. More...
 
gsHBox< d, T > getAncestor (index_t k) const
 Gets the ancestor of the object on level k. More...
 
getCellSize () const
 Return the diagonal of the element.
 
const gsMatrix< T > & getCenter () const
 Gets the center of the box. More...
 
Container getCextension (index_t m)
 Gets the Coarsening extension, which is the coarsening neighborhood before checking for active elements. More...
 
Container getChildren () const
 Gets the children of the object. More...
 
Container getCneighborhood (index_t m)
 Gets the Coarsening neighborhood. More...
 
const gsMatrix< T > & getCoordinates () const
 Gets the coordinates of the box (first column lower corner, second column higher corner). More...
 
Container getDescendants (index_t k) const
 Gets the descendants of the object on level k. More...
 
Container getHneighborhood (index_t m)
 Gets the H-neighborhood. More...
 
getMaxCellLength () const
 Return the length of the largest edge of the element.
 
getMinCellLength () const
 Return the length of the smallest edge of the element.
 
Container getMultiLevelSupportExtension (index_t k)
 Gets the multi-level support extension. More...
 
template<gsHNeighborhood _mode>
gsHBox< d, T >::Container getNeighborhood (index_t m)
 Gets the neighborhood. More...
 
Container getNeighborhood (index_t m)
 Gets the refinement neighborhood. Returns either the H- or T-neighborhood, depending on the underlying basis. More...
 
gsHBox< d, T > getParent () const
 Gets the parent of the object. More...
 
Container getSupportExtension ()
 Gets the support extension. More...
 
Container getTneighborhood (index_t m)
 Gets the T-neighborhood. More...
 
bool good () const
 Checks if the box has positive indices. More...
 
 gsHBox ()
 Default constructor.
 
 gsHBox (const gsHDomainIterator< T, d > *domHIt)
 Constructs a gsHBox from a domain iterator. More...
 
 gsHBox (const gsHDomainIterator< T, d > *domHIt, const index_t pid)
 Constructs a gsHBox from a domain iterator. More...
 
 gsHBox (const typename gsHBox< d, T >::point &low, const typename gsHBox< d, T >::point &upp, index_t level, const gsHTensorBasis< d, T > *basis, const index_t pid=-1)
 Constructs a gsHBox from an element. More...
 
 gsHBox (const gsAABB< d, index_t > &box, const gsHTensorBasis< d, T > *basis, const index_t pid=-1)
 Constructs a gsHBox from an element. More...
 
 gsHBox (const std::vector< index_t > &indices, const gsHTensorBasis< d, T > *basis, const index_t pid=-1)
 Constructs a gsHBox from an element. More...
 
 gsHBox (const gsHBox< d, T > &other)
 Copy constructor (makes deep copy)
 
 gsHBox (gsHBox< d, T > &&other)
 Move constructor.
 
index_t index () const
 Gets the index stored in the object. More...
 
bool isActive () const
 Determines if the box is active on its current level. More...
 
bool isActiveOrContained () const
 Determines if active or contained in the active elemebt. In other words; checks if the level of this box is higher or equal to the level of the mesh here. More...
 
bool isContained (const gsHBox< d, T > &other) const
 Checks if the other cell is contained in this cell. More...
 
bool isSame (const gsHBox< d, T > &other) const
 Determines whether the this box is the same as the other box. More...
 
index_t level () const
 Gets the level of the object. More...
 
index_t levelInCenter () const
 Gets the level in the center of the object. More...
 
gsVector< T, d > lowerCorner () const
 Gets the lower corner of the box. More...
 
const pointlowerIndex () const
 Gets the lower index of the box. More...
 
void mark ()
 Marks this element for refinement.
 
bool marked () const
 Returns whether the element is marked or not. More...
 
gsHBox< d, T > & operator= (const gsHBox< d, T > &other)
 Assignment operator.
 
gsHBox< d, T > & operator= (gsHBox< d, T > &&other)
 Move assignment operator.
 
index_t patch () const
 Gets the patch ID of the object. More...
 
std::ostream & print (std::ostream &os) const
 Prints the object.
 
projectedErrorCrs () const
 The error contribution of *this when it is coarsened. More...
 
projectedErrorRef () const
 The error contribution of *this when it is refined. More...
 
projectedImprovement () const
 Gives the projected improvement that can be expected for this. More...
 
projectedSetBack () const
 Gives the projected set-back that can be expected for this. More...
 
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.
 
void setError (T error)
 Sets the error of the object.
 
void setIndex (index_t index)
 Assigns an index to the object.
 
void setMark (bool mark)
 Sets the mark. More...
 
RefBox toBox () const
 Returns a box representation of the object. More...
 
Container toContainer ()
 Returns a container representation of the object. More...
 
RefBox toCrsBox (index_t targetLevel) const
 Returns a box representation of the object on the higher level (needed for coarsening). More...
 
HContainer toHContainer ()
 Returns a hierarchical container representation of the object. More...
 
RefBox toRefBox (index_t targetLevel) const
 Returns a box representation of the object on the lower level (needed for refinement). More...
 
Container toUnitBoxes () const
 Returns unit boxes representation of the object. More...
 
void unmark ()
 Unmarks this element for refinement.
 
gsVector< T, d > upperCorner () const
 Gets the upper corner of the box. More...
 
const pointupperIndex () const
 Gets the upper index of the box. More...
 

Constructor & Destructor Documentation

gsHBox ( const gsHDomainIterator< T, d > *  domHIt)

Constructs a gsHBox from a domain iterator.

Parameters
[in]domHItA hierarchical domain iterator
gsHBox ( const gsHDomainIterator< T, d > *  domHIt,
const index_t  pid 
)

Constructs a gsHBox from a domain iterator.

Parameters
[in]domHItA hierarchical domain iterator
[in]pidThe patch ID
gsHBox ( const typename gsHBox< d, T >::point low,
const typename gsHBox< d, T >::point upp,
index_t  level,
const gsHTensorBasis< d, T > *  basis,
const index_t  pid = -1 
)

Constructs a gsHBox from an element.

Parameters
[in]lowThe lower corner of the element, see gsHTensorBasis
[in]uppThe upper corner of the element, see gsHTensorBasis
[in]levelThe level of the element
[in]basisThe basis on which the element is defined
[in]pidThe patch ID
gsHBox ( const gsAABB< d, index_t > &  box,
const gsHTensorBasis< d, T > *  basis,
const index_t  pid = -1 
)

Constructs a gsHBox from an element.

Parameters
[in]boxThe box as AABB box
[in]basisThe basis on which the element is defined
[in]pidThe patch ID
gsHBox ( const std::vector< index_t > &  indices,
const gsHTensorBasis< d, T > *  basis,
const index_t  pid = -1 
)

Constructs a gsHBox from an element.

Parameters
[in]indicesElement definition (+ level) as in gsHTensorBasis. This object is 2*d+1 long
[in]basisThe basis on which the element is defined
[in]pidThe patch ID

Member Function Documentation

void clean ( Container &  container) const

Cleans the container from bad elements (see good())

Parameters
containerThe container
bool contains ( const gsHBox< d, T > &  other) const

Checks if the other cell is contains in this cell.

Parameters
otherThe other cell
Returns
True if the specified other is contains in the cell, False otherwise.
T error ( ) const

Gets the error stored in the object.

Returns
The error of the object
gsHBox< d, T > getAncestor ( index_t  k) const

Gets the ancestor of the object on level k.

Parameters
[in]kThe reference level
Returns
The ancestor.
const gsMatrix< T > & getCenter ( ) const

Gets the center of the box.

Returns
The center of the box.
gsHBox< d, T >::Container getCextension ( index_t  m)

Gets the Coarsening extension, which is the coarsening neighborhood before checking for active elements.

Parameters
[in]mThe jump parameter
Returns
The coarsening extension.
gsHBox< d, T >::Container getChildren ( ) const

Gets the children of the object.

Returns
The children of the object.
gsHBox< d, T >::Container getCneighborhood ( index_t  m)

Gets the Coarsening neighborhood.

Parameters
[in]mThe jump parameter
Returns
The coarsening neighborhood.
const gsMatrix< T > & getCoordinates ( ) const

Gets the coordinates of the box (first column lower corner, second column higher corner).

Returns
The coordinates of the box.
gsHBox< d, T >::Container getDescendants ( index_t  k) const

Gets the descendants of the object on level k.

Parameters
[in]kThe reference level
Returns
The children of the object.
gsHBox< d, T >::Container getHneighborhood ( index_t  m)

Gets the H-neighborhood.

Parameters
[in]mThe jump parameter
Returns
The H-neighborhood.
gsHBox< d, T >::Container getMultiLevelSupportExtension ( index_t  k)

Gets the multi-level support extension.

Parameters
[in]kThe reference level
Returns
The multi-level support extension.
gsHBox<d,T>::Container getNeighborhood ( index_t  m)
inline

Gets the neighborhood.

Parameters
[in]mThe jump parameter
Template Parameters
_modeH or T refinement (else not implemented)
Returns
The neighborhood.
gsHBox< d, T >::Container getNeighborhood ( index_t  m)

Gets the refinement neighborhood. Returns either the H- or T-neighborhood, depending on the underlying basis.

Parameters
[in]mThe jump parameter
Returns
The T-neighborhood.
gsHBox< d, T > getParent ( ) const

Gets the parent of the object.

Returns
The parent of the object.
gsHBox< d, T >::Container getSupportExtension ( )

Gets the support extension.

Returns
The support extension.
gsHBox< d, T >::Container getTneighborhood ( index_t  m)

Gets the T-neighborhood.

Parameters
[in]mThe jump parameter
Returns
The T-neighborhood.
bool good ( ) const

Checks if the box has positive indices.

Returns
True if the box has positive indices, false otherwise
index_t index ( ) const

Gets the index stored in the object.

Returns
The index of the object
bool isActive ( ) const

Determines if the box is active on its current level.

Returns
True if active, False otherwise.
bool isActiveOrContained ( ) const

Determines if active or contained in the active elemebt. In other words; checks if the level of this box is higher or equal to the level of the mesh here.

Returns
True if active or contained, False otherwise.
bool isContained ( const gsHBox< d, T > &  other) const

Checks if the other cell is contained in this cell.

Parameters
otherThe other cell
Returns
True if the specified other is contained in the cell, False otherwise.
bool isSame ( const gsHBox< d, T > &  other) const

Determines whether the this box is the same as the other box.

Parameters
[in]otherThe other box
Returns
True if the boxes are the same, False otherwise.
index_t level ( ) const

Gets the level of the object.

Returns
The level of the object
index_t levelInCenter ( ) const

Gets the level in the center of the object.

Returns
The level in the center of the object
gsVector< T, d > lowerCorner ( ) const

Gets the lower corner of the box.

Returns
The lower corner
const gsHBox< d, T >::point & lowerIndex ( ) const

Gets the lower index of the box.

Returns
The lower index
bool marked ( ) const

Returns whether the element is marked or not.

Returns
this is marked
index_t patch ( ) const

Gets the patch ID of the object.

Returns
The patch ID of the object
T projectedErrorCrs ( ) const

The error contribution of *this when it is coarsened.

        Note: this means that
Returns
The error of the object
T projectedErrorRef ( ) const

The error contribution of *this when it is refined.

Returns
The error of the object
T projectedImprovement ( ) const

Gives the projected improvement that can be expected for this.

Returns
The projected improvement
T projectedSetBack ( ) const

Gives the projected set-back that can be expected for this.

Returns
The projected improvement
void setMark ( bool  mark)

Sets the mark.

Parameters
[in]markThe mark
gsHBox< d, T >::RefBox toBox ( ) const

Returns a box representation of the object.

Returns
Box representation of the object.
gsHBox< d, T >::Container toContainer ( )

Returns a container representation of the object.

Returns
Container representation of the object.
gsHBox< d, T >::RefBox toCrsBox ( index_t  targetLevel) const

Returns a box representation of the object on the higher level (needed for coarsening).

Returns
Coarsening box representation of the object.
gsHBox< d, T >::HContainer toHContainer ( )

Returns a hierarchical container representation of the object.

Returns
Hierarchical container representation of the object.
gsHBox< d, T >::RefBox toRefBox ( index_t  targetLevel) const

Returns a box representation of the object on the lower level (needed for refinement).

Returns
Refinement box representation of the object.
gsHBox< d, T >::Container toUnitBoxes ( ) const

Returns unit boxes representation of the object.

Returns
Unit boxes representation of the object.
gsVector< T, d > upperCorner ( ) const

Gets the upper corner of the box.

Returns
The upper corner
const gsHBox< d, T >::point & upperIndex ( ) const

Gets the upper index of the box.

Returns
The upper index