ComputeTimeDerivative.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <tuple>
7 
10 #include "DataStructures/DataBox/PrefixHelpers.hpp"
12 #include "Utilities/Gsl.hpp"
13 #include "Utilities/Requires.hpp"
14 #include "Utilities/TMPL.hpp"
15 
16 /// \cond
17 // IWYU pragma: no_forward_declare db::DataBox
18 namespace tuples {
19 template <typename...>
20 class TaggedTuple; // IWYU pragma: keep
21 } // namespace tuples
22 
23 namespace Parallel {
24 template <typename Metavariables>
25 class GlobalCache;
26 } // namespace Parallel
27 /// \endcond
28 
29 namespace Actions {
30 /*!
31  * \ingroup ActionsGroup
32  * \ingroup DiscontinuousGalerkinGroup
33  * \brief Compute the time derivative of the system variables
34  *
35  * Uses:
36  * - Metavariables:
37  * - `temporal_id::step_prefix`
38  * - DataBox:
39  * - `TimeDerivativeComputer::argument_tags<step_prefix>`
40  *
41  * DataBox changes:
42  * - Modifies:
43  * - `TimeDerivativeComputer::return_tags<step_prefix>`
44  */
45 template <typename TimeDerivativeComputer>
47  template <typename DbTagsList, typename... InboxTags, typename Metavariables,
48  typename ArrayIndex, typename ActionList,
49  typename ParallelComponent,
54  const Parallel::GlobalCache<Metavariables>& /*cache*/,
55  const ArrayIndex& /*array_index*/, ActionList /*meta*/,
56  const ParallelComponent* const /*meta*/) noexcept { // NOLINT const
57  // Notes:
58  // - dt_variables is not zeroed and the operator cannot assume this.
59  // - We retrieve the `step_prefix` from the `Metavariables` (as opposed to
60  // hard-coding `Tags::dt`) to retain consistency with other actions that do
61  // the same (for instance `dg::Actions::ApplyFluxes` that is not specific to
62  // evolution systems)
63  db::mutate_apply<typename TimeDerivativeComputer::template return_tags<
64  Metavariables::temporal_id::template step_prefix>,
65  typename TimeDerivativeComputer::argument_tags>(
66  TimeDerivativeComputer{}, make_not_null(&box));
67  return std::forward_as_tuple(std::move(box));
68  }
69 };
70 } // namespace Actions
DataBoxTag.hpp
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
tuple
db::apply
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1424
DataBox.hpp
db::mutate_apply
constexpr auto mutate_apply(F &&f, const gsl::not_null< DataBox< BoxTags > * > box, Args &&... args) noexcept(DataBox_detail::check_mutate_apply_mutate_tags(BoxTags{}, MutateTags{}) and DataBox_detail::check_mutate_apply_argument_tags(BoxTags{}, ArgumentTags{}) and noexcept(DataBox_detail::mutate_apply(f, box, MutateTags{}, ArgumentTags{}, std::forward< Args >(args)...)))
Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and a...
Definition: DataBox.hpp:1640
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Actions::ComputeTimeDerivative
Compute the time derivative of the system variables.
Definition: ComputeTimeDerivative.hpp:46
Gsl.hpp
Requires.hpp
make_not_null
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion,...
Definition: Gsl.hpp:880
Requires
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t
Definition: Requires.hpp:67
Prefixes.hpp
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Parallel
Contains functions that forward to Charm++ parallel functions.
Definition: ElementReceiveInterpPoints.hpp:14
TMPL.hpp