SpECTRE Documentation Coverage Report
Current view: top level - Evolution/DgSubcell - SliceData.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 66.7 % 3 2
Test Date: 2026-10-22 17:29:42
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 <cstddef>
       7              : #include <optional>
       8              : #include <unordered_set>
       9              : #include <utility>
      10              : 
      11              : #include "DataStructures/DataVector.hpp"
      12              : #include "DataStructures/Variables.hpp"
      13              : #include "Domain/Structure/Direction.hpp"
      14              : #include "Domain/Structure/DirectionalId.hpp"
      15              : #include "Domain/Structure/DirectionalIdMap.hpp"
      16              : #include "Domain/Structure/ElementId.hpp"
      17              : #include "NumericalAlgorithms/Interpolation/IrregularInterpolant.hpp"
      18              : #include "Utilities/Gsl.hpp"
      19              : 
      20              : /// \cond
      21              : template <size_t Dim>
      22              : class Direction;
      23              : template <size_t Dim, typename T>
      24              : class DirectionMap;
      25              : template <size_t Dim>
      26              : class Index;
      27              : /// \endcond
      28              : 
      29              : namespace evolution::dg::subcell {
      30              : namespace detail {
      31              : template <size_t Dim>
      32              : DirectionMap<Dim, DataVector> slice_data_impl(
      33              :     const gsl::span<const double>& volume_subcell_vars,
      34              :     const Index<Dim>& subcell_extents, size_t number_of_ghost_points,
      35              :     const std::unordered_set<Direction<Dim>>& directions_to_slice,
      36              :     size_t additional_buffer,
      37              :     const DirectionalIdMap<Dim, std::optional<intrp::Irregular<Dim>>>&
      38              :         fd_to_neighbor_fd_interpolants);
      39              : }  // namespace detail
      40              : 
      41              : /// @{
      42              : /*!
      43              :  * \brief Slice the subcell variables needed for neighbors to perform
      44              :  * reconstruction.
      45              :  *
      46              :  * Note that we slice to a grid that is against the boundary of the element but
      47              :  * is several ghost points deep. This is in contrast to the slicing used in the
      48              :  * DG method which is to the boundary of the element only.
      49              :  *
      50              :  * The `number_of_ghost_points` will depend on the number of neighboring points
      51              :  * the reconstruction method needs that is used on the subcell. The
      52              :  * `directions_to_slice` determines in which directions data is sliced.
      53              :  * Generally this will be the directions in which the element has neighbors.
      54              :  *
      55              :  * The data always has the same ordering as the volume data (tags have the same
      56              :  * ordering, grid points are x-varies-fastest).
      57              :  *
      58              :  * The `additional_buffer` argument is used to add extra padding to the result
      59              :  * storage to be used for example for sending the RDMP TCI data. This eliminates
      60              :  * expensive data copying.
      61              :  */
      62              : template <size_t Dim>
      63            1 : DirectionMap<Dim, DataVector> slice_data(
      64              :     const DataVector& volume_subcell_vars, const Index<Dim>& subcell_extents,
      65              :     const size_t number_of_ghost_points,
      66              :     const std::unordered_set<Direction<Dim>>& directions_to_slice,
      67              :     const size_t additional_buffer,
      68              :     const DirectionalIdMap<Dim, std::optional<intrp::Irregular<Dim>>>&
      69              :         fd_to_neighbor_fd_interpolants) {
      70              :   return detail::slice_data_impl(
      71              :       gsl::make_span(volume_subcell_vars.data(), volume_subcell_vars.size()),
      72              :       subcell_extents, number_of_ghost_points, directions_to_slice,
      73              :       additional_buffer, fd_to_neighbor_fd_interpolants);
      74              : }
      75              : 
      76              : template <size_t Dim, typename TagList>
      77            1 : DirectionMap<Dim, DataVector> slice_data(
      78              :     const Variables<TagList>& volume_subcell_vars,
      79              :     const Index<Dim>& subcell_extents, const size_t number_of_ghost_points,
      80              :     const std::unordered_set<Direction<Dim>>& directions_to_slice,
      81              :     const size_t additional_buffer,
      82              :     const DirectionalIdMap<Dim, std::optional<intrp::Irregular<Dim>>>&
      83              :         fd_to_neighbor_fd_interpolants) {
      84              :   // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
      85              :   const DataVector view{const_cast<double*>(volume_subcell_vars.data()),
      86              :                         volume_subcell_vars.size()};
      87              :   return slice_data(view, subcell_extents, number_of_ghost_points,
      88              :                     directions_to_slice, additional_buffer,
      89              :                     fd_to_neighbor_fd_interpolants);
      90              : }
      91              : /// @}
      92              : }  // namespace evolution::dg::subcell
        

Generated by: LCOV version 2.0-1