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 "IO/Observer/Tags.hpp" 11 : #include "Parallel/AlgorithmExecution.hpp" 12 : #include "Parallel/ArrayComponentId.hpp" 13 : #include "Parallel/GlobalCache.hpp" 14 : #include "Parallel/NodeLock.hpp" 15 : #include "Utilities/TMPL.hpp" 16 : #include "Utilities/TaggedTuple.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::VolumeDataLock, 72 : Tags::TensorData, Tags::InterpolatorTensorData, 73 : Tags::NodesExpectedToContributeReductions, 74 : Tags::NodesThatContributedReductions, Tags::H5FileLock>, 75 : typename Metavariables::observed_reduction_data_tags, 76 : tmpl::transform< 77 : typename Metavariables::observed_reduction_data_tags, 78 : tmpl::bind<detail::reduction_data_to_reduction_names, tmpl::_1>>>; 79 0 : using compute_tags = tmpl::list<>; 80 : 81 0 : using return_tag_list = tmpl::append<simple_tags, compute_tags>; 82 : 83 : template <typename DbTagsList, typename... InboxTags, typename ArrayIndex, 84 : typename ActionList, typename ParallelComponent> 85 0 : static Parallel::iterable_action_return_t apply( 86 : db::DataBox<DbTagsList>& /*box*/, 87 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 88 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 89 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 90 : const ParallelComponent* const /*meta*/) { 91 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 92 : } 93 : }; 94 : } // namespace Actions 95 : } // namespace observers