FDMMGSolver2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: FDMMGSolver2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: 2-D finite difference-type linear system solver using Multigrid.
6 > Created Time: 2017/11/03
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_FDM_MG_SOLVER2_H
10 #define CUBBYFLOW_FDM_MG_SOLVER2_H
11 
14 #include <Core/Utils/MG.h>
15 
16 namespace CubbyFlow
17 {
20  {
21  public:
24  size_t maxNumberOfLevels,
25  unsigned int numberOfRestrictionIter = 5,
26  unsigned int numberOfCorrectionIter = 5,
27  unsigned int numberOfCoarsestIter = 20,
28  unsigned int numberOfFinalIter = 20,
29  double maxTolerance = 1e-9,
30  double sorFactor = 1.5,
31  bool useRedBlackOrdering = false);
32 
34  const MGParameters<FDMBLAS2>& GetParams() const;
35 
37  double GetSORFactor() const;
38 
40  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 }
57 
58 #endif
Linear system (Ax=b) for 2-D finite differencing.
Definition: FDMLinearSystem2.h:39
2-D finite difference-type linear system solver using Multigrid.
Definition: FDMMGSolver2.h:19
double GetSORFactor() const
Returns the SOR (Successive Over Relaxation) factor.
bool GetUseRedBlackOrdering() const
Returns true if red-black ordering is enabled.
Definition: pybind11Utils.h:24
std::shared_ptr< FDMMGSolver2 > FDMMGSolver2Ptr
Shared pointer type for the FDMMGSolver2.
Definition: FDMMGSolver2.h: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.h:60
const MGParameters< FDMBLAS2 > & GetParams() const
Returns the Multigrid parameters.
Abstract base class for 2-D finite difference-type linear system solver.
Definition: FDMLinearSystemSolver2.h:17
Multigrid-syle 2-D linear system.
Definition: FDMMGLinearSystem2.h:24
bool Solve(FDMLinearSystem2 *system) final
No-op. Multigrid-type solvers do not solve FDMLinearSystem2.