-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathPointSetImplementation.h
More file actions
77 lines (59 loc) · 1.8 KB
/
PointSetImplementation.h
File metadata and controls
77 lines (59 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include "Types.h"
#include "GridInfo.h"
#include <thrust/device_vector.h>
#include "cuda_helper.h"
namespace cuNSearch
{
class NeighborhoodSearch;
class cuNSearchDeviceData;
class PointSetImplementation
{
public:
PointSetImplementation(size_t particleCount, Real3 *particles);
PointSetImplementation(PointSetImplementation const& other) = default;
PointSetImplementation& operator=(PointSetImplementation const& other);
~PointSetImplementation() { }
void resize(size_t particleCount, Real3 *particles)
{
m_ParticleCount = particleCount;
m_Particles = particles;
uint threadStarts = 0;
CudaHelper::GetThreadBlocks(static_cast<unsigned int>(particleCount), ThreadsPerBlock, BlockStartsForParticles, threadStarts);
copyToDevice();
}
void copyToDevice();
thrust::device_vector<Real3> &getParticles()
{
return d_Particles;
}
int getThreadsPerBlock()
{
return ThreadsPerBlock;
}
uint getNumberOfBlocks()
{
return BlockStartsForParticles;
}
private:
friend NeighborhoodSearch;
friend cuNSearchDeviceData;
// Min Max of all particles
Real3 Min, Max;
size_t m_ParticleCount;
// Pointer to the host particle data
Real3 *m_Particles;
// Number of thread blocks that must be started to start a thread per particle
int ThreadsPerBlock;
uint BlockStartsForParticles;
// All device data for the a point set to perform query operations.
GridInfo gridInfo;
thrust::device_vector<Real3> d_Particles;
thrust::device_vector<uint> d_ParticleCellIndices;
thrust::device_vector<uint> d_CellOffsets;
thrust::device_vector<uint> d_CellParticleCounts;
thrust::device_vector<uint> d_SortIndices;
thrust::device_vector<uint> d_ReversedSortIndices;
void prepareInternalDataStructures(GridInfo &gridInfo, size_t numberOfCells);
};
};