WaveBlocksND
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex > Class Template Reference

The \( s \)-th slice of a shape enumeration contains all multi-indices \( \boldsymbol{k} \in \mathfrak{K} \) that satisfy \( \displaystyle\sum_{d=1}^{D} k_d = s \). More...

#include <shape_enum.hpp>

Public Types

typedef std::vector< MultiIndex >::const_iterator const_iterator
 

Public Member Functions

 ShapeSlice ()=default
 
 ShapeSlice (const ShapeSlice &that)=default
 
 ShapeSlice (ShapeSlice &&that)
 
ShapeSliceoperator= (const ShapeSlice &that)=default
 
ShapeSliceoperator= (ShapeSlice &&that)
 
 ShapeSlice (std::size_t offset)
 
 ShapeSlice (std::vector< MultiIndex > &&table, std::size_t offset)
 
std::vector< MultiIndex > & _table ()
 
std::vector< MultiIndex > const & _table () const
 
std::size_t offset () const
 Retrieves the number of nodes in all previous slices. More...
 
std::size_t size () const
 
const_iterator begin () const
 Returns a const-iterator pointing to the first node. More...
 
const_iterator end () const
 Returns a const-iterator referring to the past-the-end node. More...
 
const_iterator cbegin () const
 Returns a const-iterator pointing to the first node. More...
 
const_iterator cend () const
 Returns a const-iterator referring to the past-the-end node. More...
 
MultiIndex operator[] (std::size_t ordinal) const
 Returns the multi-index of the node at position ordinal. More...
 
bool try_find (const MultiIndex &index, std::size_t &ordinal) const
 Retrieves the position of the node \( k \), if \( k \) is part of this slice. More...
 
std::size_t find (const MultiIndex &index) const
 Returns the position of a node. More...
 
std::array< std::size_t, D > find_backward_neighbours (const MultiIndex &_index) const
 Retrieves the ordinals of all backward neighbours \( \{k-e^1, \ldots, k-e^D\} \) of a lattice node \(k \). More...
 
bool operator== (const ShapeSlice &that) const
 Checks whether both sides are equals by comparison of every node. More...
 
bool operator!= (const ShapeSlice &that) const
 

Private Member Functions

MultiIndex forward_ (MultiIndex index, dim_t axis) const
 
MultiIndex backward_ (MultiIndex index, dim_t axis) const
 

Private Attributes

std::size_t offset_
 
std::vector< MultiIndex > table_
 

Detailed Description

template<dim_t D, class MultiIndex>
class waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >

The \( s \)-th slice of a shape enumeration contains all multi-indices \( \boldsymbol{k} \in \mathfrak{K} \) that satisfy \( \displaystyle\sum_{d=1}^{D} k_d = s \).

Member Typedef Documentation

template<dim_t D, class MultiIndex>
typedef std::vector<MultiIndex>::const_iterator waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::const_iterator

Constructor & Destructor Documentation

template<dim_t D, class MultiIndex>
waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::ShapeSlice ( )
default
template<dim_t D, class MultiIndex>
waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::ShapeSlice ( const ShapeSlice< D, MultiIndex > &  that)
default
template<dim_t D, class MultiIndex>
waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::ShapeSlice ( ShapeSlice< D, MultiIndex > &&  that)
inline
template<dim_t D, class MultiIndex>
waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::ShapeSlice ( std::size_t  offset)
inline
template<dim_t D, class MultiIndex>
waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::ShapeSlice ( std::vector< MultiIndex > &&  table,
std::size_t  offset 
)
inline

Member Function Documentation

template<dim_t D, class MultiIndex>
std::vector< MultiIndex >& waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::_table ( )
inline
template<dim_t D, class MultiIndex>
std::vector< MultiIndex > const& waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::_table ( ) const
inline
template<dim_t D, class MultiIndex>
MultiIndex waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::backward_ ( MultiIndex  index,
dim_t  axis 
) const
inlineprivate
template<dim_t D, class MultiIndex>
const_iterator waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::begin ( ) const
inline

Returns a const-iterator pointing to the first node.

template<dim_t D, class MultiIndex>
const_iterator waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::cbegin ( ) const
inline

Returns a const-iterator pointing to the first node.

template<dim_t D, class MultiIndex>
const_iterator waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::cend ( ) const
inline

Returns a const-iterator referring to the past-the-end node.

template<dim_t D, class MultiIndex>
const_iterator waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::end ( ) const
inline

Returns a const-iterator referring to the past-the-end node.

template<dim_t D, class MultiIndex>
std::size_t waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::find ( const MultiIndex &  index) const
inline

Returns the position of a node.

Notice that the first node in the slice has position 0 (not 1 or offset()).

Portable programs should never call this function with an node that is not part of this slice, since this causes undefined behaviour.

Caution: You have to add the slice-offset to the position to get the ordinal of the node.

Complexity: Logarithmic in the number of slice-nodes.

Parameters
[in]indexThe
Returns
The position of the specified node.
template<dim_t D, class MultiIndex>
std::array<std::size_t,D> waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::find_backward_neighbours ( const MultiIndex &  _index) const
inline

Retrieves the ordinals of all backward neighbours \( \{k-e^1, \ldots, k-e^D\} \) of a lattice node \(k \).

Notice that the first node in the slice has ordinal 0 (not 1 or offset()).

Important: This function only works if \( k \in \mathfrak{K} \), otherwise behaviour is undefined!

Don't forget that you have to consult the correct slice. If \( k \) is part of the \( s \)-th slice. you have to call the member function of the \( (s-1) \)-th slice.

Parameters
_indexThe multi-index \( k \).
Returns
Array of all ordinals \( \{i^1, \ldots i^D\} \) where \( i^d \) corresponds to \( k - e^d \).
template<dim_t D, class MultiIndex>
MultiIndex waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::forward_ ( MultiIndex  index,
dim_t  axis 
) const
inlineprivate
template<dim_t D, class MultiIndex>
std::size_t waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::offset ( ) const
inline

Retrieves the number of nodes in all previous slices.

Aside, the offset is the ordinal of the first node in this slice.

template<dim_t D, class MultiIndex>
bool waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::operator!= ( const ShapeSlice< D, MultiIndex > &  that) const
inline
template<dim_t D, class MultiIndex>
ShapeSlice& waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::operator= ( const ShapeSlice< D, MultiIndex > &  that)
default
template<dim_t D, class MultiIndex>
ShapeSlice& waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::operator= ( ShapeSlice< D, MultiIndex > &&  that)
inline
template<dim_t D, class MultiIndex>
bool waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::operator== ( const ShapeSlice< D, MultiIndex > &  that) const
inline

Checks whether both sides are equals by comparison of every node.

template<dim_t D, class MultiIndex>
MultiIndex waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::operator[] ( std::size_t  ordinal) const
inline

Returns the multi-index of the node at position ordinal.

Notice that the first node in the slice has position 0 (not 1 or offset()).

Portable programs should never call this function with an argument that is out-of-range, since this causes undefined behaviour.

Complexity: logarithmic in the number of slice-nodes

Parameters
[in]ordinalposition of a node in this slice
Returns
multi-index of the specified node
template<dim_t D, class MultiIndex>
std::size_t waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::size ( ) const
inline
Returns
Retrieves the number of nodes in this slice.
template<dim_t D, class MultiIndex>
bool waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::try_find ( const MultiIndex &  index,
std::size_t &  ordinal 
) const
inline

Retrieves the position of the node \( k \), if \( k \) is part of this slice.

The first node in the slice has position 0 (not 1 or offset()).

Caution: You have to add the slice-offset to the position to get the ordinal of the node.

Complexity: Logarithmic in the number of slice-nodes.

Parameters
[in]indexThe node \( k \).
[out]ordinalReference to
Returns
Whether node \( k \) is part of this slice.

Member Data Documentation

template<dim_t D, class MultiIndex>
std::size_t waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::offset_
private
template<dim_t D, class MultiIndex>
std::vector< MultiIndex > waveblocks::wavepackets::shapes::ShapeSlice< D, MultiIndex >::table_
private

The documentation for this class was generated from the following file: