Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "DataStructures/Variables.hpp"
7 : #include "Evolution/Systems/ForceFree/Fluxes.hpp"
8 : #include "Utilities/Gsl.hpp"
9 : #include "Utilities/TMPL.hpp"
10 :
11 1 : namespace ForceFree::subcell {
12 : namespace detail {
13 : /*!
14 : * \brief Helper function that calls `ForceFree::Fluxes::apply` by
15 : * retrieving the return and argument tags from the Variables object `vars`.
16 : */
17 : template <typename TagsList, typename... ReturnTags, typename... ArgumentTags>
18 : void compute_fluxes_impl(const gsl::not_null<Variables<TagsList>*> vars,
19 : tmpl::list<ReturnTags...> /*meta*/,
20 : tmpl::list<ArgumentTags...> /*meta*/) {
21 : ForceFree::Fluxes::apply(make_not_null(&get<ReturnTags>(*vars))...,
22 : get<ArgumentTags>(*vars)...);
23 : }
24 : } // namespace detail
25 :
26 : /*!
27 : * \brief Compute fluxes for subcell variables.
28 : */
29 : template <typename TagsList>
30 1 : void compute_fluxes(const gsl::not_null<Variables<TagsList>*> vars) {
31 : detail::compute_fluxes_impl(vars, typename ForceFree::Fluxes::return_tags{},
32 : typename ForceFree::Fluxes::argument_tags{});
33 : }
34 : } // namespace ForceFree::subcell
|