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 :
8 : #include "DataStructures/DataBox/DataBox.hpp"
9 : #include "DataStructures/DataVector.hpp"
10 : #include "DataStructures/TaggedTuple.hpp"
11 : #include "IO/Observer/Tags.hpp"
12 : #include "Parallel/AlgorithmExecution.hpp"
13 : #include "Parallel/ArrayComponentId.hpp"
14 : #include "Parallel/GlobalCache.hpp"
15 : #include "Parallel/NodeLock.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : namespace observers {
19 : namespace Actions {
20 : namespace detail {
21 : template <class Tag>
22 : using reduction_data_to_reduction_names = typename Tag::names_tag;
23 : } // namespace detail
24 : /*!
25 : * \brief Initializes the DataBox on the observer parallel component
26 : *
27 : * Uses:
28 : * - Metavariables:
29 : * - `observed_reduction_data_tags` (see ContributeReductionData)
30 : */
31 : template <class Metavariables>
32 1 : struct Initialize {
33 0 : using simple_tags = tmpl::append<
34 : tmpl::list<Tags::ExpectedContributorsForObservations,
35 : Tags::ContributorsOfReductionData,
36 : Tags::ContributorsOfTensorData, Tags::TensorData>,
37 : typename Metavariables::observed_reduction_data_tags,
38 : tmpl::transform<
39 : typename Metavariables::observed_reduction_data_tags,
40 : tmpl::bind<detail::reduction_data_to_reduction_names, tmpl::_1>>>;
41 0 : using compute_tags = tmpl::list<>;
42 :
43 0 : using return_tag_list = tmpl::append<simple_tags, compute_tags>;
44 :
45 : template <typename DbTagsList, typename... InboxTags, typename ArrayIndex,
46 : typename ActionList, typename ParallelComponent>
47 0 : static Parallel::iterable_action_return_t apply(
48 : db::DataBox<DbTagsList>& /*box*/,
49 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
50 : const Parallel::GlobalCache<Metavariables>& /*cache*/,
51 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
52 : const ParallelComponent* const /*meta*/) {
53 : return {Parallel::AlgorithmExecution::Continue, std::nullopt};
54 : }
55 : };
56 :
57 : /*!
58 : * \brief Initializes the DataBox of the observer parallel component that writes
59 : * to disk.
60 : *
61 : * Uses:
62 : * - Metavariables:
63 : * - `observed_reduction_data_tags` (see ContributeReductionData)
64 : *
65 : */
66 : template <class Metavariables>
67 1 : struct InitializeWriter {
68 0 : using simple_tags = tmpl::append<
69 : tmpl::list<Tags::ExpectedContributorsForObservations,
70 : Tags::ContributorsOfReductionData, Tags::ReductionDataLock,
71 : Tags::ContributorsOfTensorData, Tags::TensorData,
72 : Tags::InterpolatorTensorData,
73 : Tags::NodesExpectedToContributeReductions,
74 : Tags::NodesThatContributedReductions, Tags::H5FileLock,
75 : Tags::SerializedFunctionsOfTime, Tags::Dependencies>,
76 : typename Metavariables::observed_reduction_data_tags,
77 : tmpl::transform<
78 : typename Metavariables::observed_reduction_data_tags,
79 : tmpl::bind<detail::reduction_data_to_reduction_names, tmpl::_1>>>;
80 0 : using compute_tags = tmpl::list<>;
81 :
82 0 : using return_tag_list = tmpl::append<simple_tags, compute_tags>;
83 :
84 : template <typename DbTagsList, typename... InboxTags, typename ArrayIndex,
85 : typename ActionList, typename ParallelComponent>
86 0 : static Parallel::iterable_action_return_t apply(
87 : db::DataBox<DbTagsList>& /*box*/,
88 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
89 : const Parallel::GlobalCache<Metavariables>& /*cache*/,
90 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
91 : const ParallelComponent* const /*meta*/) {
92 : return {Parallel::AlgorithmExecution::Continue, std::nullopt};
93 : }
94 : };
95 : } // namespace Actions
96 : } // namespace observers
|