FDMMGLinearSystem2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: FDMMGLinearSystem2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Multigrid-syle 2-D linear system.
6 > Created Time: 2017/11/02
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_FDM_MG_LINEAR_SYSTEM2_H
10 #define CUBBYFLOW_FDM_MG_LINEAR_SYSTEM2_H
11 
13 #include <Core/Utils/MG.h>
14 
15 namespace CubbyFlow
16 {
19 
22 
25  {
28 
31 
34 
36  void Clear();
37 
39  size_t GetNumberOfLevels() const;
40 
42  void ResizeWithCoarsest(const Size2& coarsestResolution, size_t numberOfLevels);
43 
53  void ResizeWithFinest(const Size2& finestResolution, size_t maxNumberOfLevels);
54  };
55 
58  {
59  public:
61  static void Restrict(const FDMVector2& finer, FDMVector2* coarser);
62 
64  static void Correct(const FDMVector2& coarser, FDMVector2* finer);
65 
67  template <typename T>
68  static void ResizeArrayWithCoarsest(const Size2& coarsestResolution,
69  size_t numberOfLevels, std::vector<Array2<T>>* levels);
70 
80  template <typename T>
81  static void ResizeArrayWithFinest(const Size2& finestResolution,
82  size_t maxNumberOfLevels, std::vector<Array2<T>>* levels);
83  };
84 }
85 
87 
88 #endif
FDMMGVector2 b
The RHS vector.
Definition: FDMMGLinearSystem2.h:33
static void ResizeArrayWithFinest(const Size2 &finestResolution, size_t maxNumberOfLevels, std::vector< Array2< T >> *levels)
Resizes the array with the finest resolution and max number of levels.
Definition: FDMMGLinearSystem2-Impl.h:34
size_t GetNumberOfLevels() const
Returns the number of multigrid levels.
void Clear()
Clears the linear system.
2-D point class.
Definition: Point2.h:25
Definition: pybind11Utils.h:24
void ResizeWithFinest(const Size2 &finestResolution, size_t maxNumberOfLevels)
Resizes the system with the finest resolution and max number of levels.
static void ResizeArrayWithCoarsest(const Size2 &coarsestResolution, size_t numberOfLevels, std::vector< Array2< T >> *levels)
Resizes the array with the coarsest resolution and number of levels.
Definition: FDMMGLinearSystem2-Impl.h:15
static void Correct(const FDMVector2 &coarser, FDMVector2 *finer)
Corrects given coarser grid to the finer grid.
FDMMGVector2 x
The solution vector.
Definition: FDMMGLinearSystem2.h:30
static void Restrict(const FDMVector2 &finer, FDMVector2 *coarser)
Restricts given finer grid to the coarser grid.
FDMMGMatrix2 A
The system matrix.
Definition: FDMMGLinearSystem2.h:27
2-D array class.
Definition: Array2.h:42
Multigrid-syle 2-D linear system.
Definition: FDMMGLinearSystem2.h:24
Multigrid utilities for 2-D FDM system.
Definition: FDMMGLinearSystem2.h:57
void ResizeWithCoarsest(const Size2 &coarsestResolution, size_t numberOfLevels)
Resizes the system with the coarsest resolution and number of levels.