APICSolver2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: APICSolver2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: 2-D Affine Particle-in-Cell (APIC) implementation.
6 > Created Time: 2017/10/06
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_APIC_SOLVER2_H
10 #define CUBBYFLOW_APIC_SOLVER2_H
11 
13 
14 namespace CubbyFlow
15 {
25  class APICSolver2 : public PICSolver2
26  {
27  public:
28  class Builder;
29 
31  APICSolver2();
32 
35  const Size2& resolution,
36  const Vector2D& gridSpacing,
37  const Vector2D& gridOrigin);
38 
40  virtual ~APICSolver2();
41 
43  static Builder GetBuilder();
44 
45  protected:
47  void TransferFromParticlesToGrids() override;
48 
50  void TransferFromGridsToParticles() override;
51 
52  private:
53  Array1<Vector2D> m_cX;
54  Array1<Vector2D> m_cY;
55  };
56 
58  using APICSolver2Ptr = std::shared_ptr<APICSolver2>;
59 
63  class APICSolver2::Builder final : public GridFluidSolverBuilderBase2<APICSolver2::Builder>
64  {
65  public:
67  APICSolver2 Build() const;
68 
70  APICSolver2Ptr MakeShared() const;
71  };
72 }
73 
74 #endif
2-D Particle-in-Cell (PIC) implementation.
Definition: PICSolver2.h:28
APICSolver2Ptr MakeShared() const
Builds shared pointer of APICSolver2 instance.
APICSolver2 Build() const
Builds APICSolver2.
Base class for grid-based fluid solver builder.
Definition: GridFluidSolver2.h:303
static Builder GetBuilder()
Returns builder fox APICSolver2.
2-D Affine Particle-in-Cell (APIC) implementation
Definition: APICSolver2.h:25
2-D point class.
Definition: Point2.h:25
std::shared_ptr< APICSolver2 > APICSolver2Ptr
Shared pointer type for the APICSolver2.
Definition: APICSolver2.h:58
APICSolver2()
Default constructor.
Front-end to create APICSolver2 objects step by step.
Definition: APICSolver2.h:63
1-D array class.
Definition: Array1.h:29
Definition: pybind11Utils.h:24
void TransferFromParticlesToGrids() override
Transfers velocity field from particles to grids.
void TransferFromGridsToParticles() override
Transfers velocity field from grids to particles.
virtual ~APICSolver2()
Default destructor.
2-D vector class.
Definition: Vector2.h:26