SliceData.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <vector>
8 
10 #include "Utilities/Gsl.hpp"
11 
12 /// \cond
13 template <size_t Dim, typename T>
14 class DirectionMap;
15 template <size_t Dim>
16 class Index;
17 /// \endcond
18 
19 namespace evolution::dg::subcell {
20 namespace detail {
21 template <size_t Dim>
23  const gsl::span<const double>& volume_subcell_vars,
24  const Index<Dim>& subcell_extents, size_t number_of_ghost_points,
25  const DirectionMap<Dim, bool>& directions_to_slice) noexcept;
26 } // namespace detail
27 
28 /*!
29  * \brief Slice the subcell variables needed for neighbors to perform
30  * reconstruction.
31  *
32  * Note that we slice to a grid that is against the boundary of the element but
33  * is several ghost points deep. This is in contrast to the slicing used in the
34  * DG method which is to the boundary of the element only.
35  *
36  * The `number_of_ghost_points` will depend on the number of neighboring points
37  * the reconstruction method needs that is used on the subcell. The
38  * `directions_to_slice` determines in which directions data is sliced.
39  * Generally this will be the directions in which the element has neighbors.
40  *
41  * The data always has the same ordering as the volume data (tags have the same
42  * ordering, grid points are x-varies-fastest).
43  */
44 template <size_t Dim, typename TagList>
46  const Variables<TagList>& volume_subcell_vars,
47  const Index<Dim>& subcell_extents, const size_t number_of_ghost_points,
48  const DirectionMap<Dim, bool>& directions_to_slice) noexcept {
49  return detail::slice_data_impl(
50  gsl::make_span(volume_subcell_vars.data(), volume_subcell_vars.size()),
51  subcell_extents, number_of_ghost_points, directions_to_slice);
52 }
53 } // namespace evolution::dg::subcell
vector
Index
Definition: Index.hpp:31
cstddef
Variables.hpp
gsl::span
Create a span/view on a range, which is cheap to copy (one pointer).
Definition: Gsl.hpp:292
DirectionMap
Definition: DirectionMap.hpp:15
gsl::make_span
constexpr span< ElementType > make_span(ElementType *ptr, typename span< ElementType >::index_type count)
Definition: Gsl.hpp:801
evolution::dg::subcell
Implementation of a generic finite volume/conservative finite difference subcell limiter.
Definition: Actions.hpp:6
Gsl.hpp
evolution::dg::subcell::slice_data
DirectionMap< Dim, std::vector< double > > slice_data(const Variables< TagList > &volume_subcell_vars, const Index< Dim > &subcell_extents, const size_t number_of_ghost_points, const DirectionMap< Dim, bool > &directions_to_slice) noexcept
Slice the subcell variables needed for neighbors to perform reconstruction.
Definition: SliceData.hpp:45