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

Generated by: LCOV version 1.14