MutateApply.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <tuple>
7 
9 #include "Utilities/Requires.hpp"
10 #include "Utilities/TMPL.hpp"
11 
12 /// \cond
13 namespace tuples {
14 template <typename...>
15 class TaggedTuple;
16 } // namespace tuples
17 
18 namespace Parallel {
19 template <typename Metavariables>
20 class ConstGlobalCache;
21 } // namespace Parallel
22 /// \endcond
23 
24 namespace db {
25 namespace Actions {
26 /*!
27  * \ingroup ActionsGroup
28  * \brief Apply the function `F::apply` to the DataBox
29  *
30  * The function `F::apply` is invoked with the `F::argument_tags`. The result
31  * of this computation is stored in the `F::return_tags`.
32  *
33  * Uses:
34  * - DataBox:
35  * - All elements in `F::argument_tags`
36  * - All elements in `F::return_tags`
37  *
38  * DataBox changes:
39  * - Modifies:
40  * - All elements in `F::return_tags`
41  */
42 template <typename F>
43 struct MutateApply {
44  template <typename DbTagsList, typename... InboxTags, typename ArrayIndex,
45  typename ActionList, typename ParallelComponent,
47  static auto apply(db::DataBox<DbTagsList>& box,
48  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
50  const ArrayIndex& /*array_index*/,
51  const ActionList /*meta*/,
52  const ParallelComponent* const /*meta*/) noexcept {
53  db::mutate_apply<F>(make_not_null(&box));
54  return std::forward_as_tuple(std::move(box));
55  }
56 };
57 } // namespace Actions
58 } // namespace db
Definition: TaggedTuple.hpp:25
Contains functions that forward to Charm++ parallel functions.
Definition: Abort.hpp:13
Defines the type alias Requires.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1609
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
Namespace for DataBox related things.
Definition: MutateApply.hpp:24
Wraps the template metaprogramming library used (brigand)
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, but it may be necessary to perform the conversion explicitly when type deduction is desired.
Definition: Gsl.hpp:863
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
Apply the function F::apply to the DataBox.
Definition: MutateApply.hpp:43
Definition: ComputeTimeDerivative.hpp:28