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 "Domain/Tags.hpp"
9 : #include "Evolution/DgSubcell/ActiveGrid.hpp"
10 : #include "Evolution/DgSubcell/Tags/ActiveGrid.hpp"
11 : #include "Evolution/DgSubcell/Tags/Inactive.hpp"
12 : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
13 : #include "Evolution/Particles/MonteCarlo/System.hpp"
14 : #include "Utilities/TMPL.hpp"
15 :
16 : /// \cond
17 : template <size_t Dim>
18 : class Mesh;
19 : namespace gsl {
20 : template <typename T>
21 : class not_null;
22 : } // namespace gsl
23 : template <typename TagsList>
24 : class Variables;
25 : /// \endcond
26 :
27 : namespace Particles::MonteCarlo {
28 : /*!
29 : * \brief Swaps the inactive and active GR variables.
30 : *
31 : * The values on the subcells are at the cell-centers.
32 : *
33 : * It should be possible to reduce memory usage by deallocating the GR variables
34 : * on the DG grid when switching to subcell. However, the opposite case is not
35 : * true since the GR variables are needed on the subcells if a neighbor is using
36 : * subcell in order to compute the neighbor's fluxes.
37 : *
38 : * \note The `active_grid` is the grid we are swapping to, which may be the same
39 : * as the current grid. On output the `active_gr_vars` will match the grid that
40 : * `active_grid` is. This mutator is a no-op if they matched on input.
41 : */
42 1 : struct SwapGrTags {
43 0 : using return_tags = tmpl::list<typename System::spacetime_variables_tag,
44 : evolution::dg::subcell::Tags::Inactive<
45 : typename System::spacetime_variables_tag>>;
46 0 : using argument_tags =
47 : tmpl::list<::domain::Tags::Mesh<3>, evolution::dg::subcell::Tags::Mesh<3>,
48 : evolution::dg::subcell::Tags::ActiveGrid>;
49 :
50 0 : static void apply(
51 : gsl::not_null<
52 : Variables<typename System::spacetime_variables_tag::tags_list>*>
53 : active_gr_vars,
54 : gsl::not_null<typename evolution::dg::subcell::Tags::Inactive<
55 : typename System::spacetime_variables_tag>::type*>
56 : inactive_gr_vars,
57 : const Mesh<3>& dg_mesh, const Mesh<3>& subcell_mesh,
58 : evolution::dg::subcell::ActiveGrid active_grid);
59 : };
60 : } // namespace Particles::MonteCarlo
|