25#ifndef GRIDCONTAINER_GRIDCONTAINER_H
26#define GRIDCONTAINER_GRIDCONTAINER_H
38namespace GridContainer {
96template <
typename GridCellManager,
typename... AxesTypes>
106 template <
typename GCM>
109 template<
typename GCM>
110 static typename GCM::pointer_type
ptr_test(
typename GCM::pointer_type*);
112 template<
typename GCM>
115 template<
typename GCM>
116 static typename GCM::reference_type
ref_test(
typename GCM::reference_type*);
120 typedef decltype(ptr_test<GridCellManagerTraits<GridCellManager>>(
nullptr))
pointer_type;
132 template <typename CellType, typename PointerType, typename ReferenceType>
161 template <typename... Args>
427template <
typename GridCellManager,
typename... AxesTypes>
428template <
typename CellType,
typename Po
interType,
typename ReferenceType>
430 :
public std::iterator<std::forward_iterator_tag, CellType, std::ptrdiff_t, PointerType, ReferenceType> {
530 template <
typename OtherIter>
Provides information related with an axis of a GridContainer.
Class to iterate through the GridContainer cells.
const axis_type< I > & axisValue() const
void forwardToIndex(size_t axis, size_t fixed_index)
bool operator!=(const iter &other) const
iter & fixAllAxes(const OtherIter &other)
iter & fixAxisByIndex(size_t index)
iter(const GridContainer< GridCellManager, AxesTypes... > &owner, const cell_manager_iter_type &data_iter)
Constructs a new iterator for the given grid.
cell_manager_iter_type m_data_iter
const GridContainer< GridCellManager, AxesTypes... > & m_owner
iter & operator=(const iter &other)
Copy operator of the iterator.
std::map< size_t, size_t > m_fixed_indices
iter & operator++()
Moves the iterator to the next grid cell.
std::add_const< PointerType >::type operator->() const
Returns a pointer to the cell value (const version)
PointerType operator->()
Returns a pointer to the cell value.
iter(iter &&)=default
Move constructor.
bool operator==(const iter &other) const
std::add_const< ReferenceType >::type operator*() const
Returns a reference to the cell value (const version)
ReferenceType operator*()
Returns a reference to the cell value.
iter(const iter &)=default
Copy constructor.
iter & fixAxisByValue(const axis_type< I > &value)
Representation of a multi-dimensional grid which contains axis information.
const_iterator cend()
Returns a constant iterator to the cell after the last of the grid.
std::shared_ptr< GridCellManager > m_cell_manager
A pointer to the data of the grid.
const GridAxis< axis_type< I > > & getOriginalAxis() const
GridContainer< GridCellManager, AxesTypes... > fixAxisByValue(const axis_type< I > &value)
Returns a slice of the grid based on an axis value.
std::tuple< GridAxis< AxesTypes >... > m_axes
A tuple containing the axes of the grid.
std::tuple< decltype(std::declval< GridAxis< AxesTypes > >().size())... > infimum(const AxesTypes... coordinates) const
Returns the grid indexes to the greatest knot less or equal to the given coordinates.
GridContainer(const GridContainer< GridCellManager, AxesTypes... > &other, size_t axis, size_t index)
Slice constructor.
typename std::tuple_element< I, std::tuple< AxesTypes... > >::type axis_type
const std::tuple< GridAxis< AxesTypes >... > & getAxesTuple() const
Returns a tuple containing the information of all the grid axes.
const GridAxis< axis_type< I > > & getAxis() const
decltype(ref_test< GridCellManagerTraits< GridCellManager > >(nullptr)) reference_type
Reference type.
GridCellManagerTraits< GridCellManager >::iterator cell_manager_iter_type
const reference_type at(decltype(std::declval< GridAxis< AxesTypes > >().size())... indices) const
static cell_type & ref_test(...)
std::tuple< GridAxis< AxesTypes >... > m_axes_fixed
a tuple containing the original axes of the full grid, if this grid is a slice
const_iterator cbegin()
Returns a constant iterator to the first cell of the grid.
iterator end()
Returns an iterator to the cell after the last of the grid.
size_t size() const
Returns the total number of cells of the grid.
GridContainer copy() const
But if needed be, allow explicit copies and let GridCellManager optimize them away if possible.
static constexpr size_t axisNumber()
Returns the number of axes of the grid (dimensionality)
static cell_type * ptr_test(...)
const GridCellManager & getCellManager() const
std::map< size_t, size_t > m_fixed_indices
A map containing the axes which have been fixed, if this grid is a slice.
GridContainer< GridCellManager, AxesTypes... > fixAxisByIndex(size_t index)
Returns a slice of the grid based on an axis index.
GridCellManagerTraits< GridCellManager >::data_type cell_type
The type of the values stored in the grid cells.
iterator begin()
Returns an iterator to the first cell of the grid.
static GCM::pointer_type ptr_test(typename GCM::pointer_type *)
GridIndexHelper< AxesTypes... > m_index_helper_fixed
a helper class for calculations of the original axes indices
decltype(ptr_test< GridCellManagerTraits< GridCellManager > >(nullptr)) pointer_type
Pointer type.
GridIndexHelper< AxesTypes... > m_index_helper
A helper class used for calculations of the axes indices.
static GCM::reference_type ref_test(typename GCM::reference_type *)
Helper class for converting multi-dimensional grid coordinates to the index of a long data array and ...
Class used by the GridContainer to access the different CellManagers.
GridCellManager::data_type data_type
The type of the data kept by the GridCellManager.
GridCellManager::iterator iterator