Loading...
Searching...
No Matches
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
18namespace 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
35
37 [[nodiscard]] double GetSORFactor() const;
38
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
55using FDMMGSolver2Ptr = std::shared_ptr<FDMMGSolver2>;
56} // namespace CubbyFlow
57
58#endif
Abstract base class for 2-D finite difference-type linear system solver.
Definition FDMLinearSystemSolver2.hpp:20
2-D finite difference-type linear system solver using Multigrid.
Definition FDMMGSolver2.hpp:22
bool Solve(FDMLinearSystem2 *system) final
No-op. Multigrid-type solvers do not solve FDMLinearSystem2.
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.
double GetSORFactor() const
Returns the SOR (Successive Over Relaxation) factor.
const MGParameters< FDMBLAS2 > & GetParams() const
Returns the Multigrid parameters.
bool GetUseRedBlackOrdering() const
Returns true if red-black ordering is enabled.
virtual bool Solve(FDMMGLinearSystem2 *system)
Solves Multigrid linear system.
Definition Matrix.hpp:30
Definition pybind11Utils.hpp:21
std::shared_ptr< FDMMGSolver2 > FDMMGSolver2Ptr
Shared pointer type for the FDMMGSolver2.
Definition FDMMGSolver2.hpp:55
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738
Linear system (Ax=b) for 2-D finite differencing.
Definition FDMLinearSystem2.hpp:41
Multigrid-syle 2-D linear system.
Definition FDMMGLinearSystem2.hpp:27