5 #ifndef OPENFPM_PDATA_BLOCKMAPGPU_DIMENSIONALITYWRAPPERS_CUH 6 #define OPENFPM_PDATA_BLOCKMAPGPU_DIMENSIONALITYWRAPPERS_CUH 15 template<
typename BaseT>
18 typedef typename BaseT::scalarType type;
21 template<
typename BaseType,
unsigned int N1>
24 typedef typename BaseType::scalarType type[N1];
27 template<
typename BaseType,
unsigned int N1,
unsigned int N2>
30 typedef typename BaseType::scalarType type[N1][N2];
43 template<
typename BaseT,
unsigned int Nup,
unsigned int N>
46 typedef typename std::remove_extent<BaseT>::type array_slice;
47 typedef std::extent<BaseT> ext;
56 __device__ __host__
inline MultiArrayViewGpu<array_slice, ext::value, N-1> operator[](
int i)
62 template<
typename BaseT,
unsigned int Nup>
73 template <
typename IndexT>
75 :ptr((BaseT*)(((
typename BaseT::scalarType *)ptr) + offset))
78 __device__ __host__
inline typename BaseT::scalarType & operator[](
int i)
80 return *((
typename BaseT::scalarType *)(&(ptr[i])));
83 __device__ __host__
inline typename BaseT::scalarType & operator[](
int i)
const 85 return *((
typename BaseT::scalarType *)(&(ptr[i])));
91 for (
int i=0; i< Nup ; i++)
93 this->operator[](i) = other[i];
103 template<
typename BaseT>
108 __device__ __host__
inline typename BaseT::scalarType & operator[](
int i)
113 __device__ __host__
inline const typename BaseT::scalarType & operator[](
int i)
const 119 template<
typename BaseType,
unsigned int N1>
135 template<
typename BaseType,
unsigned int N1,
unsigned int N2>
138 BaseType array[N1][N2];
152 template<
typename BlockT>
155 typename BlockT::scalarType &value;
157 template <
typename IndexT>
158 __device__ __host__
RhsBlockWrapper(BlockT &block, IndexT offset) : value(block[offset]) {}
161 template<
typename BlockT,
unsigned int N>
164 typename BlockT::scalarType value[N];
166 template <
typename T,
typename IndexT>
169 for (
int i=0; i<N; ++i)
171 value[i] = input[i][offset];
176 template<
typename BlockT,
unsigned int N1,
unsigned int N2>
179 typename BlockT::scalarType value[N1][N2];
181 template <
typename T,
typename IndexT>
184 for (
int i=0; i<N1; ++i)
186 for (
int j=0; j<N2; ++j)
188 value[i][j] = input[i][j][offset];
199 template <
typename T1>
202 template <
typename T1b,
typename T2,
typename T3>
203 __device__ __host__
inline static void assignWithOffsetRHS(T1b &dst,
const T2 &src, T3 offset)
208 template <
typename T1b,
typename T2,
typename T3>
209 __device__ __host__
inline static void assignWithOffset(T1b &dst,
const T2 &src, T3 offset)
211 dst[offset] = src[offset];
214 template<
typename op,
typename T1b,
typename T2>
215 __device__
inline static void applyOp(T1b &a,
const T2 &b,
bool aExist,
bool bExist)
218 if (aExist && bExist)
229 template <
typename T1,
unsigned int N1>
232 template <
typename T1b,
typename T2,
typename T3>
233 __device__ __host__
inline static void assignWithOffsetRHS(T1b (& dst)[N1],
const T2 &src, T3 offset)
235 for (
int i = 0; i < N1; ++i)
242 template <
typename T1b,
typename T2,
typename T3>
244 __device__ __host__
inline static void assignWithOffset(T1b dst,
const T2 &src, T3 offset)
246 for (
int i = 0; i < N1; ++i)
253 template<
typename op,
typename T1b,
typename T2>
254 __device__
inline static void applyOp(T1b &a,
const T2 &b,
bool aExist,
bool bExist)
256 for (
int i = 0; i < N1; ++i)
262 template<
typename op,
typename T1b,
typename T2>
263 __device__
inline static void applyOp(
const T1b &a,
const T2 &b,
bool aExist,
bool bExist)
265 for (
int i = 0; i < N1; ++i)
290 #endif //OPENFPM_PDATA_BLOCKMAPGPU_DIMENSIONALITYWRAPPERS_CUH