11 #ifndef CUBBYFLOW_CUDA_PARTICLE_SYSTEM_DATA3_HPP 12 #define CUBBYFLOW_CUDA_PARTICLE_SYSTEM_DATA3_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 21 #include <cuda_runtime.h> 25 class CUDAParticleSystemData3
29 using IntData = CUDAArray1<int>;
32 using FloatData = CUDAArray1<float>;
35 using VectorData = CUDAArray1<float4>;
38 CUDAParticleSystemData3();
41 explicit CUDAParticleSystemData3(
size_t numberOfParticles);
44 virtual ~CUDAParticleSystemData3() =
default;
47 CUDAParticleSystemData3(
const CUDAParticleSystemData3& other);
50 CUDAParticleSystemData3(CUDAParticleSystemData3&& other) noexcept;
53 CUDAParticleSystemData3& operator=(
const CUDAParticleSystemData3& other);
56 CUDAParticleSystemData3& operator=(
57 CUDAParticleSystemData3&& 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<float4> Positions()
const;
103 CUDAArrayView1<float4> Positions();
106 ConstCUDAArrayView1<float4> Velocities()
const;
109 CUDAArrayView1<float4> 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<float4> VectorDataAt(
size_t idx)
const;
127 CUDAArrayView1<float4> VectorDataAt(
size_t idx);
135 void AddParticle(
const Vector4F& newPosition,
145 ConstArrayView1<Vector4F> newPositions,
146 ConstArrayView1<Vector4F> newVelocities = ArrayView1<Vector4F>{});
155 ConstCUDAArrayView1<float4> newPositions,
156 ConstCUDAArrayView1<float4> newVelocities = CUDAArrayView1<float4>{});
159 ConstCUDAArrayView1<uint32_t> NeighborStarts()
const;
162 ConstCUDAArrayView1<uint32_t> NeighborEnds()
const;
169 const CUDAPointHashGridSearcher3* NeighborSearcher()
const;
176 ConstCUDAArrayView1<uint32_t> NeighborLists()
const;
179 void BuildNeighborSearcher(
float maxSearchRadius);
182 void BuildNeighborLists(
float maxSearchRadius);
185 void Set(
const CUDAParticleSystemData3& other);
188 CUDAPointHashGridSearcher3Ptr 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 CUDAParticleSystemData3Ptr = std::shared_ptr<CUDAParticleSystemData3>;
Vector4< float > Vector4F
Definition: Matrix.hpp:799
Definition: pybind11Utils.hpp:20