Ginkgo: gko::solver::Multigrid::parameters_type Struct Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::solver::Multigrid::parameters_type Struct Reference
Inheritance diagram for gko::solver::Multigrid::parameters_type:
[legend]
Collaboration diagram for gko::solver::Multigrid::parameters_type:
[legend]

## Public Member Functions
template<typename... Args, typename = std::enable_if_t<::std::conjunction< std::is_convertible<Args, ::gko::deferred_factory_parameter< mg_level_type>>...>::value>>
auto | with_mg_level (Args &&... factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename FactoryType, typename = std::enable_if_t<std::is_convertible< FactoryType, ::gko::deferred_factory_parameter<mg_level_type>>::value>>
auto | with_mg_level (const std::vector< FactoryType > &factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_level_selector (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args, typename = std::enable_if_t<::std::conjunction< std::is_convertible<Args, ::gko::deferred_factory_parameter< pre_smoother_type>>...>::value>>
auto | with_pre_smoother (Args &&... factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename FactoryType, typename = std::enable_if_t<std::is_convertible< FactoryType, ::gko::deferred_factory_parameter<pre_smoother_type>>::value>>
auto | with_pre_smoother (const std::vector< FactoryType > &factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args, typename = std::enable_if_t<::std::conjunction< std::is_convertible<Args, ::gko::deferred_factory_parameter< post_smoother_type>>...>::value>>
auto | with_post_smoother (Args &&... factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename FactoryType, typename = std::enable_if_t<std::is_convertible< FactoryType, ::gko::deferred_factory_parameter<post_smoother_type>>::value>>
auto | with_post_smoother (const std::vector< FactoryType > &factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args, typename = std::enable_if_t<::std::conjunction< std::is_convertible<Args, ::gko::deferred_factory_parameter< mid_smoother_type>>...>::value>>
auto | with_mid_smoother (Args &&... factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename FactoryType, typename = std::enable_if_t<std::is_convertible< FactoryType, ::gko::deferred_factory_parameter<mid_smoother_type>>::value>>
auto | with_mid_smoother (const std::vector< FactoryType > &factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_post_uses_pre (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_mid_case (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_max_levels (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_min_coarse_rows (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args, typename = std::enable_if_t<::std::conjunction< std::is_convertible<Args, ::gko::deferred_factory_parameter< coarsest_solver_type>>...>::value>>
auto | with_coarsest_solver (Args &&... factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename FactoryType, typename = std::enable_if_t<std::is_convertible< FactoryType, ::gko::deferred_factory_parameter<coarsest_solver_type>>::value>>
auto | with_coarsest_solver (const std::vector< FactoryType > &factories) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_solver_selector (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_cycle (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_kcycle_base (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_kcycle_rel_tol (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_smoother_relax (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_smoother_iters (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
template<typename... Args>
auto | with_default_initial_guess (Args &&... _value) -> std::decay_t< decltype(*(this->self()))> &
Public Member Functions inherited from gko::solver::enable_iterative_solver_factory_parameters< parameters_type, Factory >
auto | with_criteria (Args &&... factories) -> std::decay_t< decltype(*(this->self()))> &
Public Member Functions inherited from gko::enable_parameters_type< parameters_type, Factory >
parameters_type & | with_loggers (Args &&... _value)
| Provides the loggers to be added to the factory and its generated objects in a fluent interface.
std::unique_ptr< Factory > | on (std::shared_ptr< const Executor > exec) const
| Creates a new factory on the specified executor.

## Public Attributes
std::vector< std::shared_ptr< const LinOpFactory > > | mg_level {}
| MultigridLevel Factory list.
std::function< size_type(const size_type, const LinOp *)> | level_selector {nullptr}
| Custom selector size_type (size_type level, const LinOp* fine_matrix) Selector function returns the element index in the vector for any given level index and the matrix of the fine level.
std::vector< std::shared_ptr< const LinOpFactory > > | pre_smoother {}
| Pre-smooth Factory list.
std::vector< std::shared_ptr< const LinOpFactory > > | post_smoother {}
| Post-smooth Factory list.
std::vector< std::shared_ptr< const LinOpFactory > > | mid_smoother {}
| Mid-smooth Factory list.
bool | post_uses_pre {true}
| Whether post-smoothing-related calls use corresponding pre-smoothing-related calls.
multigrid::mid_smooth_type | mid_case {multigrid::mid_smooth_type::standalone}
| Choose the behavior of mid smoother between two cycles close to each other in the same level.
size_type | max_levels {10}
| The maximum number of mg_level (without coarsest solver level) that can be used.
size_type | min_coarse_rows {64}
| The minimal number of coarse rows.
std::vector< std::shared_ptr< const LinOpFactory > > | coarsest_solver {}
| Coarsest factory list.
std::function< size_type(const size_type, const LinOp *)> | solver_selector {nullptr}
| Custom coarsest_solver selector size_type (size_type level, const LinOp *coarsest_matrix) Selector function returns the correct element index in the vector for any given level index and the system matrix.
multigrid::cycle | cycle {multigrid::cycle::v}
| Multigrid cycle type.
size_type | kcycle_base {1}
| kcycle_base is a factor to choose how often enable FCG/GCR step.
double | kcycle_rel_tol {0.25}
| kcycle_rel_tol decides whether run the second iteration of FCG/GCR step.
std::complex< double > | smoother_relax {0.9}
| smoother_relax is the relaxation factor of default generated smoother.
size_type | smoother_iters {1}
| smoother_iters is the number of iteration of default generated smoother.
initial_guess_mode | default_initial_guess {initial_guess_mode::zero}
| Default initial guess mode.
Public Attributes inherited from gko::solver::enable_iterative_solver_factory_parameters< parameters_type, Factory >
std::vector< std::shared_ptr< const stop::CriterionFactory > > | criteria
| Stopping criteria to be used by the solver.

## Additional Inherited Members
Public Types inherited from gko::enable_parameters_type< parameters_type, Factory >
using | factory

## Member Data Documentation

## ◆ coarsest_solver

std::vector<std::shared_ptr<const LinOpFactory> > gko::solver::Multigrid::parameters_type::coarsest_solver {}

Coarsest factory list.

If not set, then a direct LU solver will be used as solver on the coarsest level.

## ◆ cycle

multigrid::cycle gko::solver::Multigrid::parameters_type::cycle {multigrid::cycle::v}

Multigrid cycle type.

The default is multigrid::cycle::v.

See also
  enum multigrid::cycle

## ◆ default_initial_guess

initial_guess_mode gko::solver::Multigrid::parameters_type::default_initial_guess {initial_guess_mode::zero}

Default initial guess mode.

The available options are under initial_guess_mode.

## ◆ kcycle_base

size_type gko::solver::Multigrid::parameters_type::kcycle_base {1}

kcycle_base is a factor to choose how often enable FCG/GCR step.

This parameter is ignored on v, w, f cycle. Enable the FCG/GCR step when level % kcycle_base == 0 and the next level is not coarsest level.

Note
  the FCG/GCR step works on the vectors of next level.

## ◆ kcycle_rel_tol

double gko::solver::Multigrid::parameters_type::kcycle_rel_tol {0.25}

kcycle_rel_tol decides whether run the second iteration of FCG/GCR step.

kcycle_rel_tol <= 0: always run one iterations. kcycle_rel_tol == nan: always run two iterations. ||updated_r|| <= kcycle_rel_tol ||r||: run second iteration.

## ◆ level_selector

std::function<size_type(const size_type, const LinOp*)> gko::solver::Multigrid::parameters_type::level_selector {nullptr}

Custom selector size_type (size_type level, const LinOp* fine_matrix) Selector function returns the element index in the vector for any given level index and the matrix of the fine level.

The level 0 is the finest level and it is ascending when going to coarser levels. For each level, this function is used to select the smoothers and multigrid level generation from the respective lists. For example,

[](size_type level, const LinOp* fine_matrix) {
if (level < 3) {
return size_type{0};
} else if (matrix->get_size()[0] > 1024) {
return size_type{1};
} else {
return size_type{2};
}
}
gko::LinOp
Definition lin_op.hpp:117
gko::matrix
The matrix namespace.
Definition dense_cache.hpp:24
gko::size_type
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:90

It uses the 0-idx element if level < 3, the 1-idx element if level >= 3 and the number of rows of fine matrix > 1024, or the 2-idx elements otherwise.

default selector: use the level as the index when the level < mg_level and reuse the last one when the level >= mg_level

## ◆ max_levels

size_type gko::solver::Multigrid::parameters_type::max_levels {10}

The maximum number of mg_level (without coarsest solver level) that can be used.

If the multigrid hit the max_levels limit, including the coarsest solver level contains max_levels + 1 levels.

## ◆ mid_case

multigrid::mid_smooth_type gko::solver::Multigrid::parameters_type::mid_case {multigrid::mid_smooth_type::standalone}

Choose the behavior of mid smoother between two cycles close to each other in the same level.

The default is multigrid::mid_smooth_type::standalone.

See also
  enum multigrid::mid_smooth_type

## ◆ mid_smoother

std::vector<std::shared_ptr<const LinOpFactory> > gko::solver::Multigrid::parameters_type::mid_smoother {}

Mid-smooth Factory list.

If it contains available elements, multigrid always generates the corresponding smoother. However, it is only involved in the procedure when cycle is F or W. It is similar to Pre-smooth Factory list. It is ignored if the factory parameter mid_case is not mid.

## ◆ min_coarse_rows

size_type gko::solver::Multigrid::parameters_type::min_coarse_rows {64}

The minimal number of coarse rows.

If generation gets the matrix which contains less than min_coarse_rows, the generation stops.

## ◆ post_smoother

std::vector<std::shared_ptr<const LinOpFactory> > gko::solver::Multigrid::parameters_type::post_smoother {}

Post-smooth Factory list.

It is similar to Pre-smooth Factory list. It is ignored if the factory parameter post_uses_pre is set to true.

## ◆ pre_smoother

std::vector<std::shared_ptr<const LinOpFactory> > gko::solver::Multigrid::parameters_type::pre_smoother {}

Pre-smooth Factory list.

Its size must be 0, 1 or be the same as mg_level's. when size = 0, use default smoother when size = 1, use the first factory when size > 1, use the same selector as mg_level

If this option is not set (i.e. size = 0) then the default smoother is used. The default smoother is one step of iterative refinement with a scalar Jacobi preconditioner.

If any element in the vector is a nullptr then the smoother application at the corresponding level is skipped.

## ◆ solver_selector

std::function<size_type(const size_type, const LinOp*)> gko::solver::Multigrid::parameters_type::solver_selector {nullptr}

Custom coarsest_solver selector size_type (size_type level, const LinOp *coarsest_matrix) Selector function returns the correct element index in the vector for any given level index and the system matrix.

It can be used to choose the sparse iterative solver if the coarsest matrix is still large but the dense solver if the matrix is small enough. For example,

[](size_type level, const LinOp* coarsest_matrix) {
if (coarsest_matrix->get_size()[0] > 1024) {
return size_type{0};
} else {
return size_type{1};
}
}

Coarsest solver uses the 0-idx element if the number of rows of the coarsest_matrix > 1024 or 1-idx element for other cases.

default selector: use the first factory

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

- ginkgo/core/solver/multigrid.hpp