Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <optional>
7 : #include <tuple>
8 :
9 : #include "DataStructures/DataBox/DataBox.hpp"
10 : #include "DataStructures/TaggedTuple.hpp"
11 : #include "Parallel/AlgorithmExecution.hpp"
12 : #include "Utilities/Requires.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : /// \cond
16 : namespace Parallel {
17 : template <typename Metavariables>
18 : class GlobalCache;
19 : } // namespace Parallel
20 :
21 : /// \endcond
22 :
23 : namespace Actions {
24 : /// \ingroup ActionsGroup
25 : /// \brief Compute the primitive variables from the conservative variables
26 : ///
27 : /// \note `Metavariables` must specify an
28 : /// `ordered_list_of_primitive_recovery_schemes`.
29 : ///
30 : /// Uses:
31 : /// - DataBox: Items in system::primitive_from_conservative::argument_tags
32 : ///
33 : /// DataBox changes:
34 : /// - Adds: nothing
35 : /// - Removes: nothing
36 : /// - Modifies: Metavariables::system::primitive_from_conservative::return_tags
37 1 : struct UpdatePrimitives {
38 : template <typename DbTagsList, typename... InboxTags, typename Metavariables,
39 : typename ArrayIndex, typename ActionList,
40 : typename ParallelComponent,
41 : Requires<tmpl::size<DbTagsList>::value != 0> = nullptr>
42 0 : static Parallel::iterable_action_return_t apply(
43 : db::DataBox<DbTagsList>& box,
44 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
45 : const Parallel::GlobalCache<Metavariables>& /*cache*/,
46 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
47 : const ParallelComponent* const /*meta*/) {
48 : using PrimFromCon =
49 : typename Metavariables::system::template primitive_from_conservative<
50 : typename Metavariables::ordered_list_of_primitive_recovery_schemes>;
51 : db::mutate_apply<PrimFromCon>(make_not_null(&box));
52 : return {Parallel::AlgorithmExecution::Continue, std::nullopt};
53 : }
54 : };
55 : } // namespace Actions
|