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 :
8 : #include "DataStructures/Variables.hpp"
9 : #include "Evolution/Systems/ScalarAdvection/Fluxes.hpp"
10 : #include "Utilities/Gsl.hpp"
11 : #include "Utilities/TMPL.hpp"
12 :
13 1 : namespace ScalarAdvection::subcell {
14 : namespace detail {
15 : /*!
16 : * \brief Helper function that calls `ScalarAdvection::Fluxes::apply` by
17 : * retrieving the return and argument tags from the Variables object `vars`.
18 : */
19 : template <size_t Dim, typename TagsList, typename... ReturnTags,
20 : typename... ArgumentTags>
21 : void compute_fluxes_impl(const gsl::not_null<Variables<TagsList>*> vars,
22 : tmpl::list<ReturnTags...> /*meta*/,
23 : tmpl::list<ArgumentTags...> /*meta*/) {
24 : Fluxes<Dim>::apply(make_not_null(&get<ReturnTags>(*vars))...,
25 : get<ArgumentTags>(*vars)...);
26 : }
27 : } // namespace detail
28 :
29 : /*!
30 : * \brief Compute fluxes for subcell variables.
31 : */
32 : template <size_t Dim, typename TagsList>
33 1 : void compute_fluxes(const gsl::not_null<Variables<TagsList>*> vars) {
34 : detail::compute_fluxes_impl<Dim>(vars, typename Fluxes<Dim>::return_tags{},
35 : typename Fluxes<Dim>::argument_tags{});
36 : }
37 : } // namespace ScalarAdvection::subcell
|