SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Actions - InitializeItems.hpp Hit Total Coverage
Commit: aabde07399ba7837e5db64eedfd0a21f31f96922 Lines: 6 8 75.0 %
Date: 2024-04-26 02:38:13
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 "Parallel/AlgorithmExecution.hpp"
      11             : #include "Utilities/TMPL.hpp"
      12             : #include "Utilities/TaggedTuple.hpp"
      13             : 
      14             : /// \cond
      15             : namespace Parallel {
      16             : template <typename Metavariables>
      17             : class GlobalCache;
      18             : }  // namespace Parallel
      19             : /// \endcond
      20             : 
      21             : namespace Initialization {
      22             : namespace Actions {
      23             : /*!
      24             :  * \ingroup ActionsGroup
      25             :  * \brief Mutate DataBox items by calling db::mutate_apply on each Mutator in
      26             :  *  the order they are specified
      27             :  *
      28             :  * There's a specialization for `InitializeItems<tmpl::list<Mutators...>>` that
      29             :  * can also be used if a `tmpl::list` is available.
      30             :  *
      31             :  * \details In addition to the requirements specified by db::mutate_apply, each
      32             :  * Mutator must define the type aliases of this action.
      33             :  */
      34             : template <typename... Mutators>
      35           1 : struct InitializeItems {
      36             :   /// Tags for constant items added to the GlobalCache.  These items are
      37             :   /// initialized from input file options.
      38           1 :   using const_global_cache_tags = tmpl::remove_duplicates<tmpl::flatten<
      39             :       tmpl::append<typename Mutators::const_global_cache_tags...>>>;
      40             :   /// Tags for mutable items added to the GlobalCache.  These items are
      41             :   /// initialized from input file options.
      42           1 :   using mutable_global_cache_tags = tmpl::remove_duplicates<tmpl::flatten<
      43             :       tmpl::append<typename Mutators::mutable_global_cache_tags...>>>;
      44             :   /// Tags for simple DataBox items that are initialized from input file options
      45           1 :   using simple_tags_from_options = tmpl::remove_duplicates<tmpl::flatten<
      46             :       tmpl::append<typename Mutators::simple_tags_from_options...>>>;
      47             :   /// Tags for simple DataBox items that are default initialized.  They may be
      48             :   /// mutated by the Mutators.
      49           1 :   using simple_tags = tmpl::remove_duplicates<
      50             :       tmpl::flatten<tmpl::append<typename Mutators::simple_tags...>>>;
      51             :   /// Tags for immutable DataBox items (compute items or reference items).
      52           1 :   using compute_tags = tmpl::remove_duplicates<
      53             :       tmpl::flatten<tmpl::append<typename Mutators::compute_tags...>>>;
      54             : 
      55             :   template <typename DbTagsList, typename... InboxTags, typename Metavariables,
      56             :             typename ArrayIndex, typename ActionList,
      57             :             typename ParallelComponent>
      58           0 :   static Parallel::iterable_action_return_t apply(
      59             :       db::DataBox<DbTagsList>& box,
      60             :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      61             :       const Parallel::GlobalCache<Metavariables>& /*cache*/,
      62             :       const ArrayIndex& /*array_index*/, ActionList /*meta*/,
      63             :       const ParallelComponent* const /*meta*/) {
      64             :     EXPAND_PACK_LEFT_TO_RIGHT(db::mutate_apply<Mutators>(make_not_null(&box)));
      65             :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      66             :   }
      67             : };
      68             : 
      69             : /// \cond
      70             : template <typename... Mutators>
      71             : struct InitializeItems<tmpl::list<Mutators...>>
      72             :     : public InitializeItems<Mutators...> {};
      73             : /// \endcond
      74             : }  // namespace Actions
      75             : }  // namespace Initialization

Generated by: LCOV version 1.14