FDMMGSolver2.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_SOLVER2_HPP
12 #define CUBBYFLOW_FDM_MG_SOLVER2_HPP
13 
16 #include <Core/Utils/MG.hpp>
17 
18 namespace CubbyFlow
19 {
22 {
23  public:
25  FDMMGSolver2(size_t maxNumberOfLevels,
26  unsigned int numberOfRestrictionIter = 5,
27  unsigned int numberOfCorrectionIter = 5,
28  unsigned int numberOfCoarsestIter = 20,
29  unsigned int numberOfFinalIter = 20,
30  double maxTolerance = 1e-9, double sorFactor = 1.5,
31  bool useRedBlackOrdering = false);
32 
34  [[nodiscard]] const MGParameters<FDMBLAS2>& GetParams() const;
35 
37  [[nodiscard]] double GetSORFactor() const;
38 
40  [[nodiscard]] bool GetUseRedBlackOrdering() const;
41 
43  bool Solve(FDMLinearSystem2* system) final;
44 
46  virtual bool Solve(FDMMGLinearSystem2* system);
47 
48  private:
49  MGParameters<FDMBLAS2> m_mgParams;
50  double m_sorFactor;
51  bool m_useRedBlackOrdering;
52 };
53 
55 using FDMMGSolver2Ptr = std::shared_ptr<FDMMGSolver2>;
56 } // namespace CubbyFlow
57 
58 #endif
Linear system (Ax=b) for 2-D finite differencing.
Definition: FDMLinearSystem2.hpp:40
2-D finite difference-type linear system solver using Multigrid.
Definition: FDMMGSolver2.hpp:21
double GetSORFactor() const
Returns the SOR (Successive Over Relaxation) factor.
bool GetUseRedBlackOrdering() const
Returns true if red-black ordering is enabled.
Definition: pybind11Utils.hpp:20
std::shared_ptr< FDMMGSolver2 > FDMMGSolver2Ptr
Shared pointer type for the FDMMGSolver2.
Definition: FDMMGSolver2.hpp:55
FDMMGSolver2(size_t maxNumberOfLevels, unsigned int numberOfRestrictionIter=5, unsigned int numberOfCorrectionIter=5, unsigned int numberOfCoarsestIter=20, unsigned int numberOfFinalIter=20, double maxTolerance=1e-9, double sorFactor=1.5, bool useRedBlackOrdering=false)
Constructs the solver with given parameters.
Multi-grid input parameter set.
Definition: MG.hpp:62
const MGParameters< FDMBLAS2 > & GetParams() const
Returns the Multigrid parameters.
Abstract base class for 2-D finite difference-type linear system solver.
Definition: FDMLinearSystemSolver2.hpp:19
Multigrid-syle 2-D linear system.
Definition: FDMMGLinearSystem2.hpp:26
bool Solve(FDMLinearSystem2 *system) final
No-op. Multigrid-type solvers do not solve FDMLinearSystem2.