FDMMGSolver3.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_SOLVER3_HPP
12 #define CUBBYFLOW_FDM_MG_SOLVER3_HPP
13 
16 #include <Core/Utils/MG.hpp>
17 
18 namespace CubbyFlow
19 {
22 {
23  public:
25  FDMMGSolver3(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<FDMBLAS3>& GetParams() const;
35 
37  [[nodiscard]] double GetSORFactor() const;
38 
40  [[nodiscard]] bool GetUseRedBlackOrdering() const;
41 
43  bool Solve(FDMLinearSystem3* system) final;
44 
46  virtual bool Solve(FDMMGLinearSystem3* system);
47 
48  private:
49  MGParameters<FDMBLAS3> m_mgParams;
50  double m_sorFactor;
51  bool m_useRedBlackOrdering;
52 };
53 
55 using FDMMGSolver3Ptr = std::shared_ptr<FDMMGSolver3>;
56 } // namespace CubbyFlow
57 
58 #endif
bool GetUseRedBlackOrdering() const
Returns true if red-black ordering is enabled.
Abstract base class for 3-D finite difference-type linear system solver.
Definition: FDMLinearSystemSolver3.hpp:19
FDMMGSolver3(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.
3-D finite difference-type linear system solver using Multigrid.
Definition: FDMMGSolver3.hpp:21
double GetSORFactor() const
Returns the SOR (Successive Over Relaxation) factor.
std::shared_ptr< FDMMGSolver3 > FDMMGSolver3Ptr
Shared pointer type for the FDMMGSolver3.
Definition: FDMMGSolver3.hpp:55
const MGParameters< FDMBLAS3 > & GetParams() const
Returns the Multigrid parameters.
Definition: pybind11Utils.hpp:20
bool Solve(FDMLinearSystem3 *system) final
No-op. Multigrid-type solvers do not solve FDMLinearSystem3.
Multi-grid input parameter set.
Definition: MG.hpp:62
Multigrid-syle 3-D linear system.
Definition: FDMMGLinearSystem3.hpp:26
Linear system (Ax=b) for 3-D finite differencing.
Definition: FDMLinearSystem3.hpp:43