15 #include "DataStructures/DataBox/PrefixHelpers.hpp"
17 #include "DataStructures/DataBox/Tag.hpp"
18 #include "DataStructures/DataVector.hpp"
20 #include "DataStructures/VariablesTag.hpp"
26 #include "Utilities/TaggedTuple.hpp"
28 namespace TestHelpers {
34 template <
typename FluxesComputer,
typename... PrimalFields,
35 typename... AuxiliaryFields,
typename... PrimalFluxes,
36 typename... AuxiliaryFluxes,
typename... FluxesArgsTags>
37 void test_first_order_fluxes_computer_impl(
38 const DataVector& used_for_size, tmpl::list<PrimalFields...> ,
39 tmpl::list<AuxiliaryFields...> ,
40 tmpl::list<PrimalFluxes...> ,
41 tmpl::list<AuxiliaryFluxes...> ,
42 tmpl::list<FluxesArgsTags...> ) {
45 using VarsType =
typename vars_tag::type;
48 using FluxesType =
typename fluxes_tag::type;
54 const auto vars = make_with_random_values<VarsType>(
59 make_with_random_values<typename FluxesArgsTags::type>(
63 FluxesType expected_fluxes{used_for_size.size()};
64 FluxesComputer::apply(
make_not_null(&get<PrimalFluxes>(expected_fluxes))...,
65 get<FluxesArgsTags>(fluxes_args)...,
66 get<AuxiliaryFields>(vars)...);
67 FluxesComputer::apply(
69 get<FluxesArgsTags>(fluxes_args)..., get<PrimalFields>(vars)...);
75 make_with_value<typename fluxes_tag::type>(
77 get<FluxesArgsTags>(fluxes_args)...);
81 tmpl::list<FluxesArgsTags..., AuxiliaryFields...>>(
84 tmpl::list<FluxesArgsTags..., PrimalFields...>>(
86 CHECK(expected_fluxes == get<fluxes_tag>(box));
101 template <
typename System>
103 detail::test_first_order_fluxes_computer_impl<
104 typename System::fluxes_computer>(
105 used_for_size,
typename System::primal_fields{},
106 typename System::auxiliary_fields{},
typename System::primal_fluxes{},
107 typename System::auxiliary_fluxes{},
108 typename System::fluxes_computer::argument_tags{});
113 template <
typename SourcesComputer,
typename... PrimalFields,
114 typename... AuxiliaryFields,
typename... PrimalFluxes,
115 typename... SourcesArgsTags>
116 void test_first_order_sources_computer_impl(
117 const DataVector& used_for_size, tmpl::list<PrimalFields...> ,
118 tmpl::list<AuxiliaryFields...> ,
119 tmpl::list<PrimalFluxes...> ,
120 tmpl::list<SourcesArgsTags...> ) {
123 using VarsType =
typename vars_tag::type;
125 using FluxesType =
typename fluxes_tag::type;
127 using SourcesType =
typename sources_tag::type;
136 const auto vars = make_with_random_values<VarsType>(
138 const auto fluxes = make_with_random_values<FluxesType>(
143 make_with_random_values<typename SourcesArgsTags::type>(
147 SourcesType expected_sources{used_for_size.size(), 0.};
148 SourcesComputer::apply(
150 get<SourcesArgsTags>(sources_args)..., get<PrimalFields>(vars)...);
151 SourcesComputer::apply(
153 get<SourcesArgsTags>(sources_args)..., get<PrimalFields>(vars)...,
154 get<PrimalFluxes>(fluxes)...);
160 make_with_value<typename sources_tag::type>(used_for_size, 0.),
161 get<SourcesArgsTags>(sources_args)...);
164 db::mutate_apply<tmpl::list<::Tags::Source<AuxiliaryFields>...>,
165 tmpl::list<SourcesArgsTags..., PrimalFields...>>(
168 tmpl::list<::Tags::Source<PrimalFields>...>,
169 tmpl::list<SourcesArgsTags..., PrimalFields..., PrimalFluxes...>>(
171 CHECK(expected_sources == get<sources_tag>(box));
186 template <
typename System>
188 using sources_computer =
typename System::sources_computer;
189 detail::test_first_order_sources_computer_impl<sources_computer>(
190 used_for_size,
typename System::primal_fields{},
191 typename System::auxiliary_fields{},
typename System::primal_fluxes{},
192 typename sources_computer::argument_tags{});