Loading...
Searching...
No Matches
terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT > Class Template Reference

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.
 

Detailed Description

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
class terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >

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.

Template Parameters
OperatorTOperator type (must satisfy OperatorLike).
ProlongationTProlongation operator type (must satisfy OperatorLike).
RestrictionTRestriction operator type (must satisfy OperatorLike).
SmootherTSmoother type (must satisfy SolverLike).
CoarseGridSolverTCoarse grid solver type (must satisfy SolverLike).

Member Typedef Documentation

◆ CoarseGridSolverType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::CoarseGridSolverType = CoarseGridSolverT

Coarse grid solver type.

◆ OperatorType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::OperatorType = OperatorT

Operator type to be solved.

◆ ProlongationType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::ProlongationType = ProlongationT

Prolongation operator type.

◆ RestrictionType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::RestrictionType = RestrictionT

Restriction operator type.

◆ RHSVectorType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::RHSVectorType = DstOf< OperatorType >

Right-hand side vector type.

◆ ScalarType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::ScalarType = SolutionVectorType::ScalarType

Scalar type for computations.

◆ SmootherType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::SmootherType = SmootherT

Smoother type.

◆ SolutionVectorType

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
using terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::SolutionVectorType = SrcOf< OperatorType >

Solution vector type.

Constructor & Destructor Documentation

◆ Multigrid()

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::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 
)
inline

Construct a multigrid solver.

Vector ordering of arguments always goes from the coarsest level (index 0) to the finest.

Parameters
P_additiveProlongation 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
computes \( y = y + P x \).
RRestriction operators for each coarse level.
A_cCoarse grid operators for each coarse level.
tmp_rTemporary residual vectors for each coarse level.
tmp_eTemporary error vectors for each coarse level.
tmpTemporary workspace vectors for each level (including the finest level).
smoothers_prePre-smoothers for each level (including the finest level).
smoothers_postPost-smoothers for each level (including the finest level).
coarse_grid_solverCoarse grid solver.
num_cyclesNumber of multigrid cycles to perform.
relative_residual_thresholdRelative residual threshold for stopping.

Member Function Documentation

◆ collect_statistics()

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
void terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::collect_statistics ( const std::shared_ptr< util::Table > &  statistics)
inline

Collect statistics in a shared table.

Parameters
statisticsShared pointer to statistics table.

◆ set_tag()

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
void terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::set_tag ( const std::string &  tag)
inline

Set a tag string for statistics output.

Parameters
tagTag string.

◆ solve_impl()

template<OperatorLike OperatorT, OperatorLike ProlongationT, OperatorLike RestrictionT, SolverLike SmootherT, SolverLike CoarseGridSolverT>
void terra::linalg::solvers::Multigrid< OperatorT, ProlongationT, RestrictionT, SmootherT, CoarseGridSolverT >::solve_impl ( OperatorType A,
SolutionVectorType x,
const RHSVectorType b 
)
inline

Solve the linear system using multigrid cycles. Calls the recursive V-cycle and updates statistics.

Parameters
AOperator (matrix).
xSolution vector (output).
bRight-hand side vector (input).

The documentation for this class was generated from the following file: