Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <memory> 7 : 8 : #include "DataStructures/DataBox/DataBox.hpp" 9 : #include "Parallel/Algorithms/AlgorithmSingleton.hpp" 10 : #include "Parallel/GlobalCache.hpp" 11 : #include "Parallel/Local.hpp" 12 : #include "Parallel/ParallelComponentHelpers.hpp" 13 : #include "Parallel/Phase.hpp" 14 : #include "Parallel/PhaseDependentActionList.hpp" 15 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp" 16 : #include "ParallelAlgorithms/Interpolation/Actions/InterpolationTargetSendPoints.hpp" 17 : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" 18 : #include "Utilities/PrettyType.hpp" 19 : #include "Utilities/ProtocolHelpers.hpp" 20 : #include "Utilities/TMPL.hpp" 21 : #include "Utilities/TypeTraits.hpp" 22 : 23 : /// \cond 24 : namespace intrp::Actions { 25 : template <typename Metavariables, typename InterpolationTargetTag> 26 : struct InitializeInterpolationTarget; 27 : } // namespace intrp::Actions 28 : /// \endcond 29 : 30 : namespace intrp { 31 : 32 : /// \brief ParallelComponent representing a set of points to be interpolated 33 : /// to and a function to call upon interpolation to those points. 34 : /// 35 : /// `InterpolationTargetTag` must conform to the 36 : /// intrp::protocols::InterpolationTargetTag protocol. 37 : /// 38 : /// The metavariables must contain the following type alias: 39 : /// - interpolation_target_tags: 40 : /// A `tmpl::list` of all `InterpolationTargetTag`s. 41 : /// 42 : /// `Metavariables` must contain the following static constexpr members: 43 : /// - size_t volume_dim: 44 : /// The dimension of the Domain. 45 : template <class Metavariables, typename InterpolationTargetTag> 46 1 : struct InterpolationTarget { 47 0 : using interpolation_target_tag = InterpolationTargetTag; 48 : static_assert( 49 : tt::assert_conforms_to_v<interpolation_target_tag, 50 : intrp::protocols::InterpolationTargetTag>); 51 0 : static std::string name() { 52 : return pretty_type::name<InterpolationTargetTag>(); 53 : } 54 0 : using chare_type = ::Parallel::Algorithms::Singleton; 55 0 : static constexpr bool checkpoint_data = true; 56 0 : using const_global_cache_tags = 57 : Parallel::get_const_global_cache_tags_from_actions< 58 : tmpl::flatten<tmpl::list< 59 : typename InterpolationTargetTag::compute_target_points, 60 : typename InterpolationTargetTag::post_interpolation_callbacks>>>; 61 0 : using metavariables = Metavariables; 62 0 : using phase_dependent_action_list = tmpl::list< 63 : Parallel::PhaseActions< 64 : Parallel::Phase::Initialization, 65 : tmpl::list<intrp::Actions::InitializeInterpolationTarget< 66 : Metavariables, InterpolationTargetTag>, 67 : Parallel::Actions::TerminatePhase>>, 68 : Parallel::PhaseActions< 69 : Parallel::Phase::Register, 70 : tmpl::list<Actions::InterpolationTargetSendTimeIndepPointsToElements< 71 : InterpolationTargetTag>, 72 : Parallel::Actions::TerminatePhase>>, 73 : Parallel::PhaseActions< 74 : Parallel::Phase::Restart, 75 : tmpl::list< 76 : tmpl::conditional_t< 77 : InterpolationTargetTag::compute_target_points::is_sequential:: 78 : value, 79 : tmpl::list<>, 80 : tmpl::list< 81 : Actions::InterpolationTargetSendTimeIndepPointsToElements< 82 : InterpolationTargetTag>>>, 83 : Parallel::Actions::TerminatePhase>>>; 84 : 85 0 : using simple_tags_from_options = Parallel::get_simple_tags_from_options< 86 : Parallel::get_initialization_actions_list<phase_dependent_action_list>>; 87 : 88 0 : static void execute_next_phase( 89 : Parallel::Phase next_phase, 90 : Parallel::CProxy_GlobalCache<metavariables>& global_cache) { 91 : auto& local_cache = *Parallel::local_branch(global_cache); 92 : Parallel::get_parallel_component< 93 : InterpolationTarget<metavariables, InterpolationTargetTag>>(local_cache) 94 : .start_phase(next_phase); 95 : }; 96 : }; 97 : } // namespace intrp