Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <string> 7 : #include <tuple> 8 : 9 : #include "DataStructures/DataBox/DataBox.hpp" 10 : #include "DataStructures/DataVector.hpp" 11 : #include "DataStructures/LinkedMessageId.hpp" 12 : #include "DataStructures/Tensor/Tensor.hpp" 13 : #include "DataStructures/Variables.hpp" 14 : #include "Evolution/Systems/Cce/Actions/BoundaryComputeAndSendToEvolution.hpp" 15 : #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp" 16 : #include "Evolution/Systems/Cce/OptionTags.hpp" 17 : #include "Evolution/Systems/Cce/WorldtubeDataManager.hpp" 18 : #include "Parallel/GlobalCache.hpp" 19 : #include "Parallel/Invoke.hpp" 20 : #include "Time/TimeStepId.hpp" 21 : #include "Utilities/Gsl.hpp" 22 : #include "Utilities/Requires.hpp" 23 : #include "Utilities/TMPL.hpp" 24 : #include "Utilities/TypeTraits.hpp" 25 : 26 : namespace Cce { 27 : namespace Actions { 28 : 29 : /*! 30 : * \ingroup ActionsGroup 31 : * \brief Stores the boundary data from the GH evolution in the 32 : * `Cce::InterfaceManagers::GhInterfaceManager`, and sends to the 33 : * `EvolutionComponent` (template argument) if the data fulfills a prior 34 : * request. 35 : * 36 : * \details If the new data fulfills a prior request submitted to the 37 : * `Cce::InterfaceManagers::GhInterfaceManager`, this will dispatch the result 38 : * to `Cce::Actions::SendToEvolution<GhWorldtubeBoundary<Metavariables>, 39 : * EvolutionComponent>` for sending the processed boundary data to 40 : * the `EvolutionComponent`. 41 : * 42 : * \ref DataBoxGroup changes: 43 : * - Adds: nothing 44 : * - Removes: nothing 45 : * - Modifies: 46 : * - `Tags::GhInterfaceManager` 47 : */ 48 : template <typename EvolutionComponent, bool DuringSelfStart> 49 1 : struct ReceiveGhWorldtubeData { 50 : template <typename ParallelComponent, typename... DbTags, 51 : typename Metavariables, typename ArrayIndex> 52 0 : static void apply(db::DataBox<tmpl::list<DbTags...>>& box, 53 : Parallel::GlobalCache<Metavariables>& cache, 54 : const ArrayIndex& /*array_index*/, 55 : const tmpl::conditional_t<DuringSelfStart, TimeStepId, 56 : LinkedMessageId<double>> 57 : time, 58 : const tnsr::aa<DataVector, 3>& spacetime_metric, 59 : const tnsr::iaa<DataVector, 3>& phi, 60 : const tnsr::aa<DataVector, 3>& pi) { 61 : auto insert_gh_data_to_interface_manager = 62 : [&spacetime_metric, &phi, &pi, &time, 63 : &cache](const auto interface_manager) { 64 : interface_manager->insert_gh_data(time, spacetime_metric, phi, pi); 65 : const auto gh_data = 66 : interface_manager->retrieve_and_remove_first_ready_gh_data(); 67 : if (static_cast<bool>(gh_data)) { 68 : Parallel::simple_action<Actions::SendToEvolution< 69 : GhWorldtubeBoundary<Metavariables>, EvolutionComponent>>( 70 : Parallel::get_parallel_component< 71 : GhWorldtubeBoundary<Metavariables>>(cache), 72 : get<0>(*gh_data), get<1>(*gh_data)); 73 : } 74 : }; 75 : if constexpr (DuringSelfStart) { 76 : db::mutate<Tags::SelfStartGhInterfaceManager>( 77 : insert_gh_data_to_interface_manager, make_not_null(&box)); 78 : } else { 79 : db::mutate<Tags::GhInterfaceManager>(insert_gh_data_to_interface_manager, 80 : make_not_null(&box)); 81 : } 82 : } 83 : }; 84 : } // namespace Actions 85 : } // namespace Cce