5 #ifndef OPENFPM_PDATA_SUPPORTBUILDER_CUH
6 #define OPENFPM_PDATA_SUPPORTBUILDER_CUH
8 #include <Space/Shape/Point.hpp>
9 #include <Vector/vector_dist.hpp>
11 #include "SupportBuilder.hpp"
14 template<
unsigned int dim,
typename T,
typename particles_type,
typename CellList_type,
typename supportSize_type>
15 __global__
void gatherSupportSize_gpu(
17 CellList_type cellList,
18 supportSize_type supportSize,
25 auto Np = cellList.getNNIteratorBox(cellList.getCell(pos));
28 auto q = Np.get(); ++Np;
34 supportSize.get(p) = N;
38 template<
unsigned int dim,
typename T,
typename particles_type,
typename CellList_type,
typename supportKey_type>
39 __global__
void assembleSupport_gpu(
41 CellList_type cellList,
42 supportKey_type supportSize,
43 supportKey_type supportKeys1D,
49 size_t supportKeysSize = supportSize.get(p+1)-supportSize.get(p);
50 size_t* supportKeys = &((
size_t*)supportKeys1D.getPointer())[supportSize.get(p)];
53 auto Np = cellList.getNNIteratorBox(cellList.getCell(pos));
56 auto q = Np.get(); ++Np;
64 template<
typename vector_type>
69 typename vector_type::stype rCut;
73 : domain(domain), rCut(rCut) {}
80 size_t& supportKeysTotalN)
82 domain.hostToDevicePos();
83 auto it = domain.getDomainIteratorGPU(512);
85 auto NN = domain.getCellListGPU(rCut);
86 domain.updateCellListGPU(NN);
89 kerOffsets.resize(N+1);
90 gatherSupportSize_gpu<vector_type::dims><<<it.wthr,it.thr>>>(domain.toKernel(), NN.toKernel(), kerOffsets.toKernel(), rCut);
91 kerOffsets.template deviceToHost();
93 supportKeysTotalN = 0; maxSupport = 0;
95 for (
size_t i = 0; i < N; ++i) {
96 size_t sz = kerOffsets.get(i);
97 kerOffsets.get(i) = supportKeysTotalN;
98 supportKeysTotalN += sz;
99 if (maxSupport < sz) maxSupport = sz;
101 kerOffsets.get(N) = supportKeysTotalN;
103 supportKeys1D.resize(supportKeysTotalN);
104 kerOffsets.template hostToDevice();
105 assembleSupport_gpu<vector_type::dims><<<it.wthr,it.thr>>>(domain.toKernel(), NN.toKernel(), kerOffsets.toKernel(), supportKeys1D.toKernel(), rCut);
106 supportKeys1D.template deviceToHost();
Class for FAST cell list implementation.
This class implement the point shape in an N-dimensional space.
__device__ __host__ T distance(const Point< dim, T > &q) const
It calculate the distance between 2 points.
Implementation of 1-D std::vector like structure.
auto getPos(vect_dist_key_dx vec_key) -> decltype(vPos.template get< 0 >(vec_key.getKey()))
Get the position of an element.