Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "DataStructures/DataBox/DataBox.hpp"
7 : #include "Domain/Structure/ElementId.hpp"
8 : #include "Parallel/AlgorithmExecution.hpp"
9 : #include "Parallel/ArrayCollection/ReceiveDataForElement.hpp"
10 : #include "Parallel/ArrayCollection/Tags/ElementCollection.hpp"
11 : #include "Parallel/GlobalCache.hpp"
12 :
13 : namespace Parallel::Actions {
14 : /*!
15 : * \brief Reduction target that is called after all nodes have successfully
16 : * initialized the nodegroup portion of the `DgElementCollection`. This spawns
17 : * the messages that initialize the `DgElementArrayMember`s
18 : */
19 1 : struct SpawnInitializeElementsInCollection {
20 : template <typename ParallelComponent, typename DbTagsList,
21 : typename Metavariables, typename ArrayIndex,
22 : typename DataBox = db::DataBox<DbTagsList>>
23 0 : static void apply(db::DataBox<DbTagsList>& box,
24 : Parallel::GlobalCache<Metavariables>& cache,
25 : const ArrayIndex& /*array_index*/,
26 : const double /*unused_but_we_needed_to_reduce_something*/) {
27 : auto my_proxy = Parallel::get_parallel_component<ParallelComponent>(
28 : cache)[Parallel::my_node<size_t>(cache)];
29 : db::mutate<typename ParallelComponent::element_collection_tag>(
30 : [&my_proxy](const auto element_collection_ptr) {
31 : for (auto& [element_id, element] : *element_collection_ptr) {
32 : Parallel::threaded_action<ReceiveDataForElement<true>>(my_proxy,
33 : element_id);
34 : }
35 : },
36 : make_not_null(&box));
37 : }
38 : };
39 : } // namespace Parallel::Actions
|