G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsDomainIterator< T > Class Template Referenceabstract

Detailed Description

template<class T>
class gismo::gsDomainIterator< T >

Class which enables iteration over all elements of a parameter domain.

The gsDomainIterator
It also includes some additional functionality which is typically used when assembling the system matrix for numerically solving a PDE.

  • Iteration through the elements:
    The function next() jumps to the "next" element and sets up the quadrature nodes and weights on that element. The specific implementation of how to select the next element depends on the structure of the underlying mesh.
    The function good() indicates whether there still is a "next" element to be found.

Note that the features of the gsDomainIterator strongly depend on the underlying basis. Hence the gsBasis is given as an input argument to the constructor.

An example of the typical use of gsDomainIterator (remark: replace the constructor by the constructor of the actually used derived class):

  gsDomainIterator domIter( basis );         // constructor

  for (; domIter.good(); domIter.next() )    // loop over all elements
  {
      // Your source code using
      domIter.centerPoint();
      domIter.lowerCorner();
      domIter.upperCorner();

  }
+ Inheritance diagram for gsDomainIterator< T >:
+ Collaboration diagram for gsDomainIterator< T >:

Public Types

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

Public Member Functions

virtual void adjacent (const gsVector< bool > &, gsDomainIterator &)
 
const gsVector< T > & centerPoint () const
 Returns the center of the current element. More...
 
short_t dim () const
 Return dimension of the elements.
 
getCellSize () const
 Return the diagonal of the element.
 
getMaxCellLength () const
 Return the length of the largest edge of the element.
 
getMinCellLength () const
 Return the length of the smallest edge of the element.
 
virtual const T getPerpendicularCellSize () const
 Returns the perpendicular cell size of boundary iterator. More...
 
bool good () const
 Is the iterator still pointing to a valid element?
 
 gsDomainIterator (const gsBasis< T > &basisParam, const boxSide &s=boundary::none)
 Constructor using a basis.
 
size_t id () const
 Returns the element id.
 
virtual const gsVector< T > & lowerCorner () const
 Returns the lower corner of the current element. More...
 
virtual bool next ()=0
 Proceeds to the next element. More...
 
virtual bool next (index_t increment)=0
 Proceeds to the next element (skipping increment elements).
 
virtual size_t numElements () const
 Returns the number of elements.
 
virtual void reset ()
 Resets the iterator so that it points to the first element.
 
virtual const gsVector< T > & upperCorner () const
 Returns the upper corner of the current element. More...
 
volume () const
 Return the volume of the element.
 

Public Attributes

gsVector< T > center
 Coordinates of a central point in the element (in the parameter domain).
 

Protected Attributes

const gsBasis< T > * m_basis
 The basis on which the domain iterator is defined.
 
bool m_isGood
 

Member Function Documentation

virtual void adjacent ( const gsVector< bool > &  ,
gsDomainIterator< T > &   
)
inlinevirtual

Updates other with and adjacent element

Todo:
upgrade to return adjacent range instead
const gsVector<T>& centerPoint ( ) const
inline

Returns the center of the current element.

The current element is a d-dimensional hypercube. The coordinates of its upper corner is returned as a gsVector of length d.

E.g., if the current two-dimensional element is defined by [a,b]x[c,d], then [b,d] is returned (see also lowerCorner()).

virtual const T getPerpendicularCellSize ( ) const
inlinevirtual

Returns the perpendicular cell size of boundary iterator.

Only works for boundary iterators. Returns the length from the boundary side to the parallel side not on the boundary.

Reimplemented in gsTensorDomainBoundaryIterator< T, D, uiter >.

virtual const gsVector<T>& lowerCorner ( ) const
inlinevirtual

Returns the lower corner of the current element.

The current element is a d-dimensional hypercube. The coordinates of its lower corner is returned as a gsVector of length d.

E.g., if the current two-dimensional element is defined by [a,b]x[c,d], then [a,c] is returned (see also upperCorner()).

Reimplemented in gsTensorDomainIterator< T, D >, gsTensorDomainBoundaryIterator< T, D, uiter >, gsHDomainIterator< T, d >, and gsHDomainBoundaryIterator< T, d >.

virtual bool next ( )
pure virtual

Proceeds to the next element.

The function returns true if there are still elements remaining that have not been treated.
For the typical usage of this function, see the example in the documentation of gsDomainIterator.

Implemented in gsTensorDomainBoundaryIterator< T, D, uiter >, gsTensorDomainIterator< T, D >, gsHDomainBoundaryIterator< T, d >, and gsHDomainIterator< T, d >.

virtual const gsVector<T>& upperCorner ( ) const
inlinevirtual

Returns the upper corner of the current element.

The current element is a d-dimensional hypercube. The coordinates of its upper corner is returned as a gsVector of length d.

E.g., if the current two-dimensional element is defined by [a,b]x[c,d], then [b,d] is returned (see also lowerCorner()).

Reimplemented in gsTensorDomainIterator< T, D >, gsTensorDomainBoundaryIterator< T, D, uiter >, gsHDomainIterator< T, d >, and gsHDomainBoundaryIterator< T, d >.

Member Data Documentation

bool m_isGood
protected

Flag indicating whether the domain iterator is "good". If it is "good", the iterator can continue to the next element.