SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/LinearSolver/Multigrid - Hierarchy.hpp Hit Total Coverage
Commit: f23e75c235cae5144b8ac7ce01280be5b8cd2c8a Lines: 3 4 75.0 %
Date: 2024-09-07 06:21:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <array>
       7             : #include <cstddef>
       8             : #include <unordered_set>
       9             : #include <vector>
      10             : 
      11             : /// \cond
      12             : template <size_t Dim>
      13             : struct ElementId;
      14             : /// \endcond
      15             : 
      16             : namespace LinearSolver::multigrid {
      17             : 
      18             : /*!
      19             :  * \brief Coarsen the initial refinement levels of all blocks in the domain
      20             :  *
      21             :  * Simply decrement the refinement level uniformly over the entire domain.
      22             :  * Doesn't do anything for blocks that are already fully coarsened, so if the
      23             :  * return value equals the input argument the entire domain is fully coarsened.
      24             :  * Decrementing the refinement level means combining two elements into one,
      25             :  * thereby halving the number of elements per dimension.
      26             :  *
      27             :  * \tparam Dim The spatial dimension of the domain
      28             :  * \param initial_refinement_levels The refinement level in each block of the
      29             :  * domain and in every dimension.
      30             :  * \return std::vector<std::array<size_t, Dim>> The coarsened refinement levels
      31             :  * by decrementing every entry in `initial_refinement_levels` unless it is
      32             :  * already zero.
      33             :  */
      34             : template <size_t Dim>
      35           1 : std::vector<std::array<size_t, Dim>> coarsen(
      36             :     std::vector<std::array<size_t, Dim>> initial_refinement_levels);
      37             : 
      38             : /*!
      39             :  * \brief The element covering the `child_id` on the coarser grid.
      40             :  *
      41             :  * \tparam Dim The spatial dimension of the domain
      42             :  * \param child_id The ID of an element on the finer grid
      43             :  * \return ElementId<Dim> The ID of the element on the coarser grid that
      44             :  * covers the `child_id`. This parent element covers at most two child elements
      45             :  * per dimension.
      46             :  */
      47             : template <size_t Dim>
      48           1 : ElementId<Dim> parent_id(const ElementId<Dim>& child_id);
      49             : 
      50             : /*!
      51             :  * \brief The elements covering the `parent_id` on the finer grid.
      52             :  *
      53             :  * \tparam Dim The spatial dimension of the domain
      54             :  * \param parent_id The ID of an element on the coarser grid
      55             :  * \param children_refinement_levels The refinement level of the finer grid in
      56             :  * this block
      57             :  * \return std::unordered_set<ElementId<Dim>> The IDs of the elements on the
      58             :  * finer grid that cover the `parent_id`. Returns an empty set if the
      59             :  * `parent_id` is already on the finest grid. Else, returns at least one child
      60             :  * (if the grids have the same refinement levels) and at most
      61             :  * \f$2^\mathrm{Dim}\f$ children (if the grid is finer in every dimension).
      62             :  */
      63             : template <size_t Dim>
      64           1 : std::unordered_set<ElementId<Dim>> child_ids(
      65             :     const ElementId<Dim>& parent_id,
      66             :     const std::array<size_t, Dim>& children_refinement_levels);
      67             : 
      68             : }  // namespace LinearSolver::multigrid

Generated by: LCOV version 1.14