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 "Parallel/AlgorithmExecution.hpp" 10 : #include "Parallel/GlobalCache.hpp" 11 : #include "Parallel/Invoke.hpp" 12 : #include "ParallelAlgorithms/Interpolation/Actions/ElementReceiveInterpPoints.hpp" 13 : #include "ParallelAlgorithms/Interpolation/InterpolationTargetDetail.hpp" 14 : #include "Utilities/TMPL.hpp" 15 : #include "Utilities/TaggedTuple.hpp" 16 : 17 : namespace intrp { 18 : namespace Actions { 19 : 20 : /// \ingroup ActionsGroup 21 : /// \brief Sends interpolation points to all the Elements. 22 : /// 23 : /// This action is for the case in which the points are time-independent 24 : /// in the frame of the InterpolationTarget (which may or may not mean that 25 : /// the points are time-independent in the grid frame). 26 : /// 27 : /// This action should be placed in the Registration PDAL for 28 : /// InterpolationTarget. 29 : /// 30 : /// Uses: 31 : /// - DataBox: 32 : /// - Anything that the particular 33 : /// InterpolationTargetTag::compute_target_points needs from the DataBox. 34 : /// 35 : /// DataBox changes: 36 : /// - Adds: nothing 37 : /// - Removes: nothing 38 : /// - Modifies: nothing 39 : template <typename InterpolationTargetTag> 40 1 : struct InterpolationTargetSendTimeIndepPointsToElements { 41 : template <typename DbTags, typename... InboxTags, typename ArrayIndex, 42 : typename ActionList, typename Metavariables, 43 : typename ParallelComponent> 44 0 : static Parallel::iterable_action_return_t apply( 45 : db::DataBox<DbTags>& box, 46 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 47 : Parallel::GlobalCache<Metavariables>& cache, 48 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 49 : const ParallelComponent* const /*meta*/) { 50 : static_assert( 51 : not InterpolationTargetTag::compute_target_points::is_sequential::value, 52 : "Actions::InterpolationTargetSendTimeIndepPointsToElement can be used " 53 : "only with non-sequential targets, since a sequential target is " 54 : "time-dependent by definition."); 55 : auto coords = InterpolationTargetTag::compute_target_points::points( 56 : box, tmpl::type_<Metavariables>{}); 57 : auto& receiver_proxy = Parallel::get_parallel_component< 58 : typename InterpolationTargetTag::template interpolating_component< 59 : Metavariables>>(cache); 60 : Parallel::simple_action<ElementReceiveInterpPoints<InterpolationTargetTag>>( 61 : receiver_proxy, std::move(coords)); 62 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 63 : } 64 : }; 65 : } // namespace Actions 66 : } // namespace intrp