Alexandria 2.31.2
SDC-CH common library for the Euclid 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. | |
iter (const iter &)=default | |
Copy constructor. | |
iter (iter &&)=default | |
Move constructor. | |
iter & | operator= (const iter &other) |
Copy operator of the iterator. | |
iter & | operator++ () |
Moves the iterator to the next grid cell. | |
ReferenceType | operator* () |
Returns a reference to the cell value. | |
std::add_const< ReferenceType >::type | operator* () const |
Returns a reference to the cell value (const version) | |
PointerType | operator-> () |
Returns a pointer to the cell value. | |
std::add_const< PointerType >::type | operator-> () const |
Returns a pointer to the cell value (const version) | |
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 433 of file GridContainer.h.
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.
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, 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().
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
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::axisValue | ( | ) | const -> const axis_type<I>& |
Definition at line 120 of file GridIterator.icpp.
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.
OtherIter | The type of the other iterator |
other | The iterator to get the axes values from |
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().
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.
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, PointerType, ReferenceType >::fixAxisByIndex | ( | size_t | index | ) | -> iter& |
Definition at line 129 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, 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.
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 |
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(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::fixAxisByIndex().
|
private |
Definition at line 161 of file GridIterator.icpp.
References Euclid::GridContainer::GridCellManagerTraits< GridCellManager >::begin().
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.
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.
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.
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.
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.
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.
auto Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator= | ( | const iter< CellType, PointerType, ReferenceType > & | other | ) |
Copy operator of the iterator.
Definition at line 40 of file GridIterator.icpp.
References Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::m_fixed_indices.
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.
|
private |
Definition at line 539 of file GridContainer.h.
Referenced by Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator!=(), and Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator==().
|
private |
Definition at line 540 of file GridContainer.h.
|
private |
Definition at line 538 of file GridContainer.h.