Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <optional> 8 : #include <tuple> 9 : 10 : #include "DataStructures/DataBox/DataBox.hpp" 11 : #include "DataStructures/DataBox/DataBoxTag.hpp" 12 : #include "Domain/Tags.hpp" // IWYU pragma: keep 13 : #include "Parallel/AlgorithmExecution.hpp" 14 : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" 15 : #include "Utilities/Literals.hpp" 16 : #include "Utilities/TMPL.hpp" 17 : #include "Utilities/TaggedTuple.hpp" 18 : 19 : /// \cond 20 : // IWYU pragma: no_forward_declare db::DataBox 21 : namespace Parallel { 22 : template <typename Metavariables> 23 : class GlobalCache; 24 : } // namespace Parallel 25 : namespace intrp { 26 : namespace Tags { 27 : struct NumberOfElements; 28 : template <typename Metavariables> 29 : struct InterpolatedVarsHolders; 30 : template <typename Metavariables, typename TemporalId> 31 : struct VolumeVarsInfo; 32 : } // namespace Tags 33 : } // namespace intrp 34 : /// \endcond 35 : 36 : namespace intrp { 37 : namespace Actions { 38 : 39 : /// \ingroup ActionsGroup 40 : /// \brief Initializes an Interpolator 41 : /// 42 : /// Uses: nothing 43 : /// 44 : /// DataBox changes: 45 : /// - Adds: 46 : /// - `Tags::NumberOfElements` 47 : /// - each tag in the template argument VolumeVarsInfos, which may either be a 48 : /// single `Tags::VolumeVarsInfo<Metavariables, TemporalId>` or a 49 : /// `tmpl::list` of multiple tags for `VolumeVarsInfo`. 50 : /// - `Tags::InterpolatedVarsHolders<Metavariables>` 51 : /// - Removes: nothing 52 : /// - Modifies: nothing 53 : template <typename VolumeVarsInfos, typename InterpolatedVarsHolders> 54 1 : struct InitializeInterpolator { 55 0 : using return_tag_list = 56 : tmpl::flatten<tmpl::list<Tags::NumberOfElements, VolumeVarsInfos, 57 : InterpolatedVarsHolders>>; 58 : 59 0 : using simple_tags = return_tag_list; 60 0 : using compute_tags = tmpl::list<>; 61 : template <typename DbTagsList, typename... InboxTags, typename Metavariables, 62 : typename ArrayIndex, typename ActionList, 63 : typename ParallelComponent> 64 0 : static Parallel::iterable_action_return_t apply( 65 : db::DataBox<DbTagsList>& box, 66 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 67 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 68 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 69 : const ParallelComponent* const /*meta*/) { 70 : Initialization::mutate_assign<tmpl::list<Tags::NumberOfElements>>( 71 : make_not_null(&box), 0_st); 72 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 73 : } 74 : }; 75 : 76 : } // namespace Actions 77 : } // namespace intrp