2#include <boost/shared_array.hpp>
4#include "memory_cpu.hpp"
5#include "memory_gpu.hpp"
6#include <initializer_list>
11template<
typename T,
unsigned int s1,
unsigned int s2,
unsigned int s3>
22 return s1*s2*s3*g_mem[0][0][0].size();
27template<
unsigned int dim>
36 template<
typename a,
typename ...T>
grid_key_dx(a v,T...t)
42 template<
typename a,
typename ...T>
void set(a v, T...t)
52 template<
typename a,
typename ...T>
void invert_assign(a v,T...t)
65template<
unsigned int dim,
unsigned int p>
71 template<
typename a,
typename ...T>
grid_key_d(a v,T...t)
77 template<
typename a,
typename ...T>
void invert_assign(a v,T...t)
83 template<
typename a,
typename ...T>
void invert_assign(a v)
91template<
unsigned int p>
104template<
unsigned int p>
118template<
unsigned int p>
128 const std::array<mem_id,3> k;
131template<
unsigned int p>
146template<
unsigned int p>
151 grid_key_4(mem_id u_, mem_id i_, mem_id j_, mem_id k_)
162template<
unsigned int p>
177 void set_d(
size_t id_, mem_id val)
182 void set(mem_id val1)
187 void set(mem_id val1, mem_id val2)
193 void set(mem_id val1, mem_id val2, mem_id val3)
200 void set(mem_id val1, mem_id val2, mem_id val3, mem_id val4)
213 boost::shared_array<mem_id> id;
216#pragma openfpm layout
221 std::vector<size_t> sz;
222 std::vector<size_t> sz_s;
228 size_t totalSize(std::vector<size_t> & sz)
232 for (
size_t i = 0 ; i < sz.size() ; i++)
240 grid(std::vector<size_t> & sz)
241 : size_tot(totalSize(sz)), sz(sz)
243 sz_s.resize(sz.size());
245 for (
size_t i = 1 ; i < sz.size() ; i++)
247 sz_s[i] = sz[i]*sz_s[i-1];
251 #pragma openfpm layout(get)
254 mem_id
lid = gk.
k[0];
255 for (mem_id i = 1 ; i < dim ; i++)
257 lid += gk.
k[i] * sz_s[i-1];
263 #pragma openfpm layout(get)
266 mem_id
lid = gk.k[0];
267 lid += gk.k[1]*sz_s[0];
268 lid += gk.k[2]*sz_s[1];
273 #pragma openfpm layout(get)
276 mem_id
lid = gk.k[0];
277 for (mem_id i = 1 ; i < dim ; i++)
279 lid += gk.k[i] * sz_s[i-1];
285 #pragma openfpm layout(get)
286 mem_id LinId(mem_id *
id)
290 for (mem_id i = 1 ; i < (mem_id)sz.size() ; i++)
292 lid +=
id[i] * sz_s[i-1];
298 #pragma openfpm layout(get)
299 mem_id LinId(mem_id i)
304 #pragma openfpm layout(get)
305 mem_id LinId(mem_id j, mem_id k)
314 #pragma openfpm layout(get)
315 mem_id LinId(mem_id i, mem_id j, mem_id k)
325 #pragma openfpm layout(get)
326 mem_id LinId(mem_id u, mem_id i, mem_id j, mem_id k)
339 #pragma openfpm layout(size)
346template<
unsigned int s1,
unsigned int s2,
unsigned int s3>
grid_key_d is the key to access any element in the grid
grid_key_dx is the key to access any element in the grid
__device__ __host__ grid_key_dx()
Constructor.
__device__ __host__ void invert_assign()
Constructor.
index_type k[dim]
structure that store all the index
__device__ __host__ void set(a v, T...t)
set the Key from a list of numbers