CUDAParticleSystemSolver2.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_SOLVER2_HPP
12 #define CUBBYFLOW_CUDA_PARTICLE_SYSTEM_SOLVER2_HPP
13 
14 #ifdef CUBBYFLOW_USE_CUDA
15 
17 
18 namespace CubbyFlow
19 {
33 class CUDAParticleSystemSolver2 : public CUDAParticleSystemSolverBase2
34 {
35  public:
36  class Builder;
37 
39  CUDAParticleSystemSolver2();
40 
42  CUDAParticleSystemSolver2(float radius, float mass);
43 
45  CUDAParticleSystemSolver2(const CUDAParticleSystemSolver2&) = delete;
46 
48  CUDAParticleSystemSolver2(CUDAParticleSystemSolver2&&) noexcept = delete;
49 
51  ~CUDAParticleSystemSolver2() override = default;
52 
54  CUDAParticleSystemSolver2& operator=(const CUDAParticleSystemSolver2&) =
55  delete;
56 
58  CUDAParticleSystemSolver2& operator=(CUDAParticleSystemSolver2&&) 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 CUDAParticleSystemSolver2Ptr = std::shared_ptr<CUDAParticleSystemSolver2>;
87 
91 class CUDAParticleSystemSolver2::Builder final
92  : public CUDAParticleSystemSolverBuilderBase2<Builder>
93 {
94  public:
96  Builder& WithRadius(float radius);
97 
99  Builder& WithMass(float mass);
100 
102  CUDAParticleSystemSolver2 Build() const;
103 
105  CUDAParticleSystemSolver2Ptr 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