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 <memory> 8 : 9 : #include "Parallel/Algorithms/AlgorithmNodegroupDeclarations.hpp" 10 : #include "Parallel/ArrayCollection/CreateElementCollection.hpp" 11 : #include "Parallel/ArrayCollection/DgElementArrayMember.hpp" 12 : #include "Parallel/ArrayCollection/DgElementArrayMemberBase.hpp" 13 : #include "Parallel/ArrayCollection/Tags/ElementCollection.hpp" 14 : #include "Parallel/ArrayCollection/TransformPdalForNodegroup.hpp" 15 : #include "Parallel/GlobalCache.hpp" 16 : #include "Parallel/Local.hpp" 17 : #include "Parallel/ParallelComponentHelpers.hpp" 18 : #include "Parallel/Printf/Printf.hpp" 19 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp" 20 : #include "Utilities/Gsl.hpp" 21 : #include "Utilities/TMPL.hpp" 22 : 23 : namespace Parallel { 24 : /*! 25 : * \brief A collection of DG elements on a node. 26 : * 27 : * The `PhaseDepActionList` is the PDAL that was used for the array 28 : * approach. Some actions will require updating to support nodegroups if they 29 : * haven't already been. 30 : */ 31 : template <size_t Dim, class Metavariables, class PhaseDepActionList> 32 1 : struct DgElementCollection { 33 : /// \brief The `DgElementCollection` is currently a nodegroup. 34 : /// 35 : /// It should be possible to generalize this to work as a group too. 36 1 : using chare_type = Parallel::Algorithms::Nodegroup; 37 : /// \brief The metavariables 38 1 : using metavariables = Metavariables; 39 : /// \brief The simple tags necessary from option parsing. 40 1 : using simple_tags_from_options = Parallel::get_simple_tags_from_options< 41 : Parallel::get_initialization_actions_list<PhaseDepActionList>>; 42 : /// \brief The type of the `Parallel::DgElementArrayMember` with all 43 : /// template parameters. 44 1 : using dg_element_array_member = 45 : Parallel::DgElementArrayMember<Dim, Metavariables, PhaseDepActionList, 46 : simple_tags_from_options>; 47 : /// \brief The tag `Parallel::Tags::ElementCollection` of this 48 : /// `DgElementCollection` 49 1 : using element_collection_tag = 50 : Parallel::Tags::ElementCollection<Dim, Metavariables, PhaseDepActionList, 51 : simple_tags_from_options>; 52 : 53 : /// \brief The phase dependent action lists. 54 : /// 55 : /// These are computed using 56 : /// `Parallel::TransformPhaseDependentActionListForNodegroup` from the 57 : /// `PhaseDepActionList` template parameter. 58 1 : using phase_dependent_action_list = tmpl::append< 59 : tmpl::list<Parallel::PhaseActions< 60 : Parallel::Phase::Initialization, 61 : tmpl::list<Actions::CreateElementCollection<Dim, Metavariables, 62 : PhaseDepActionList, 63 : simple_tags_from_options>, 64 : Parallel::Actions::TerminatePhase>>>, 65 : TransformPhaseDependentActionListForNodegroup<PhaseDepActionList>>; 66 : 67 : /// @{ 68 : /// \brief The tags for the global cache. 69 : /// 70 : /// These are computed from the `PhaseDepActionList` template parameter. 71 1 : using const_global_cache_tags = tmpl::remove_duplicates< 72 : typename Parallel::detail::get_const_global_cache_tags_from_pdal< 73 : PhaseDepActionList>::type>; 74 1 : using mutable_global_cache_tags = 75 : typename Parallel::detail::get_mutable_global_cache_tags_from_pdal< 76 : PhaseDepActionList>::type; 77 : /// @} 78 : 79 : /// \brief Starts the next phase of execution. 80 1 : static void execute_next_phase( 81 : const Parallel::Phase next_phase, 82 : Parallel::CProxy_GlobalCache<Metavariables>& global_cache) { 83 : Parallel::printf("%s\n", next_phase); 84 : auto& local_cache = *Parallel::local_branch(global_cache); 85 : Parallel::get_parallel_component<DgElementCollection>(local_cache) 86 : .start_phase(next_phase); 87 : } 88 : }; 89 : } // namespace Parallel