Alexandria  2.27.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType > Class Template Reference

Class to iterate through the GridContainer cells. More...

#include <GridContainer.h>

Inheritance diagram for Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >:
Inheritance graph
[legend]
Collaboration diagram for Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >:
Collaboration graph
[legend]

Public Member Functions

 iter (const GridContainer< GridCellManager, AxesTypes...> &owner, const cell_manager_iter_type &data_iter)
 Constructs a new iterator for the given grid. More...
 
 iter (const iter &)=default
 Copy constructor. More...
 
 iter (iter &&)=default
 Move constructor. More...
 
iteroperator= (const iter &other)
 Copy operator of the iterator. More...
 
iteroperator++ ()
 Moves the iterator to the next grid cell. More...
 
ReferenceType operator* ()
 Returns a reference to the cell value. More...
 
std::add_const< ReferenceType >
::type 
operator* () const
 Returns a reference to the cell value (const version) More...
 
PointerType operator-> ()
 Returns a pointer to the cell value. More...
 
std::add_const< PointerType >::type operator-> () const
 Returns a pointer to the cell value (const version) More...
 
bool operator== (const iter &other) const
 
bool operator!= (const iter &other) const
 
template<int I>
size_t axisIndex () const
 
template<int I>
const axis_type< I > & axisValue () const
 
template<int I>
iterfixAxisByIndex (size_t index)
 
template<int I>
iterfixAxisByValue (const axis_type< I > &value)
 
template<typename OtherIter >
iterfixAllAxes (const OtherIter &other)
 
template<int I>
auto axisValue () const -> const axis_type< I > &
 
template<int I>
auto fixAxisByIndex (size_t index) -> iter &
 
template<int I>
auto fixAxisByValue (const axis_type< I > &value) -> iter &
 
template<typename OtherIter >
auto fixAllAxes (const OtherIter &other) -> iter &
 

Private Member Functions

void forwardToIndex (size_t axis, size_t fixed_index)
 

Private Attributes

const GridContainer
< GridCellManager,
AxesTypes...> & 
m_owner
 
cell_manager_iter_type m_data_iter
 
std::map< size_t, size_t > m_fixed_indices
 

Detailed Description

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType, typename PointerType, typename ReferenceType>
class Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >

Class to iterate through the GridContainer cells.

The GridContainer iterator provides efficient iteration through the cells of a GridContainer. If the axis information is not accessed, the iteration is almost as efficient as directly iterating through the GridCellManager. At any moment, the methods axisIndex() and axisValue() can be used to access the axes information. Slicing can be achieved by using the fixAxisByIndex() and fixAxisByValue() methods.

Definition at line 133 of file GridContainer.h.

Constructor & Destructor Documentation

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::iter ( const GridContainer< GridCellManager, AxesTypes...> &  owner,
const cell_manager_iter_type data_iter 
)

Constructs a new iterator for the given grid.

The cell on which the iterator points is controlled by the data_iter parameter, which is an iterator to the GridCellManager of the grid.

Parameters
ownerThe grid to iterate through
data_iterThe GridCellManager iterator indicating the cell position

Definition at line 34 of file GridIterator.icpp.

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::iter ( const iter< CellType, PointerType, ReferenceType > &  )
default

Copy constructor.

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::iter ( iter< CellType, PointerType, ReferenceType > &&  )
default

Move constructor.

Member Function Documentation

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
size_t Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::axisIndex ( ) const

Returns the index (coordinate) of the axis with index I, for the cell the iterator points

Definition at line 112 of file GridIterator.icpp.

References Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::begin().

Here is the call graph for this function:

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::axisValue ( ) const -> const axis_type<I>&

Definition at line 120 of file GridIterator.icpp.

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
const axis_type<I>& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::axisValue ( ) const

Returns the value of the axis with index I, for the cell the iterator points

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<typename OtherIter >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::fixAllAxes ( const OtherIter &  other) -> iter&

Definition at line 186 of file GridIterator.icpp.

References Euclid::GridContainer::fixSameAxes().

Here is the call graph for this function:

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<typename OtherIter >
iter& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::fixAllAxes ( const OtherIter &  other)

Fixes all the axes of this iterator to the values of the axes of the given iterator. The given iterator is assumed to be an iterator of a grid with the same number of axes, with the same names. It is the responsibility of the caller to guarantee that.

Template Parameters
OtherIterThe type of the other iterator
Parameters
otherThe iterator to get the axes values from
Returns
the iterator with all its axes fixed
template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::fixAxisByIndex ( size_t  index) -> iter&
template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
iter& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::fixAxisByIndex ( size_t  index)

Modifies the iterator to navigate only through cells with the given axis index. If the current cell does not fulfil this requirement the iterator will be forward to the first that does.

Template Parameters
Ithe index of the axis to fix
Parameters
indexthe index to fix the axis to
Returns
the iterator over the grid slice
Exceptions
Elements::Exceptionif the given index is out of the bounds of the axis
Elements::Exceptionif the axis has already been fixed for this iterator
template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::fixAxisByValue ( const axis_type< I > &  value) -> iter&

Definition at line 147 of file GridIterator.icpp.

References std::find().

Here is the call graph for this function:

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
template<int I>
iter& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::fixAxisByValue ( const axis_type< I > &  value)

Modifies the iterator to navigate only through cells with the given axis value. If the current cell does not fulfill this requirement the iterator will be forward to the first that does.

Note that this method will search in the values of the axis, so it implies an overhead when compared with the fixAxisByIndex() method. For this reason the use of fixAxisByIndex() should be favored.

Template Parameters
Ithe index of the axis to fix
Parameters
valuethe value to fix the axis to
Returns
the iterator over the grid slice
Exceptions
Elements::Exceptionif the axis does not contain the given value
Elements::Exceptionif the axis has already been fixed for this iterator
template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
void Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::forwardToIndex ( size_t  axis,
size_t  fixed_index 
)
private

Definition at line 161 of file GridIterator.icpp.

References Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::begin().

Here is the call graph for this function:

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
bool Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator!= ( const iter< CellType, PointerType, ReferenceType > &  other) const

Compares two iterators for inequality. Should be used only for iterators of the same grid.

Definition at line 104 of file GridIterator.icpp.

References Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::m_data_iter.

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator* ( )

Returns a reference to the cell value.

Definition at line 69 of file GridIterator.icpp.

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator* ( ) const

Returns a reference to the cell value (const version)

Definition at line 76 of file GridIterator.icpp.

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator++ ( )

Moves the iterator to the next grid cell.

Definition at line 49 of file GridIterator.icpp.

References std::map< K, T >::empty(), Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::end(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::m_fixed_indices.

Here is the call graph for this function:

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator-> ( )

Returns a pointer to the cell value.

Definition at line 83 of file GridIterator.icpp.

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator-> ( ) const

Returns a pointer to the cell value (const version)

Definition at line 90 of file GridIterator.icpp.

template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator= ( const iter< CellType, PointerType, ReferenceType > &  other)
template<typename GridCellManager , typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
bool Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator== ( const iter< CellType, PointerType, ReferenceType > &  other) const

Compares two iterators for equality. Should be used only for iterators of the same grid.

Definition at line 97 of file GridIterator.icpp.

References Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::m_data_iter.

Member Data Documentation

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
cell_manager_iter_type Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::m_data_iter
private
template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
std::map<size_t, size_t> Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::m_fixed_indices
private

Definition at line 540 of file GridContainer.h.

template<typename GridCellManager, typename... AxesTypes>
template<typename CellType , typename PointerType , typename ReferenceType >
const GridContainer<GridCellManager, AxesTypes...>& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::m_owner
private

Definition at line 538 of file GridContainer.h.


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