FLIPSolver2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: FLIPSolver2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: 2-D Fluid-Implicit Particle (FLIP) implementation.
6 > Created Time: 2017/09/13
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_FLIP_SOLVER2_H
10 #define CUBBYFLOW_FLIP_SOLVER2_H
11 
13 
14 namespace CubbyFlow
15 {
27  class FLIPSolver2 : public PICSolver2
28  {
29  public:
30  class Builder;
31 
33  FLIPSolver2();
34 
37  const Size2& resolution,
38  const Vector2D& gridSpacing,
39  const Vector2D& gridOrigin);
40 
42  virtual ~FLIPSolver2();
43 
45  double GetPICBlendingFactor() const;
46 
57  void SetPICBlendingFactor(double factor);
58 
60  static Builder GetBuilder();
61 
62  protected:
64  void TransferFromParticlesToGrids() override;
65 
67  void TransferFromGridsToParticles() override;
68 
69  private:
70  double m_picBlendingFactor = 0.0;
71  Array2<float> m_uDelta;
72  Array2<float> m_vDelta;
73  };
74 
76  using FLIPSolver2Ptr = std::shared_ptr<FLIPSolver2>;
77 
81  class FLIPSolver2::Builder final : public GridFluidSolverBuilderBase2<FLIPSolver2::Builder>
82  {
83  public:
85  FLIPSolver2 Build() const;
86 
88  FLIPSolver2Ptr MakeShared() const;
89  };
90 }
91 
92 #endif
void TransferFromParticlesToGrids() override
Transfers velocity field from particles to grids.
2-D Particle-in-Cell (PIC) implementation.
Definition: PICSolver2.h:28
static Builder GetBuilder()
Returns builder fox FLIPSolver2.
Base class for grid-based fluid solver builder.
Definition: GridFluidSolver2.h:303
Front-end to create FLIPSolver2 objects step by step.
Definition: FLIPSolver2.h:81
double GetPICBlendingFactor() const
Returns the PIC blending factor.
FLIPSolver2 Build() const
Builds FLIPSolver2.
virtual ~FLIPSolver2()
Default destructor.
2-D point class.
Definition: Point2.h:25
Definition: pybind11Utils.h:24
std::shared_ptr< FLIPSolver2 > FLIPSolver2Ptr
Shared pointer type for the FLIPSolver2.
Definition: FLIPSolver2.h:76
2-D Fluid-Implicit Particle (FLIP) implementation.
Definition: FLIPSolver2.h:27
FLIPSolver2Ptr MakeShared() const
Builds shared pointer of FLIPSolver2 instance.
void SetPICBlendingFactor(double factor)
Sets the PIC blending factor.
2-D vector class.
Definition: Vector2.h:26
FLIPSolver2()
Default constructor.
2-D array class.
Definition: Array2.h:42
void TransferFromGridsToParticles() override
Transfers velocity field from grids to particles.