SelectNumericalMethod.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <tuple>
8 #include <utility>
9 
11 #include "Evolution/DgSubcell/Actions/Labels.hpp"
12 #include "Evolution/DgSubcell/ActiveGrid.hpp"
13 #include "Evolution/DgSubcell/Tags/ActiveGrid.hpp"
14 #include "Parallel/Actions/Goto.hpp"
16 #include "Utilities/TMPL.hpp"
17 
18 /// \cond
19 namespace Parallel {
20 template <typename Metavariables>
21 class GlobalCache;
22 } // namespace Parallel
23 namespace tuples {
24 template <typename...>
25 class TaggedTuple;
26 } // namespace tuples
27 /// \endcond
28 
30 /*!
31  * \brief Goes to `Labels::BeginDg` or `Labels::BeginSubcell` depending on
32  * whether the active grid is `Dg` or `Subcell`.
33  *
34  * GlobalCache: nothing
35  *
36  * DataBox:
37  * - Uses:
38  * - `subcell::Tags::ActiveGrid`
39  */
41  template <typename DbTagsList, typename... InboxTags, typename Metavariables,
42  typename ArrayIndex, typename ActionList,
43  typename ParallelComponent>
44  static std::tuple<db::DataBox<DbTagsList>&&, bool, size_t> apply(
45  db::DataBox<DbTagsList>& box,
46  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
47  const Parallel::GlobalCache<Metavariables>& /*cache*/,
48  const ArrayIndex& /*array_index*/, ActionList /*meta*/,
49  const ParallelComponent* const /*meta*/) noexcept {
50  // Note: we jump to the `Label+1` because the label actions don't do
51  // anything anyway
52  if (db::get<Tags::ActiveGrid>(box) == subcell::ActiveGrid::Dg) {
53  const size_t dg_index =
54  tmpl::index_of<ActionList, ::Actions::Label<Labels::BeginDg>>::value +
55  1;
56  return {std::move(box), false, dg_index};
57  } else if (db::get<Tags::ActiveGrid>(box) == subcell::ActiveGrid::Subcell) {
58  const size_t subcell_index =
59  tmpl::index_of<ActionList,
61  1;
62  return {std::move(box), false, subcell_index};
63  }
64  ERROR(
65  "Only know DG and subcell active grids for selecting the numerical "
66  "method.");
67  }
68 };
69 } // namespace evolution::dg::subcell::Actions
evolution::dg::subcell::Actions
Actions for the DG-subcell hybrid solver.
Definition: Actions.hpp:9
utility
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
Error.hpp
tuple
evolution::dg::subcell::Actions::SelectNumericalMethod
Goes to Labels::BeginDg or Labels::BeginSubcell depending on whether the active grid is Dg or Subcell...
Definition: SelectNumericalMethod.hpp:40
ERROR
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:37
DataBox.hpp
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Actions::Label
Definition: Goto.hpp:38
Parallel
Functionality for parallelization.
Definition: ElementReceiveInterpPoints.hpp:13
TMPL.hpp