8#ifndef SPARSEGRIDGPU_ITERATOR_SUB_HPP_
9#define SPARSEGRIDGPU_ITERATOR_SUB_HPP_
11#include "SparseGridGpu_iterator.hpp"
13template<
unsigned int dim,
typename SparseGr
idType>
32 const typename std::remove_reference<
decltype(
sparseGrid->private_get_index_array())>::type *
ids;
35 const typename std::remove_reference<
decltype(
sparseGrid->private_get_data_array())>::type *
data;
38 typedef typename boost::mpl::at<typename data_array_type::value_type::type,boost::mpl::int_<0>>::type chunk_type;
41 typedef boost::mpl::int_<boost::mpl::size<typename data_array_type::value_type::type>::type::value-1> pMask;
69 for (
int i = 0 ; i < dim ; i++)
79 for (
int i = 0 ; i < dim ; i++)
87 while (in_chunk_it.
isNext() ==
true && (
data->template get<pMask::value>(
chunk)[chunk_sz.
LinId(in_chunk_it.
get())]&1ul) == 0)
97 while (in_chunk_it.
isNext() ==
true && (
data->template get<pMask::value>(
chunk)[chunk_sz.
LinId(in_chunk_it.
get())]&1ul) == 0)
102 while (in_chunk_it.
isNext() ==
false && chunk < ids->size())
118 for (
int i = 0 ; i < dim ; i++)
151 for (
int i = 0; i < dim ; i++)
160 in_chunk_it.invalidate();
194 this->operator=(it_sub);
244 sub_set = it_sub.sub_set;
246 in_chunk_it = it_sub.in_chunk_it;
247 chunk_sz = it_sub.chunk_sz;
This class represent an N-dimensional box.
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
__device__ __host__ bool Intersect(const Box< dim, T > &b, Box< dim, T > &b_out) const
Intersect.
__device__ __host__ T getHigh(int i) const
get the high interval of the box
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
grid_key_dx< dim > getKP2() const
Get the point p12 as grid_key_dx.
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
grid_key_dx< dim > getKP1() const
Get the point p1 as grid_key_dx.
sparse_grid_gpu_index< SparseGridType > get() const
return the actual point
const SparseGridType * sparseGrid
original SparseGrid
void initialize_chunk_it()
initialize the chunk interator
std::remove_reference< decltype(sparseGrid->private_get_data_array())>::type data_array_type
array type for the data
SparseGridGpu_iterator_sub< dim, SparseGridType > & operator++()
Get the next element.
std::remove_reference< decltype(sparseGrid->private_get_index_array())>::type index_array_type
array type for the indexes
unsigned int chunk
actual chunk
const std::remove_reference< decltype(sparseGrid->private_get_data_array())>::type * data
vector containing each chunks datas
grid_key_dx< dim > getStart() const
Return the starting point.
void initialize_chunk_sz()
Initialize chunk_sz member.
void reinitialize(const SparseGridGpu_iterator_sub< dim, SparseGridType > &it_sub)
Reinitialize the iterator.
const std::remove_reference< decltype(sparseGrid->private_get_index_array())>::type * ids
vector of the chunk indexes
void SelectValid()
Select the first valid point chunk.
grid_key_dx< dim > getStop() const
Return the stop point.
bool isNext() const
Check if there is the next element.
SparseGridGpu_iterator_sub(const SparseGridType &sparseGrid, const grid_key_dx< dim > &start, const grid_key_dx< dim > &stop, int is_to_init)
Constructor.
grid_key_dx< dim, int > chunk_coord
chunk coordinates
SparseGridGpu_iterator_sub()
Default constructor.
Declaration grid_key_dx_iterator_sub.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
bool isNext()
Check if there is the next element.
void reinitialize(const grid_key_dx_iterator_sub< dim > &g_s_it)
Reinitialize the iterator.
grid_key_dx is the key to access any element in the grid
__device__ __host__ index_type get(index_type i) const
Get the i index.
void setDimensions(const size_t(&dims)[N])
Reset the dimension of the grid.
mem_id LinId(const grid_key_dx< N, ids_type > &gk, const signed char sum_id[N]) const
Linearization of the grid_key_dx with a specified shift.
Element index contain a data chunk index and a point index.