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"
27template<
unsigned int dim,
typename stencil=no_stencil,
typename linearizer = gr
id_sm<dim,
void>>
33 bool initialized =
false;
85 for (
size_t i = 0 ; i < dim ; i++)
103 template<
typename gr
id_lin>
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++)
T getVolumeKey() const
Get the volume spanned by the Box P1 and P2 interpreted as grid key.
grid_key_dx_iterator(const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
Constructor.
grid_key_dx_iterator< dim, stencil, linearizer > & operator++()
Get the next element.
grid_key_dx_iterator()
Default constructor.
void reinitialize(const grid_key_dx_iterator< dim > &key)
Reinitialize the grid_key_dx_iterator.
linearizer grid_base
information of the grid where this iterator iterate
grid_key_dx< dim > getStart()
Return the starting point of the iteration.
const grid_key_dx< dim > & get() const
Get the actual key.
void set(int d, size_t sz)
Set the dimension.
grid_key_dx_iterator(const linearizer &g)
Constructor require a grid_sm<dim,T>
size_t get_gk(size_t i) const
return the index i of the gk key
grid_key_dx< dim > gk
Actual key.
void reset()
Reset the iterator (it restart from the beginning)
grid_key_dx_iterator(const grid_key_dx_iterator< dim > &g_it)
Constructor from a grid_key_dx_iterator<dim>
grid_key_dx_iterator(const grid_lin &g, const grid_key_dx< dim >(&stencil_pnt)[stencil::nsp])
Constructor require a grid_sm<dim,T>
size_t getStencil() const
Get the actual position.
void calc_stencil_offset(const grid_key_dx< dim > &start_p)
Calculate the stencil offset.
bool isNext()
Check if there is the next element.
grid_key_dx_iterator< dim > operator=(const grid_key_dx_iterator< dim > &key_it)
Constructor from another grid_key_dx_iterator.
size_t getVolume()
Get the volume spanned by this sub-grid iterator.
const linearizer & getGridInfo() const
Get the information about the grid.
grid_key_dx< dim > getStop()
Return the stop point of the iteration.
grid_key_dx is the key to access any element in the grid
void zero()
Set to zero the key.
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
__device__ __host__ index_type get(index_type i) const
Get the i index.