SwapGrTags.hpp
1 // 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/Systems/GrMhd/ValenciaDivClean/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 
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 struct SwapGrTags {
43  using return_tags = tmpl::list<typename System::spacetime_variables_tag,
46  using argument_tags =
47  tmpl::list<::domain::Tags::Mesh<3>, evolution::dg::subcell::Tags::Mesh<3>,
49 
50  static void apply(
52  Variables<typename System::spacetime_variables_tag::tags_list>*>
53  active_gr_vars,
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) noexcept;
59 };
60 } // namespace grmhd::ValenciaDivClean::subcell
grmhd::ValenciaDivClean::subcell::SwapGrTags
Swaps the inactive and active GR variables.
Definition: SwapGrTags.hpp:42
grmhd::ValenciaDivClean::subcell
Code required by the DG-subcell/FD hybrid solver.
Definition: ComputeFluxes.hpp:11
Tags.hpp
Tags::Variables
Definition: VariablesTag.hpp:21
evolution::dg::subcell::ActiveGrid
ActiveGrid
Definition: ActiveGrid.hpp:11
cstddef
evolution::dg::subcell::Tags::ActiveGrid
The grid currently used for the DG-subcell evolution on the element.
Definition: ActiveGrid.hpp:11
evolution::dg::subcell::Tags::Mesh
The mesh on the subcells.
Definition: Mesh.hpp:19
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:49
evolution::dg::subcell::Tags::Inactive
Mark a tag as holding data for the inactive grid.
Definition: Inactive.hpp:23
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13