CUDAParticleSystemSolver3.hpp
Go to the documentation of this file.
1 // This code is based on Jet framework.
2 // Copyright (c) 2018 Doyub Kim
3 // CubbyFlow is voxel-based fluid simulation engine for computer games.
4 // Copyright (c) 2020 CubbyFlow Team
5 // Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6 // AI Part: Dongheon Cho, Minseo Kim
7 // We are making my contributions/submissions to this project solely in our
8 // personal capacity and are not conveying any rights to any intellectual
9 // property of any third parties.
10 
11 #ifndef CUBBYFLOW_CUDA_PARTICLE_SYSTEM_SOLVER3_HPP
12 #define CUBBYFLOW_CUDA_PARTICLE_SYSTEM_SOLVER3_HPP
13 
14 #ifdef CUBBYFLOW_USE_CUDA
15 
17 
18 namespace CubbyFlow
19 {
33 class CUDAParticleSystemSolver3 : public CUDAParticleSystemSolverBase3
34 {
35  public:
36  class Builder;
37 
39  CUDAParticleSystemSolver3();
40 
42  CUDAParticleSystemSolver3(float radius, float mass);
43 
45  CUDAParticleSystemSolver3(const CUDAParticleSystemSolver3&) = delete;
46 
48  CUDAParticleSystemSolver3(CUDAParticleSystemSolver3&&) noexcept = delete;
49 
51  ~CUDAParticleSystemSolver3() override = default;
52 
54  CUDAParticleSystemSolver3& operator=(const CUDAParticleSystemSolver3&) =
55  delete;
56 
58  CUDAParticleSystemSolver3& operator=(CUDAParticleSystemSolver3&&) noexcept =
59  delete;
60 
62  float Radius() const;
63 
65  void SetRadius(float newRadius);
66 
68  float Mass() const;
69 
71  void SetMass(float newMass);
72 
74  static Builder GetBuilder();
75 
76  protected:
78  void OnAdvanceTimeStep(double timeStepInSeconds) override;
79 
80  private:
81  float m_radius = 1e-3f;
82  float m_mass = 1e-3f;
83 };
84 
86 using CUDAParticleSystemSolver3Ptr = std::shared_ptr<CUDAParticleSystemSolver3>;
87 
91 class CUDAParticleSystemSolver3::Builder final
92  : public CUDAParticleSystemSolverBuilderBase3<Builder>
93 {
94  public:
96  Builder& WithRadius(float radius);
97 
99  Builder& WithMass(float mass);
100 
102  CUDAParticleSystemSolver3 Build() const;
103 
105  CUDAParticleSystemSolver3Ptr MakeShared() const;
106 
107  private:
108  float m_radius = 1e-3f;
109  float m_mass = 1e-3f;
110 };
111 } // namespace CubbyFlow
112 
113 #endif
114 
115 #endif
Definition: pybind11Utils.hpp:20