SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Actions - AddSimpleTags.hpp Hit Total Coverage
Commit: 37c384043430860f87787999aa7399d01bb3d213 Lines: 1 5 20.0 %
Date: 2024-04-20 02:24:02
Legend: Lines: hit not hit

          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 <utility>
       8             : 
       9             : #include "DataStructures/DataBox/DataBox.hpp"
      10             : #include "DataStructures/DataBox/Protocols/Mutator.hpp"
      11             : #include "Parallel/AlgorithmExecution.hpp"
      12             : #include "Utilities/TMPL.hpp"
      13             : #include "Utilities/TaggedTuple.hpp"
      14             : 
      15             : /// \cond
      16             : namespace Parallel {
      17             : template <typename Metavariables>
      18             : class GlobalCache;
      19             : }  // namespace Parallel
      20             : /// \endcond
      21             : 
      22             : namespace Initialization {
      23             : namespace Actions {
      24             : /*!
      25             :  * \ingroup ActionsGroup
      26             :  * \brief Initialize the list of simple tags in `Mutators::return_tags` by
      27             :  * calling each mutator in the order they are specified
      28             :  *
      29             :  * There's a specialization for `AddSimpleTags<tmpl::list<Mutators...>>` that
      30             :  * can also be used if a `tmpl::list` is available.
      31             :  *
      32             :  * Uses: nothing
      33             :  *
      34             :  * DataBox changes:
      35             :  * - Adds:
      36             :  *   - Each simple tag in the list `Mutators::return_tags`
      37             :  * - Removes:
      38             :  *   - nothing
      39             :  * - Modifies:
      40             :  *   - Each simple tag in the list `Mutators::return_tags`
      41             :  */
      42             : template <typename... Mutators>
      43           1 : struct AddSimpleTags {
      44           0 :   using simple_tags =
      45             :       tmpl::flatten<tmpl::append<typename Mutators::return_tags...>>;
      46           0 :   using compute_tags = tmpl::list<>;
      47             : 
      48             :   static_assert((tt::assert_conforms_to_v<Mutators, db::protocols::Mutator> and
      49             :                  ...));
      50             : 
      51             :   template <typename DbTagsList, typename... InboxTags, typename Metavariables,
      52             :             typename ArrayIndex, typename ActionList,
      53             :             typename ParallelComponent>
      54           0 :   static Parallel::iterable_action_return_t apply(
      55             :       db::DataBox<DbTagsList>& box,
      56             :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      57             :       const Parallel::GlobalCache<Metavariables>& /*cache*/,
      58             :       const ArrayIndex& /*array_index*/, ActionList /*meta*/,
      59             :       const ParallelComponent* const /*meta*/) {
      60             :     EXPAND_PACK_LEFT_TO_RIGHT(db::mutate_apply<Mutators>(make_not_null(&box)));
      61             :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      62             :   }
      63             : };
      64             : 
      65             : /// \cond
      66             : template <typename... Mutators>
      67             : struct AddSimpleTags<tmpl::list<Mutators...>>
      68             :     : public AddSimpleTags<Mutators...> {};
      69             : /// \endcond
      70             : }  // namespace Actions
      71             : }  // namespace Initialization

Generated by: LCOV version 1.14