FLIPSolver2.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_FLIP_SOLVER2_HPP
12 #define CUBBYFLOW_FLIP_SOLVER2_HPP
13 
15 
16 namespace CubbyFlow
17 {
29 class FLIPSolver2 : public PICSolver2
30 {
31  public:
32  class Builder;
33 
35  FLIPSolver2();
36 
38  FLIPSolver2(const Vector2UZ& resolution, const Vector2D& gridSpacing,
39  const Vector2D& gridOrigin);
40 
42  FLIPSolver2(const FLIPSolver2&) = delete;
43 
45  FLIPSolver2(FLIPSolver2&&) noexcept = delete;
46 
48  ~FLIPSolver2() override = default;
49 
51  FLIPSolver2& operator=(const FLIPSolver2&) = delete;
52 
54  FLIPSolver2& operator=(FLIPSolver2&&) noexcept = delete;
55 
57  [[nodiscard]] double GetPICBlendingFactor() const;
58 
69  void SetPICBlendingFactor(double factor);
70 
72  [[nodiscard]] static Builder GetBuilder();
73 
74  protected:
76  void TransferFromParticlesToGrids() override;
77 
79  void TransferFromGridsToParticles() override;
80 
81  private:
82  double m_picBlendingFactor = 0.0;
83  Array2<double> m_uDelta;
84  Array2<double> m_vDelta;
85 };
86 
88 using FLIPSolver2Ptr = std::shared_ptr<FLIPSolver2>;
89 
94 {
95  public:
97  [[nodiscard]] FLIPSolver2 Build() const;
98 
100  [[nodiscard]] FLIPSolver2Ptr MakeShared() const;
101 };
102 } // namespace CubbyFlow
103 
104 #endif
~FLIPSolver2() override=default
Default virtual destructor.
void TransferFromParticlesToGrids() override
Transfers velocity field from particles to grids.
2-D Particle-in-Cell (PIC) implementation.
Definition: PICSolver2.hpp:30
static Builder GetBuilder()
Returns builder fox FLIPSolver2.
Base class for grid-based fluid solver builder.
Definition: GridFluidSolver2.hpp:315
Front-end to create FLIPSolver2 objects step by step.
Definition: FLIPSolver2.hpp:93
double GetPICBlendingFactor() const
Returns the PIC blending factor.
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
Definition: Array-Impl.hpp:19
std::shared_ptr< FLIPSolver2 > FLIPSolver2Ptr
Shared pointer type for the FLIPSolver2.
Definition: FLIPSolver2.hpp:88
2-D Fluid-Implicit Particle (FLIP) implementation.
Definition: FLIPSolver2.hpp:29
void SetPICBlendingFactor(double factor)
Sets the PIC blending factor.
FLIPSolver2()
Default constructor.
void TransferFromGridsToParticles() override
Transfers velocity field from grids to particles.
FLIPSolver2 & operator=(const FLIPSolver2 &)=delete
Deleted copy assignment operator.