8 #ifndef OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_HPP_
9 #define OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_HPP_
11 #include "Grid/grid_sm.hpp"
12 #include "stencil_type.hpp"
27 template<
unsigned int dim,
typename stencil=no_stencil>
33 bool initialized =
false;
85 for (
size_t i = 0 ; i < dim ; i++)
111 for (
size_t i = 0 ; i < dim ; i++) {zero.
set_d(i,0);}
114 stl_code.calc_offsets(g,zero,stencil_pnt);
161 for (
size_t i = 0 ; i < dim ; i++)
177 size_t id =
gk.get(0);
185 for ( ; i < dim-1 ; i++)
188 size_t id =
gk.get(i);
193 size_t idr =
gk.get(i);
217 inline void set(
int d,
size_t sz)
233 return stl_code.template getStencil<id>();
297 for (
size_t i = 0 ; i < dim ; i++)
303 for (
size_t i = 0 ; i < dim ; i++)
344 for (
size_t i = 0 ; i < dim ; i++)
grid_key_dx_iterator()
Default constructor.
grid_key_dx is the key to access any element in the grid
void reinitialize(const grid_key_dx_iterator< dim > &key)
Reinitialize the grid_key_dx_iterator.
grid_key_dx_iterator(const grid_key_dx_iterator< dim > &g_it)
Constructor from a grid_key_dx_iterator<dim>
size_t size() const
Return the size of the grid.
grid_key_dx_iterator< dim > operator=(const grid_key_dx_iterator< dim > &key_it)
Constructor from another grid_key_dx_iterator.
size_t get_gk(size_t i) const
return the index i of the gk key
void calc_stencil_offset(const grid_key_dx< dim > &start_p)
Calculate the stencil offset.
size_t getVolume()
Get the volume spanned by this sub-grid iterator.
grid_key_dx< dim > getStop()
Return the stop point of the iteration.
void reset()
Reset the iterator (it restart from the beginning)
grid_key_dx_iterator(const grid_sm< dim, T > &g)
Constructor require a grid_sm<dim,T>
grid_sm< dim, void > grid_base
information of the grid where this iterator iterate
grid_key_dx< dim > getStart()
Return the starting point of the iteration.
void zero()
Set to zero the key.
grid_key_dx_iterator(const grid_sm< dim, T > &g, const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
Constructor require a grid_sm<dim,T>
bool isNext()
Check if there is the next element.
size_t getStencil() const
Get the actual position.
void set(int d, size_t sz)
Set the dimension.
This class is a trick to indicate the compiler a specific specialization pattern. ...
grid_key_dx_iterator(const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
Constructor.
grid_key_dx< dim > gk
Actual key.
void set_d(size_t i, mem_id id)
Set the i index.
T getVolumeKey() const
Get the volume spanned by the Box P1 and P2 interpreted as grid key.
const grid_sm< dim, void > & getGridInfo() const
Get the information about the grid.
grid_key_dx_iterator< dim, stencil > & operator++()
Get the next element.