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 : 13 : /// \cond 14 : namespace tuples { 15 : template <typename...> 16 : class TaggedTuple; 17 : } // namespace tuples 18 : 19 : namespace Parallel { 20 : template <typename Metavariables> 21 : class GlobalCache; 22 : } // namespace Parallel 23 : /// \endcond 24 : 25 : namespace Actions { 26 : /*! 27 : * \ingroup ActionsGroup 28 : * \brief Apply the function `Mutator::apply` to the DataBox 29 : * 30 : * The function `Mutator::apply` is invoked with the `Mutator::argument_tags`. 31 : * The result of this computation is stored in the `Mutator::return_tags`. 32 : * 33 : * Uses: 34 : * - DataBox: 35 : * - All elements in `Mutator::argument_tags` 36 : * 37 : * DataBox changes: 38 : * - Modifies: 39 : * - All elements in `Mutator::return_tags` 40 : */ 41 : template <typename Mutator> 42 1 : struct MutateApply { 43 : template <typename DataBox, typename... InboxTags, typename Metavariables, 44 : typename ArrayIndex, typename ActionList, 45 : typename ParallelComponent> 46 0 : static Parallel::iterable_action_return_t apply( 47 : DataBox& box, const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 48 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 49 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 50 : const ParallelComponent* const /*meta*/) { 51 : db::mutate_apply<Mutator>(make_not_null(&box)); 52 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 53 : } 54 : }; 55 : } // namespace Actions