Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <optional> 7 : #include <tuple> 8 : 9 : #include "DataStructures/DataBox/DataBox.hpp" 10 : #include "Parallel/AlgorithmExecution.hpp" 11 : #include "Utilities/TMPL.hpp" 12 : #include "Utilities/TypeTraits/CreateGetTypeAliasOrDefault.hpp" 13 : 14 : /// \cond 15 : namespace tuples { 16 : template <typename...> 17 : class TaggedTuple; 18 : } // namespace tuples 19 : 20 : namespace Parallel { 21 : template <typename Metavariables> 22 : class GlobalCache; 23 : } // namespace Parallel 24 : /// \endcond 25 : 26 : namespace Actions { 27 : namespace detail { 28 : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(simple_tags) 29 : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(compute_tags) 30 : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(const_global_cache_tags) 31 : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(mutable_global_cache_tags) 32 : } // namespace detail 33 : /*! 34 : * \ingroup ActionsGroup 35 : * \brief Apply the function `Mutator::apply` to the DataBox 36 : * 37 : * The function `Mutator::apply` is invoked with the `Mutator::argument_tags`. 38 : * The result of this computation is stored in the `Mutator::return_tags`. 39 : * 40 : * Uses: 41 : * - DataBox: 42 : * - All elements in `Mutator::argument_tags` 43 : * 44 : * DataBox changes: 45 : * - Modifies: 46 : * - All elements in `Mutator::return_tags` 47 : */ 48 : template <typename Mutator> 49 1 : struct MutateApply { 50 0 : using simple_tags = 51 : detail::get_simple_tags_or_default_t<Mutator, tmpl::list<>>; 52 0 : using compute_tags = 53 : detail::get_compute_tags_or_default_t<Mutator, tmpl::list<>>; 54 0 : using const_global_cache_tags = 55 : detail::get_const_global_cache_tags_or_default_t<Mutator, tmpl::list<>>; 56 0 : using mutable_global_cache_tags = 57 : detail::get_mutable_global_cache_tags_or_default_t<Mutator, tmpl::list<>>; 58 : 59 : template <typename DataBox, typename... InboxTags, typename Metavariables, 60 : typename ArrayIndex, typename ActionList, 61 : typename ParallelComponent> 62 0 : static Parallel::iterable_action_return_t apply( 63 : DataBox& box, const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 64 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 65 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 66 : const ParallelComponent* const /*meta*/) { 67 : db::mutate_apply<Mutator>(make_not_null(&box)); 68 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 69 : } 70 : }; 71 : } // namespace Actions