8#ifndef SPARSEGRIDGPU_ITERATOR_HPP_
9#define SPARSEGRIDGPU_ITERATOR_HPP_
16template<
typename SparseGr
idGpu_type>
53 for (
size_t i = 0; i < SparseGridGpu_type::dims ; i++)
55 p.
get(i) = coord.get(i);
116 for (
int i = 0 ; i < SparseGridGpu_type::dims ; i++)
149 inline unsigned int get(
unsigned int i)
const
157template<
unsigned int dim,
typename SparseGr
idType>
182 typedef typename boost::mpl::at<typename data_array_type::value_type::type,boost::mpl::int_<0>>::type chunk_type;
185 typedef boost::mpl::int_<boost::mpl::size<typename data_array_type::value_type::type>::type::value-1> pMask;
190 while (pnt < chunk_type::size && data->
template get<pMask::value>(
chunk)[
pnt] == 0)
195 while (
pnt == chunk_type::size && chunk < ids->size())
199 while (pnt < chunk_type::size && data->
template get<pMask::value>(
chunk)[
pnt] == 0)
258 if (
pnt >= chunk_type::size)
This class implement the point shape in an N-dimensional space.
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
bool isNext() const
Check if there is the next element.
const index_array_type * ids
vector of the chunk indexes
std::remove_reference< decltype(sparseGrid->private_get_index_array())>::type index_array_type
array type for the indexes
unsigned int chunk
actual chunk
sparse_grid_gpu_index< SparseGridType > get() const
return the actual point
std::remove_reference< decltype(sparseGrid->private_get_data_array())>::type data_array_type
array type for the data
unsigned int pnt
actual point inside the chunk
const SparseGridType * sparseGrid
original SparseGrid
SparseGridGpu_iterator< dim, SparseGridType > & operator++()
Get the next element.
void reinitialize(const SparseGridGpu_iterator< dim, SparseGridType > &it)
Reinitialize the iterator.
const data_array_type * data
vector containing each chunks datas
SparseGridGpu_iterator(const SparseGridType &sparseGrid)
Constructor.
void SelectValid()
Select the first valid point chunk.
grid_key_dx is the key to access any element in the grid
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
Element index contain a data chunk index and a point index.
int get_cnk_pos_id() const
Get chunk position id.
void set_data_id(int data_id)
Set chunk local index (the returned index < getblockSize())
void set_cnk_pos_id(int cnk_pos_id)
Set chunk position id.
void set_d(size_t i, int n)
set the position of this key in direction i to n
Point< SparseGridGpu_type::dims, size_t > toPoint() const
Convert to a point this index.
grid_key_dx< SparseGridGpu_type::dims > operator+(const Point< SparseGridGpu_type::dims, size_t > &p)
return toPoint() + p
int get_data_id() const
Get chunk local index (the returned index < getblockSize())
const SparseGridGpu_type & sparseGrid
SparseGridGpu used to add functionalities.
int cnk_pos_id
chunk position id
sparse_grid_gpu_index(const SparseGridGpu_type &sparseGrid, int cnk_pos_id, int data_id)
Constructor from SparseGridGpu.