Multigrid solver for linear systems. More...
#include <multigrid.hpp>
Public Types | |
| using | OperatorType = OperatorT |
| Operator type to be solved. | |
| using | ProlongationType = ProlongationT |
| Prolongation operator type. | |
| using | RestrictionType = RestrictionT |
| Restriction operator type. | |
| using | SmootherType = SmootherT |
| Smoother type. | |
| using | CoarseGridSolverType = CoarseGridSolverT |
| Coarse grid solver type. | |
| using | SolutionVectorType = SrcOf< OperatorType > |
| Solution vector type. | |
| using | RHSVectorType = DstOf< OperatorType > |
| Right-hand side vector type. | |
| using | ScalarType = SolutionVectorType::ScalarType |
| Scalar type for computations. | |
Public Member Functions | |
| Multigrid (const std::vector< ProlongationType > &P_additive, const std::vector< RestrictionType > &R, const std::vector< OperatorT > &A_c, const std::vector< SolutionVectorType > &tmp_r, const std::vector< SolutionVectorType > &tmp_e, const std::vector< SolutionVectorType > &tmp, const std::vector< SmootherType > &smoothers_pre, const std::vector< SmootherType > &smoothers_post, const CoarseGridSolverType &coarse_grid_solver, int num_cycles, ScalarType relative_residual_threshold) | |
| Construct a multigrid solver. | |
| void | set_tag (const std::string &tag) |
| Set a tag string for statistics output. | |
| void | collect_statistics (const std::shared_ptr< util::Table > &statistics) |
| Collect statistics in a shared table. | |
| void | solve_impl (OperatorType &A, SolutionVectorType &x, const RHSVectorType &b) |
| Solve the linear system using multigrid cycles. Calls the recursive V-cycle and updates statistics. | |
Multigrid solver for linear systems.
Satisfies the SolverLike concept (see solver.hpp). Supports arbitrary operators, prolongation/restriction, smoothers, and coarse grid solvers. Implements recursive V-cycle multigrid.
| OperatorT | Operator type (must satisfy OperatorLike). |
| ProlongationT | Prolongation operator type (must satisfy OperatorLike). |
| RestrictionT | Restriction operator type (must satisfy OperatorLike). |
| SmootherT | Smoother type (must satisfy SolverLike). |
| CoarseGridSolverT | Coarse grid solver type (must satisfy SolverLike). |
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::CoarseGridSolverType = CoarseGridSolverT |
Coarse grid solver type.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::OperatorType = OperatorT |
Operator type to be solved.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::ProlongationType = ProlongationT |
Prolongation operator type.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::RestrictionType = RestrictionT |
Restriction operator type.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::RHSVectorType = DstOf< OperatorType > |
Right-hand side vector type.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::ScalarType = SolutionVectorType::ScalarType |
Scalar type for computations.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::SmootherType = SmootherT |
Smoother type.
| using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::SolutionVectorType = SrcOf< OperatorType > |
Solution vector type.
|
inline |
Construct a multigrid solver.
Vector ordering of arguments always goes from the coarsest level (index 0) to the finest.
| P_additive | Prolongation operators for each coarse level. Size must match the number of levels - 1. Must be additive prolongation operators, i.e., apply( P, x, y )
void apply(LinearForm &L, typename LinearForm::DstVectorType &dst) Apply a linear form and write to a destination vector. Definition linear_form.hpp:37 |
| R | Restriction operators for each coarse level. |
| A_c | Coarse grid operators for each coarse level. |
| tmp_r | Temporary residual vectors for each coarse level. |
| tmp_e | Temporary error vectors for each coarse level. |
| tmp | Temporary workspace vectors for each level (including the finest level). |
| smoothers_pre | Pre-smoothers for each level (including the finest level). |
| smoothers_post | Post-smoothers for each level (including the finest level). |
| coarse_grid_solver | Coarse grid solver. |
| num_cycles | Number of multigrid cycles to perform. |
| relative_residual_threshold | Relative residual threshold for stopping. |
|
inline |
Collect statistics in a shared table.
| statistics | Shared pointer to statistics table. |
|
inline |
Set a tag string for statistics output.
| tag | Tag string. |
|
inline |
Solve the linear system using multigrid cycles. Calls the recursive V-cycle and updates statistics.
| A | Operator (matrix). |
| x | Solution vector (output). |
| b | Right-hand side vector (input). |