APICSolver2.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_APIC_SOLVER2_HPP
12 #define CUBBYFLOW_APIC_SOLVER2_HPP
13 
15 
16 namespace CubbyFlow
17 {
27 class APICSolver2 : public PICSolver2
28 {
29  public:
30  class Builder;
31 
33  APICSolver2();
34 
36  APICSolver2(const Vector2UZ& resolution, const Vector2D& gridSpacing,
37  const Vector2D& gridOrigin);
38 
40  APICSolver2(const APICSolver2&) = delete;
41 
43  APICSolver2(APICSolver2&&) noexcept = delete;
44 
46  ~APICSolver2() override = default;
47 
49  APICSolver2& operator=(const APICSolver2&) = delete;
50 
52  APICSolver2& operator=(APICSolver2&&) noexcept = delete;
53 
55  [[nodiscard]] static Builder GetBuilder();
56 
57  protected:
59  void TransferFromParticlesToGrids() override;
60 
62  void TransferFromGridsToParticles() override;
63 
64  private:
65  Array1<Vector2D> m_cX;
66  Array1<Vector2D> m_cY;
67 };
68 
70 using APICSolver2Ptr = std::shared_ptr<APICSolver2>;
71 
76 {
77  public:
79  [[nodiscard]] APICSolver2 Build() const;
80 
82  [[nodiscard]] APICSolver2Ptr MakeShared() const;
83 };
84 } // namespace CubbyFlow
85 
86 #endif
2-D Particle-in-Cell (PIC) implementation.
Definition: PICSolver2.hpp:30
Base class for grid-based fluid solver builder.
Definition: GridFluidSolver2.hpp:315
static Builder GetBuilder()
Returns builder fox APICSolver2.
APICSolver2 & operator=(const APICSolver2 &)=delete
Deleted copy assignment operator.
2-D Affine Particle-in-Cell (APIC) implementation
Definition: APICSolver2.hpp:27
std::shared_ptr< APICSolver2 > APICSolver2Ptr
Shared pointer type for the APICSolver2.
Definition: APICSolver2.hpp:70
APICSolver2()
Default constructor.
Front-end to create APICSolver2 objects step by step.
Definition: APICSolver2.hpp:75
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
Definition: Array-Impl.hpp:19
void TransferFromParticlesToGrids() override
Transfers velocity field from particles to grids.
void TransferFromGridsToParticles() override
Transfers velocity field from grids to particles.
~APICSolver2() override=default
Default virtual destructor.