Alexandria
2.18
Please provide a description of the project.
|
Class to iterate through the GridContainer cells. More...
#include <GridContainer.h>
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< CellType > &)=default | |
Copy constructor. More... | |
iter (iter< CellType > &&)=default | |
Move constructor. More... | |
iter & | operator= (const iter &other) |
Copy operator of the iterator. More... | |
iter & | operator++ () |
Moves the iterator to the next grid cell. More... | |
CellType & | operator* () |
Returns a reference to the cell value. More... | |
std::add_const< CellType >::type & | operator* () const |
Returns a reference to the cell value (const version) More... | |
CellType * | operator-> () |
Returns a pointer to the cell value. More... | |
std::add_const< CellType >::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> | |
iter & | fixAxisByIndex (size_t index) |
template<int I> | |
iter & | fixAxisByValue (const axis_type< I > &value) |
template<typename OtherIter > | |
iter & | fixAllAxes (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 |
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 115 of file GridContainer.h.
Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::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.
owner | The grid to iterate through |
data_iter | The GridCellManager iterator indicating the cell position |
Definition at line 34 of file GridIterator.icpp.
|
default |
Copy constructor.
|
default |
Move constructor.
size_t Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::axisIndex | ( | ) | const |
Returns the index (coordinate) of the axis with index I, for the cell the iterator points
Definition at line 105 of file GridIterator.icpp.
References Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::begin().
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::axisValue | ( | ) | const -> const axis_type<I>& |
Definition at line 113 of file GridIterator.icpp.
const axis_type<I>& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::axisValue | ( | ) | const |
Returns the value of the axis with index I, for the cell the iterator points
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::fixAllAxes | ( | const OtherIter & | other | ) | -> iter& |
Definition at line 173 of file GridIterator.icpp.
References Euclid::GridContainer::fixSameAxes().
iter& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::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.
OtherIter | The type of the other iterator |
other | The iterator to get the axes values from |
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::fixAxisByIndex | ( | size_t | index | ) | -> iter& |
Definition at line 121 of file GridIterator.icpp.
References std::map< K, T >::end(), std::map< K, T >::find(), Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::m_fixed_indices, and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::size().
iter& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::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.
I | the index of the axis to fix |
index | the index to fix the axis to |
Elements::Exception | if the given index is out of the bounds of the axis |
Elements::Exception | if the axis has already been fixed for this iterator |
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::fixAxisByValue | ( | const axis_type< I > & | value | ) | -> iter& |
Definition at line 138 of file GridIterator.icpp.
References std::find().
iter& Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::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.
I | the index of the axis to fix |
value | the value to fix the axis to |
Elements::Exception | if the axis does not contain the given value |
Elements::Exception | if the axis has already been fixed for this iterator |
|
private |
Definition at line 150 of file GridIterator.icpp.
References Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::begin().
bool Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator!= | ( | const iter< CellType > & | other | ) | const |
Compares two iterators for inequality. Should be used only for iterators of the same grid.
Definition at line 98 of file GridIterator.icpp.
References Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::m_data_iter.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator* | ( | ) |
Returns a reference to the cell value.
Definition at line 68 of file GridIterator.icpp.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator* | ( | ) | const |
Returns a reference to the cell value (const version)
Definition at line 74 of file GridIterator.icpp.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator++ | ( | ) |
Moves the iterator to the next grid cell.
Definition at line 48 of file GridIterator.icpp.
References std::map< K, T >::empty(), Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::end(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::m_fixed_indices.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator-> | ( | ) |
Returns a pointer to the cell value.
Definition at line 80 of file GridIterator.icpp.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator-> | ( | ) | const |
Returns a pointer to the cell value (const version)
Definition at line 86 of file GridIterator.icpp.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator= | ( | const iter< CellType > & | other | ) |
Copy operator of the iterator.
Definition at line 40 of file GridIterator.icpp.
References Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::m_data_iter, and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::m_fixed_indices.
bool Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator== | ( | const iter< CellType > & | other | ) | const |
Compares two iterators for equality. Should be used only for iterators of the same grid.
Definition at line 92 of file GridIterator.icpp.
References Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::m_data_iter.
|
private |
Definition at line 488 of file GridContainer.h.
Referenced by Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator!=(), Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator=(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType >::operator==().
|
private |
Definition at line 489 of file GridContainer.h.
|
private |
Definition at line 487 of file GridContainer.h.