SpECTRE Documentation Coverage Report
Current view: top level - ParallelAlgorithms/Interpolation/Actions - InitializeInterpolationTarget.hpp Hit Total Coverage
Commit: aabde07399ba7837e5db64eedfd0a21f31f96922 Lines: 1 7 14.3 %
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 <cstddef>
       7             : #include <optional>
       8             : #include <tuple>
       9             : #include <unordered_set>
      10             : 
      11             : #include "DataStructures/DataBox/DataBox.hpp"
      12             : #include "DataStructures/VariablesTag.hpp"
      13             : #include "Parallel/AlgorithmExecution.hpp"
      14             : #include "ParallelAlgorithms/Interpolation/Tags.hpp"  // IWYU pragma: keep
      15             : #include "Utilities/Requires.hpp"
      16             : #include "Utilities/TMPL.hpp"
      17             : #include "Utilities/TaggedTuple.hpp"
      18             : #include "Utilities/TypeTraits.hpp"
      19             : #include "Utilities/TypeTraits/CreateGetTypeAliasOrDefault.hpp"
      20             : #include "Utilities/TypeTraits/CreateIsCallable.hpp"
      21             : 
      22             : /// \cond
      23             : // IWYU pragma: no_forward_declare db::DataBox
      24             : namespace Parallel {
      25             : template <typename Metavariables>
      26             : class GlobalCache;
      27             : }  // namespace Parallel
      28             : /// \endcond
      29             : 
      30             : namespace intrp {
      31             : 
      32             : /// Holds Actions for Interpolator and InterpolationTarget.
      33             : namespace Actions {
      34             : 
      35             : // The purpose of the metafunctions in this namespace is to allow
      36             : // InterpolationTarget::compute_target_points to omit an initialize
      37             : // function and a compute_tags and simple_tags type alias if it
      38             : // doesn't add anything to the DataBox.
      39             : namespace initialize_interpolation_target_detail {
      40             : 
      41             : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(compute_tags)
      42             : CREATE_GET_TYPE_ALIAS_OR_DEFAULT(simple_tags)
      43             : CREATE_IS_CALLABLE(initialize)
      44             : CREATE_IS_CALLABLE_V(initialize)
      45             : 
      46             : }  // namespace initialize_interpolation_target_detail
      47             : 
      48             : /// \ingroup ActionsGroup
      49             : /// \brief Initializes an InterpolationTarget
      50             : ///
      51             : /// Uses: nothing
      52             : ///
      53             : /// DataBox changes:
      54             : /// - Adds:
      55             : ///   - `Tags::IndicesOfFilledInterpPoints<TemporalId>`
      56             : ///   - `Tags::IndicesOfInvalidInterpPoints<TemporalId>`
      57             : ///   - `Tags::PendingTemporalIds<TemporalId>`
      58             : ///   - `Tags::TemporalIds<TemporalId>`
      59             : ///   - `Tags::CompletedTemporalIds<TemporalId>`
      60             : ///   - `Tags::InterpolatedVars<InterpolationTargetTag,TemporalId>`
      61             : ///   - `::Tags::Variables<typename
      62             : ///                   InterpolationTargetTag::vars_to_interpolate_to_target>`
      63             : /// - Removes: nothing
      64             : /// - Modifies: nothing
      65             : ///
      66             : /// For requirements on InterpolationTargetTag, see InterpolationTarget
      67             : template <typename Metavariables, typename InterpolationTargetTag>
      68           1 : struct InitializeInterpolationTarget {
      69           0 :   using TemporalId = typename InterpolationTargetTag::temporal_id::type;
      70           0 :   using return_tag_list_initial = tmpl::list<
      71             :       Tags::IndicesOfFilledInterpPoints<TemporalId>,
      72             :       Tags::IndicesOfInvalidInterpPoints<TemporalId>,
      73             :       Tags::PendingTemporalIds<TemporalId>, Tags::TemporalIds<TemporalId>,
      74             :       Tags::CompletedTemporalIds<TemporalId>,
      75             :       Tags::InterpolatedVars<InterpolationTargetTag, TemporalId>,
      76             :       ::Tags::Variables<
      77             :           typename InterpolationTargetTag::vars_to_interpolate_to_target>>;
      78             : 
      79           0 :   using simple_tags = tmpl::append<
      80             :       return_tag_list_initial,
      81             :       initialize_interpolation_target_detail::get_simple_tags_or_default_t<
      82             :           typename InterpolationTargetTag::compute_target_points,
      83             :           tmpl::list<>>>;
      84           0 :   using compute_tags = tmpl::append<
      85             :       initialize_interpolation_target_detail::get_compute_tags_or_default_t<
      86             :           typename InterpolationTargetTag::compute_target_points, tmpl::list<>>,
      87             :       typename InterpolationTargetTag::compute_items_on_target>;
      88             : 
      89             :   template <typename DbTagsList, typename... InboxTags, typename ArrayIndex,
      90             :             typename ActionList, typename ParallelComponent>
      91           0 :   static Parallel::iterable_action_return_t apply(
      92             :       db::DataBox<DbTagsList>& box,
      93             :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      94             :       const Parallel::GlobalCache<Metavariables>& cache,
      95             :       const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
      96             :       const ParallelComponent* const /*meta*/) {
      97             :     if constexpr (
      98             :         initialize_interpolation_target_detail::is_initialize_callable_v<
      99             :             typename InterpolationTargetTag::compute_target_points,
     100             :             const gsl::not_null<db::DataBox<DbTagsList>*>,
     101             :             const Parallel::GlobalCache<Metavariables>&>) {
     102             :       InterpolationTargetTag::compute_target_points::initialize(
     103             :           make_not_null(&box), cache);
     104             :     }
     105             :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
     106             :   }
     107             : };
     108             : 
     109             : }  // namespace Actions
     110             : }  // namespace intrp

Generated by: LCOV version 1.14