gko::multigrid::UniformCoarsening#

Index-based coarsening with a constant stride. Every coarse_skip-th row (default 2) defines a coarse row, and the aggregation parameter (default true) decides whether each fine row is mapped to its coarse row or only the selected rows are injected. Neither the matrix values nor the mesh geometry are consulted. The class accepts gko::experimental::distributed::Matrix as well as Csr matrices.

template<typename ValueType = default_precision, typename IndexType = int32>
class UniformCoarsening #

Inherits from

  • public gko::LinOp

  • public gko::multigrid::EnableMultigridLevel<default_precision>

UniformCoarsening is a simple coarse grid generation algorithm. It selects the coarse rows by a constant stride coarse_skip over the fine-row index space and builds the coarse system from them. The choice is purely index-based — neither matrix values nor mesh geometry are consulted. Fine row i either contributes only when it is itself a selected coarse row (injection-style), or is mapped to its coarse row floor(i / coarse_skip) (aggregation-style), depending on the aggregation parameter.

Template Parameters:
  • ValueType – precision of matrix elements

  • IndexType – precision of matrix indexes

Public Functions

inline std::shared_ptr<const LinOp> get_system_matrix() const#

Returns the system operator (matrix) of the linear system.

Returns:

the system operator (matrix)

inline IndexType *get_coarse_rows() noexcept#

Returns the selected coarse rows.

Returns:

the selected coarse rows.

inline const IndexType *get_const_coarse_rows() const noexcept#

Returns the selected coarse rows.

Note

This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.

Returns:

the selected coarse rows.

Public Static Functions

static parameters_type parse(
const config::pnode &config,
const config::registry &context,
const config::type_descriptor &td_for_child = config::make_type_descriptor<ValueType, IndexType>(),
)#

Create the parameters from the property_tree. Because this is directly tied to the specific type, the value/index type settings within config are ignored and type_descriptor is only used for children configs.

Parameters:
  • config – the property tree for setting

  • context – the registry

  • td_for_child – the type descriptor for children configs. The default uses the value/index type of this class.

Returns:

parameters

struct parameters_type#

Public Members

int coarse_skip#

The number of rows to skip for the coarse matrix generation

bool aggregation#

When set to true (the default), every fine row i is mapped to its coarse row floor(i / coarse_skip) (aggregation-style), so that the Galerkin coarse matrix R·A·P preserves graph connectivity. When false, only the selected coarse rows (i % coarse_skip == 0) participate (injection-style), which can produce disconnected coarse graphs.

bool skip_sorting#

The system_matrix, which will be given to this factory, must be sorted (first by row, then by column) in order for the algorithm to work. If it is known that the matrix will be sorted, this parameter can be set to true to skip the sorting (therefore, shortening the runtime). However, if it is unknown or if the matrix is known to be not sorted, it must remain false, otherwise, this multigrid_level might be incorrect.