FLIPSolver3.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_SOLVER3_HPP
12 #define CUBBYFLOW_FLIP_SOLVER3_HPP
13 
15 
16 namespace CubbyFlow
17 {
29 class FLIPSolver3 : public PICSolver3
30 {
31  public:
32  class Builder;
33 
35  FLIPSolver3();
36 
38  FLIPSolver3(const Vector3UZ& resolution, const Vector3D& gridSpacing,
39  const Vector3D& gridOrigin);
40 
42  FLIPSolver3(const FLIPSolver3&) = delete;
43 
45  FLIPSolver3(FLIPSolver3&&) noexcept = delete;
46 
48  ~FLIPSolver3() override = default;
49 
51  FLIPSolver3& operator=(const FLIPSolver3&) = delete;
52 
54  FLIPSolver3& operator=(FLIPSolver3&&) 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  Array3<double> m_uDelta;
84  Array3<double> m_vDelta;
85  Array3<double> m_wDelta;
86 };
87 
89 using FLIPSolver3Ptr = std::shared_ptr<FLIPSolver3>;
90 
95 {
96  public:
98  [[nodiscard]] FLIPSolver3 Build() const;
99 
101  [[nodiscard]] FLIPSolver3Ptr MakeShared() const;
102 };
103 } // namespace CubbyFlow
104 
105 #endif
double GetPICBlendingFactor() const
Returns the PIC blending factor.
FLIPSolver3()
Default constructor.
3-D Particle-in-Cell (PIC) implementation.
Definition: PICSolver3.hpp:30
std::shared_ptr< FLIPSolver3 > FLIPSolver3Ptr
Shared pointer type for the FLIPSolver3.
Definition: FLIPSolver3.hpp:89
Front-end to create FLIPSolver3 objects step by step.
Definition: FLIPSolver3.hpp:94
Base class for grid-based fluid solver builder.
Definition: GridFluidSolver3.hpp:315
void SetPICBlendingFactor(double factor)
Sets the PIC blending factor.
Definition: Matrix.hpp:27
FLIPSolver3 & operator=(const FLIPSolver3 &)=delete
Deleted copy assignment operator.
Definition: pybind11Utils.hpp:20
Definition: Array-Impl.hpp:19
static Builder GetBuilder()
Returns builder fox FLIPSolver3.
~FLIPSolver3() override=default
Default virtual destructor.
void TransferFromParticlesToGrids() override
Transfers velocity field from particles to grids.
void TransferFromGridsToParticles() override
Transfers velocity field from grids to particles.
3-D Fluid-Implicit Particle (FLIP) implementation.
Definition: FLIPSolver3.hpp:29