11 #ifndef CUBBYFLOW_PARTICLE_SYSTEM_DATA_HPP 12 #define CUBBYFLOW_PARTICLE_SYSTEM_DATA_HPP 18 #ifndef CUBBYFLOW_DOXYGEN 22 class FlatBufferBuilder;
89 void Resize(
size_t newNumberOfParticles);
92 [[nodiscard]]
size_t NumberOfParticles()
const;
102 [[nodiscard]]
size_t AddScalarData(
double initialVal = 0.0);
112 [[nodiscard]]
size_t AddVectorData(
116 [[nodiscard]]
double Radius()
const;
119 virtual void SetRadius(
double newRadius);
122 [[nodiscard]]
double Mass()
const;
125 virtual void SetMass(
double newMass);
203 [[nodiscard]]
const std::shared_ptr<PointNeighborSearcher<N>>&
204 NeighborSearcher()
const;
207 void SetNeighborSearcher(
222 void BuildNeighborSearcher(
double maxSearchRadius);
225 void BuildNeighborLists(
double maxSearchRadius);
228 void Serialize(std::vector<uint8_t>* buffer)
const override;
231 void Deserialize(
const std::vector<uint8_t>& buffer)
override;
237 template <
size_t M = N>
238 static std::enable_if_t<M == 2, void>
Serialize(
240 flatbuffers::FlatBufferBuilder* builder,
241 flatbuffers::Offset<fbs::ParticleSystemData2>* fbsParticleSystemData);
243 template <
size_t M = N>
244 static std::enable_if_t<M == 3, void>
Serialize(
246 flatbuffers::FlatBufferBuilder* builder,
247 flatbuffers::Offset<fbs::ParticleSystemData3>* fbsParticleSystemData);
249 template <
size_t M = N>
254 template <
size_t M = N>
260 double m_radius = 1e-3;
261 double m_mass = 1e-3;
262 size_t m_numberOfParticles = 0;
263 size_t m_positionIdx = 0;
264 size_t m_velocityIdx = 0;
265 size_t m_forceIdx = 0;
270 std::shared_ptr<PointNeighborSearcher<N>> m_neighborSearcher;
Abstract base class for any serializable class.
Definition: Serialization.hpp:21
N-D particle system data.
Definition: ParticleSystemData.hpp:48
std::shared_ptr< ParticleSystemData3 > ParticleSystemData3Ptr
Shared pointer type of ParticleSystemData3.
Definition: ParticleSystemData.hpp:284
Abstract base class for N-D neighbor point searcher.
Definition: PointNeighborSearcher.hpp:32
ParticleSystemData< 3 > ParticleSystemData3
3-D ParticleSystemData type.
Definition: ParticleSystemData.hpp:278
ParticleSystemData< 2 > ParticleSystemData2
2-D ParticleSystemData type.
Definition: ParticleSystemData.hpp:275
void Serialize(const ConstArrayView1< T > &array, std::vector< uint8_t > *buffer)
Serializes data chunk using common schema.
Definition: Serialization-Impl.hpp:19
std::shared_ptr< ParticleSystemData2 > ParticleSystemData2Ptr
Shared pointer type of ParticleSystemData2.
Definition: ParticleSystemData.hpp:281
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
void Deserialize(const std::vector< uint8_t > &buffer, Array1< T > *array)
Deserializes buffer to data chunk using common schema.
Definition: Serialization-Impl.hpp:26
Definition: Array-Impl.hpp:19
Generic N-dimensional array class interface.
Definition: Array.hpp:32