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 <optional>
8 :
9 : #include "DataStructures/DataBox/DataBox.hpp"
10 : #include "Domain/Structure/ElementId.hpp"
11 : #include "Domain/Tags.hpp"
12 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/Inboxes.hpp"
13 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/ReceiveElementData.hpp"
14 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp"
15 : #include "Parallel/AlgorithmExecution.hpp"
16 : #include "Time/TimeStepId.hpp"
17 :
18 : namespace CurvedScalarWave::Worldtube::Actions {
19 :
20 : /*!
21 : * \brief Sends the acceleration terms to worldtube neighbors
22 : */
23 : template <typename Metavariables>
24 1 : struct SendAccelerationTerms {
25 0 : static constexpr size_t Dim = Metavariables::volume_dim;
26 0 : using simple_tags = tmpl::list<Tags::AccelerationTerms>;
27 : template <typename DbTagsList, typename... InboxTags, typename ArrayIndex,
28 : typename ActionList, typename ParallelComponent>
29 0 : static Parallel::iterable_action_return_t apply(
30 : db::DataBox<DbTagsList>& box,
31 : tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
32 : Parallel::GlobalCache<Metavariables>& cache,
33 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
34 : const ParallelComponent* const /*meta*/) {
35 : const auto& faces_grid_coords =
36 : get<Tags::ElementFacesGridCoordinates<Dim>>(box);
37 : auto& element_proxies = Parallel::get_parallel_component<
38 : typename Metavariables::dg_element_array>(cache);
39 : for (const auto& [element_id, _] : faces_grid_coords) {
40 : auto data_to_send = db::get<Tags::AccelerationTerms>(box);
41 : Parallel::receive_data<Tags::SelfForceInbox<Dim>>(
42 : element_proxies[element_id], db::get<::Tags::TimeStepId>(box),
43 : std::move(data_to_send));
44 : }
45 : return {Parallel::AlgorithmExecution::Continue,
46 : tmpl::index_of<ActionList, ReceiveElementData>::value};
47 : }
48 : };
49 : } // namespace CurvedScalarWave::Worldtube::Actions
|