FDMMGLinearSystem2.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_FDM_MG_LINEAR_SYSTEM2_HPP
12 #define CUBBYFLOW_FDM_MG_LINEAR_SYSTEM2_HPP
13 
15 #include <Core/Utils/MG.hpp>
16 
17 namespace CubbyFlow
18 {
21 
24 
27 {
29  void Clear();
30 
32  [[nodiscard]] size_t GetNumberOfLevels() const;
33 
35  void ResizeWithCoarsest(const Vector2UZ& coarsestResolution,
36  size_t numberOfLevels);
37 
48  void ResizeWithFinest(const Vector2UZ& finestResolution,
49  size_t maxNumberOfLevels);
50 
53 
56 
59 };
60 
63 {
64  public:
66  static void Restrict(const FDMVector2& finer, FDMVector2* coarser);
67 
69  static void Correct(const FDMVector2& coarser, FDMVector2* finer);
70 
72  template <typename T>
73  static void ResizeArrayWithCoarsest(const Vector2UZ& coarsestResolution,
74  size_t numberOfLevels,
75  std::vector<Array2<T>>* levels);
76 
88  template <typename T>
89  static void ResizeArrayWithFinest(const Vector2UZ& finestResolution,
90  size_t maxNumberOfLevels,
91  std::vector<Array2<T>>* levels);
92 };
93 } // namespace CubbyFlow
94 
96 
97 #endif
FDMMGVector2 b
The RHS vector.
Definition: FDMMGLinearSystem2.hpp:58
void ResizeWithFinest(const Vector2UZ &finestResolution, size_t maxNumberOfLevels)
Resizes the system with the finest resolution and max number of levels.
size_t GetNumberOfLevels() const
Returns the number of multigrid levels.
void Clear()
Clears the linear system.
void ResizeWithCoarsest(const Vector2UZ &coarsestResolution, size_t numberOfLevels)
Resizes the system with the coarsest resolution and number of levels.
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
Definition: Array-Impl.hpp:19
FDMMGVector2 x
The solution vector.
Definition: FDMMGLinearSystem2.hpp:55
FDMMGMatrix2 A
The system matrix.
Definition: FDMMGLinearSystem2.hpp:52
Multigrid-syle 2-D linear system.
Definition: FDMMGLinearSystem2.hpp:26
Multigrid utilities for 2-D FDM system.
Definition: FDMMGLinearSystem2.hpp:62