Alexandria 2.31.0
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) |
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 |
|
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
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
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 |
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 |
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 |
|
private |
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.
ReferenceType Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator* | ( | ) |
Returns a reference to the cell value.
std::add_const< ReferenceType >::type Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator* | ( | ) | const |
Returns a reference to the cell value (const version)
iter & Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator++ | ( | ) |
Moves the iterator to the next grid cell.
PointerType Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator-> | ( | ) |
Returns a pointer to the cell value.
std::add_const< PointerType >::type Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator-> | ( | ) | const |
Returns a pointer to the cell value (const version)
iter & Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes >::iter< CellType, PointerType, ReferenceType >::operator= | ( | const iter< CellType, PointerType, ReferenceType > & | other | ) |
Copy operator of the iterator.
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.
|
private |
Definition at line 539 of file GridContainer.h.
|
private |
Definition at line 540 of file GridContainer.h.
|
private |
Definition at line 538 of file GridContainer.h.