11 #ifndef CUBBYFLOW_MULTI_GRID_HPP 12 #define CUBBYFLOW_MULTI_GRID_HPP 19 template <
typename BlasType>
22 std::vector<typename BlasType::MatrixType>
levels;
23 const typename BlasType::MatrixType&
operator[](
size_t i)
const;
24 typename BlasType::MatrixType&
operator[](
size_t i);
25 [[nodiscard]]
const typename BlasType::MatrixType&
Finest()
const;
26 [[nodiscard]]
typename BlasType::MatrixType&
Finest();
30 template <
typename BlasType>
33 std::vector<typename BlasType::VectorType>
levels;
34 const typename BlasType::VectorType&
operator[](
size_t i)
const;
35 typename BlasType::VectorType&
operator[](
size_t i);
36 [[nodiscard]]
const typename BlasType::VectorType&
Finest()
const;
37 [[nodiscard]]
typename BlasType::VectorType&
Finest();
41 template <
typename BlasType>
43 const typename BlasType::MatrixType& A,
44 const typename BlasType::VectorType& b,
unsigned int numberOfIterations,
45 double maxTolerance,
typename BlasType::VectorType* x,
46 typename BlasType::VectorType* buffer)>;
49 template <
typename BlasType>
51 std::function<void(
const typename BlasType::VectorType& finer,
52 typename BlasType::VectorType* coarser)>;
55 template <
typename BlasType>
57 std::function<void(
const typename BlasType::VectorType& coarser,
58 typename BlasType::VectorType* finer)>;
61 template <
typename BlasType>
65 size_t maxNumberOfLevels = 1;
68 unsigned int numberOfRestrictionIter = 5;
71 unsigned int numberOfCorrectionIter = 5;
74 unsigned int numberOfCoarsestIter = 20;
77 unsigned int numberOfFinalIter = 20;
89 double maxTolerance = 1e-9;
105 template <
typename BlasType>
std::vector< typename BlasType::VectorType > levels
Definition: MG.hpp:33
std::function< void(const typename BlasType::VectorType &finer, typename BlasType::VectorType *coarser)> MGRestrictFunc
Multi-grid restriction function type.
Definition: MG.hpp:52
std::vector< typename BlasType::MatrixType > levels
Definition: MG.hpp:22
MGResult MGVCycle(const MGMatrix< BlasType > &A, MGParameters< BlasType > params, MGVector< BlasType > *x, MGVector< BlasType > *b, MGVector< BlasType > *buffer)
Performs Multi-grid with V-cycle.
Definition: MG-Impl.hpp:131
MGRelaxFunc< BlasType > relaxFunc
Relaxation function such as Jacobi or Gauss-Seidel.
Definition: MG.hpp:80
const BlasType::MatrixType & Finest() const
Definition: MG-Impl.hpp:94
std::function< void(const typename BlasType::MatrixType &A, const typename BlasType::VectorType &b, unsigned int numberOfIterations, double maxTolerance, typename BlasType::VectorType *x, typename BlasType::VectorType *buffer)> MGRelaxFunc
Multi-grid relax function type.
Definition: MG.hpp:46
std::function< void(const typename BlasType::VectorType &coarser, typename BlasType::VectorType *finer)> MGCorrectFunc
Multi-grid correction function type.
Definition: MG.hpp:58
Multi-grid matrix wrapper.
Definition: MG.hpp:20
Multi-grid result type.
Definition: MG.hpp:93
Definition: pybind11Utils.hpp:20
double lastResidualNorm
Lastly measured norm of residual.
Definition: MG.hpp:96
Multi-grid vector wrapper.
Definition: MG.hpp:31
Multi-grid input parameter set.
Definition: MG.hpp:62
MGCorrectFunc< BlasType > correctFunc
Correction function that maps coarser to finer grid.
Definition: MG.hpp:86
const BlasType::MatrixType & operator[](size_t i) const
Definition: MG-Impl.hpp:81
MGRestrictFunc< BlasType > restrictFunc
Restrict function that maps finer to coarser grid.
Definition: MG.hpp:83