UpdatePrimitives.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <tuple>
7 
10 #include "Utilities/Requires.hpp"
11 #include "Utilities/TMPL.hpp"
13 
14 /// \cond
15 namespace Parallel {
16 template <typename Metavariables>
17 class ConstGlobalCache;
18 } // namespace Parallel
19 // IWYU pragma: no_forward_declare db::DataBox
20 /// \endcond
21 
22 namespace Actions {
23 /// \ingroup ActionsGroup
24 /// \brief Compute the primitive variables from the conservative variables
25 ///
26 /// \note `Metavariables` must specify an
27 /// `ordered_list_of_primitive_recovery_schemes`.
28 ///
29 /// Uses:
30 /// - DataBox: Items in system::primitive_from_conservative::argument_tags
31 ///
32 /// DataBox changes:
33 /// - Adds: nothing
34 /// - Removes: nothing
35 /// - Modifies: Metavariables::system::primitive_from_conservative::return_tags
37  template <typename DbTagsList, typename... InboxTags, typename Metavariables,
38  typename ArrayIndex, typename ActionList,
39  typename ParallelComponent,
41  static auto apply(db::DataBox<DbTagsList>& box,
42  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
44  const ArrayIndex& /*array_index*/,
45  const ActionList /*meta*/,
46  const ParallelComponent* const /*meta*/) noexcept {
47  using PrimFromCon =
48  typename Metavariables::system::template primitive_from_conservative<
49  typename Metavariables::ordered_list_of_primitive_recovery_schemes>;
50  db::mutate_apply<typename PrimFromCon::return_tags,
51  typename PrimFromCon::argument_tags>(PrimFromCon{},
52  make_not_null(&box));
53  return std::forward_as_tuple(std::move(box));
54  }
55 };
56 } // namespace Actions
Defines class tuples::TaggedTuple.
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 function f mutating items MutateTags and taking as additional arguments ArgumentTags and ar...
Definition: DataBox.hpp:1773
Compute the primitive variables from the conservative variables.
Definition: UpdatePrimitives.hpp:36
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:1595
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
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
Definition: SolvePoissonProblem.hpp:38
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Definition: ComputeTimeDerivative.hpp:28