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 "DataStructures/DataBox/TagName.hpp" 8 : #include "Parallel/AlgorithmExecution.hpp" 9 : #include "Parallel/GlobalCache.hpp" 10 : #include "ParallelAlgorithms/EventsAndTriggers/Tags.hpp" 11 : #include "ParallelAlgorithms/EventsAndTriggers/WhenToCheck.hpp" 12 : #include "Utilities/Gsl.hpp" 13 : #include "Utilities/TMPL.hpp" 14 : #include "Utilities/TaggedTuple.hpp" 15 : 16 : namespace elliptic::Actions { 17 : /// \ingroup ActionsGroup 18 : /// \ingroup EventsAndTriggersGroup 19 : /// \brief Run the events and triggers 20 : /// 21 : /// Uses: 22 : /// - GlobalCache: the EventsAndTriggers tag, as required by 23 : /// events and triggers 24 : /// - DataBox: as required by events and triggers 25 : /// 26 : /// DataBox changes: 27 : /// - Adds: nothing 28 : /// - Removes: nothing 29 : /// - Modifies: nothing 30 : template <typename ObservationId> 31 1 : struct RunEventsAndTriggers { 32 0 : using const_global_cache_tags = 33 : tmpl::list<Tags::EventsAndTriggers<Triggers::WhenToCheck::AtIterations>>; 34 : 35 : template <typename DbTags, typename... InboxTags, typename Metavariables, 36 : typename ArrayIndex, typename ActionList, 37 : typename ParallelComponent> 38 0 : static Parallel::iterable_action_return_t apply( 39 : db::DataBox<DbTags>& box, tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 40 : Parallel::GlobalCache<Metavariables>& cache, 41 : const ArrayIndex& array_index, const ActionList /*meta*/, 42 : const ParallelComponent* const component) { 43 : Parallel::get<Tags::EventsAndTriggers<Triggers::WhenToCheck::AtIterations>>( 44 : cache) 45 : .run_events(make_not_null(&box), cache, array_index, component, 46 : {db::tag_name<ObservationId>(), 47 : static_cast<double>(db::get<ObservationId>(box))}); 48 : 49 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 50 : } 51 : }; 52 : } // namespace elliptic::Actions