LinearSolver::multigrid Namespace Reference

## Functions

template<size_t Dim>
std::vector< std::array< size_t, Dim > > coarsen (std::vector< std::array< size_t, Dim >> initial_refinement_levels) noexcept
Coarsen the initial refinement levels of all blocks in the domain. More...

template<size_t Dim>
ElementId< Dim > parent_id (const ElementId< Dim > &child_id) noexcept
The element covering the child_id on the coarser grid. More...

template<size_t Dim>
std::unordered_set< ElementId< Dim > > child_ids (const ElementId< Dim > &parent_id, const std::array< size_t, Dim > &children_refinement_levels) noexcept
The elements covering the parent_id on the finer grid. More...

## Detailed Description

Items related to the multigrid linear solver

## ◆ child_ids()

template<size_t Dim>
 std::unordered_set > LinearSolver::multigrid::child_ids ( const ElementId< Dim > & parent_id, const std::array< size_t, Dim > & children_refinement_levels )
noexcept

The elements covering the parent_id on the finer grid.

Template Parameters
 Dim The spatial dimension of the domain
Parameters
 parent_id The ID of an element on the coarser grid children_refinement_levels The refinement level of the finer grid in this block

Returns: std::unordered_set<ElementId<Dim>> The IDs of the elements on the finer grid that cover the parent_id. Returns an empty set if the parent_id is already on the finest grid. Else, returns at least one child (if the grids have the same refinement levels) and at most $$2^\mathrm{Dim}$$ children (if the grid is finer in every dimension).

## ◆ coarsen()

template<size_t Dim>
 std::vector > LinearSolver::multigrid::coarsen ( std::vector< std::array< size_t, Dim >> initial_refinement_levels )
noexcept

Coarsen the initial refinement levels of all blocks in the domain.

Simply decrement the refinement level uniformly over the entire domain. Doesn't do anything for blocks that are already fully coarsened, so if the return value equals the input argument the entire domain is fully coarsened. Decrementing the refinement level means combining two elements into one, thereby halving the number of elements per dimension.

Template Parameters
 Dim The spatial dimension of the domain
Parameters
 initial_refinement_levels The refinement level in each block of the domain and in every dimension.

Returns: std::vector<std::array<size_t, Dim>> The coarsened refinement levels by decrementing every entry in initial_refinement_levels unless it is already zero.

## ◆ parent_id()

template<size_t Dim>
 ElementId LinearSolver::multigrid::parent_id ( const ElementId< Dim > & child_id )
noexcept

The element covering the child_id on the coarser grid.

Template Parameters
 Dim The spatial dimension of the domain
Parameters
 child_id The ID of an element on the finer grid

Returns: ElementId<Dim> The ID of the element on the coarser grid that covers the child_id. This parent element covers at most two child elements per dimension.