11 #ifndef CUBBYFLOW_CUDA_PARTICLE_SYSTEM_DATA2_HPP 12 #define CUBBYFLOW_CUDA_PARTICLE_SYSTEM_DATA2_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 21 #include <cuda_runtime.h> 25 class CUDAParticleSystemData2
29 using IntData = CUDAArray1<int>;
32 using FloatData = CUDAArray1<float>;
35 using VectorData = CUDAArray1<float2>;
38 CUDAParticleSystemData2();
41 explicit CUDAParticleSystemData2(
size_t numberOfParticles);
44 virtual ~CUDAParticleSystemData2() =
default;
47 CUDAParticleSystemData2(
const CUDAParticleSystemData2& other);
50 CUDAParticleSystemData2(CUDAParticleSystemData2&& other) noexcept;
53 CUDAParticleSystemData2& operator=(
const CUDAParticleSystemData2& other);
56 CUDAParticleSystemData2& operator=(
57 CUDAParticleSystemData2&& other) noexcept;
64 void Resize(
size_t newNumberOfParticles);
67 size_t NumberOfParticles()
const;
74 size_t AddIntData(
int initialVal = 0);
81 size_t AddFloatData(
float initialVal = 0.0f);
91 size_t NumberOfIntData()
const;
94 size_t NumberOfFloatData()
const;
97 size_t NumberOfVectorData()
const;
100 ConstCUDAArrayView1<float2> Positions()
const;
103 CUDAArrayView1<float2> Positions();
106 ConstCUDAArrayView1<float2> Velocities()
const;
109 CUDAArrayView1<float2> Velocities();
112 ConstCUDAArrayView1<int> IntDataAt(
size_t idx)
const;
115 CUDAArrayView1<int> IntDataAt(
size_t idx);
118 ConstCUDAArrayView1<float> FloatDataAt(
size_t idx)
const;
121 CUDAArrayView1<float> FloatDataAt(
size_t idx);
124 ConstCUDAArrayView1<float2> VectorDataAt(
size_t idx)
const;
127 CUDAArrayView1<float2> VectorDataAt(
size_t idx);
135 void AddParticle(
const Vector2F& newPosition,
145 ConstArrayView1<Vector2F> newPositions,
146 ConstArrayView1<Vector2F> newVelocities = ArrayView1<Vector2F>{});
155 ConstCUDAArrayView1<float2> newPositions,
156 ConstCUDAArrayView1<float2> newVelocities = CUDAArrayView1<float2>{});
159 ConstCUDAArrayView1<uint32_t> NeighborStarts()
const;
162 ConstCUDAArrayView1<uint32_t> NeighborEnds()
const;
169 const CUDAPointHashGridSearcher2* NeighborSearcher()
const;
176 ConstCUDAArrayView1<uint32_t> NeighborLists()
const;
179 void BuildNeighborSearcher(
float maxSearchRadius);
182 void BuildNeighborLists(
float maxSearchRadius);
185 void Set(
const CUDAParticleSystemData2& other);
188 CUDAPointHashGridSearcher2Ptr m_neighborSearcher;
189 CUDAArray1<uint32_t> m_neighborStarts;
190 CUDAArray1<uint32_t> m_neighborEnds;
191 CUDAArray1<uint32_t> m_neighborLists;
194 size_t m_numberOfParticles = 0;
195 size_t m_positionIdx;
196 size_t m_velocityIdx;
198 std::vector<IntData> m_intDataList;
199 std::vector<FloatData> m_floatDataList;
200 std::vector<VectorData> m_vectorDataList;
204 using CUDAParticleSystemData2Ptr = std::shared_ptr<CUDAParticleSystemData2>;
Definition: pybind11Utils.hpp:20
Vector2< float > Vector2F
Definition: Matrix.hpp:773