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 : 8 : #include "DataStructures/DataBox/DataBox.hpp" 9 : #include "Domain/Structure/ElementId.hpp" 10 : #include "Parallel/AlgorithmExecution.hpp" 11 : #include "Parallel/ArrayCollection/ReceiveDataForElement.hpp" 12 : #include "Parallel/ArrayCollection/Tags/ElementCollection.hpp" 13 : #include "Parallel/GlobalCache.hpp" 14 : #include "Utilities/TaggedTuple.hpp" 15 : 16 : namespace Parallel::Actions { 17 : /// \brief Starts the next phase on the nodegroup and calls 18 : /// `ReceiveDataForElement` for each element on the node. 19 1 : struct StartPhaseOnNodegroup { 20 : template <typename DbTagsList, typename... InboxTags, typename ArrayIndex, 21 : typename ActionList, typename ParallelComponent, 22 : typename Metavariables> 23 0 : static Parallel::iterable_action_return_t apply( 24 : db::DataBox<DbTagsList>& box, 25 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 26 : Parallel::GlobalCache<Metavariables>& cache, 27 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 28 : const ParallelComponent* const /*meta*/) { 29 : const size_t my_node = Parallel::my_node<size_t>(cache); 30 : auto proxy_to_this_node = 31 : Parallel::get_parallel_component<ParallelComponent>(cache)[my_node]; 32 : for (const auto& [element_id, element] : 33 : db::get<typename ParallelComponent::element_collection_tag>(box)) { 34 : Parallel::threaded_action<ReceiveDataForElement<true>>(proxy_to_this_node, 35 : element_id); 36 : } 37 : return {Parallel::AlgorithmExecution::Halt, std::nullopt}; 38 : } 39 : }; 40 : } // namespace Parallel::Actions