SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/CurvedScalarWave - CalculateGrVars.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 16.7 % 6 1
Test Date: 2026-10-22 17:29:42
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              : 
       8              : #include "DataStructures/DataVector.hpp"
       9              : #include "DataStructures/Tensor/Tensor.hpp"
      10              : #include "Domain/Creators/Tags/Domain.hpp"
      11              : #include "Domain/Tags.hpp"
      12              : #include "Evolution/Initialization/InitialData.hpp"
      13              : #include "Evolution/Initialization/Tags.hpp"
      14              : #include "Evolution/Systems/CurvedScalarWave/BackgroundSpacetime.hpp"
      15              : #include "Evolution/Systems/CurvedScalarWave/System.hpp"
      16              : #include "Parallel/AlgorithmExecution.hpp"
      17              : #include "Parallel/GlobalCache.hpp"
      18              : #include "PointwiseFunctions/AnalyticData/Tags.hpp"
      19              : 
      20              : /// \cond
      21              : namespace Tags {
      22              : struct Time;
      23              : }  // namespace Tags
      24              : /// \endcond
      25              : 
      26              : namespace CurvedScalarWave::Actions {
      27              : 
      28              : /// \ingroup ActionsGroup
      29              : /// \brief Action that initializes or updates items related to the
      30              : /// spacetime background of the CurvedScalarWave system
      31              : ///
      32              : /// If `SkipForStaticBlocks` is `true`, then this action does nothing if the
      33              : /// block of the domain is time independent. This is a performance optimization
      34              : /// to avoid updating the background spacetime in blocks that are time
      35              : /// independent. Note that this assumes that the background spacetime is also
      36              : /// time independent.
      37              : ///
      38              : /// DataBox changes:
      39              : /// - Adds:
      40              : ///   * `CurvedScalarWave::System::spacetime_tag_list`
      41              : /// - Removes: nothing
      42              : /// - Modifies: nothing
      43              : template <typename System, bool SkipForStaticDomains>
      44            1 : struct CalculateGrVars {
      45            0 :   static constexpr size_t Dim = System::volume_dim;
      46            0 :   using simple_tags = db::AddSimpleTags<typename System::spacetime_tag_list>;
      47            0 :   using compute_tags = db::AddComputeTags<>;
      48              : 
      49              :   template <typename DbTagsList, typename... InboxTags, typename Metavariables,
      50              :             typename ActionList, typename ParallelComponent>
      51            0 :   static Parallel::iterable_action_return_t apply(
      52              :       db::DataBox<DbTagsList>& box,
      53              :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      54              :       const Parallel::GlobalCache<Metavariables>& /*cache*/,
      55              :       const ElementId<Dim>& element_id, ActionList /*meta*/,
      56              :       const ParallelComponent* const /*meta*/) {
      57              :     if constexpr (SkipForStaticDomains) {
      58              :       const auto& domain = db::get<domain::Tags::Domain<Dim>>(box);
      59              :       const auto& block = domain.blocks()[element_id.block_id()];
      60              :       if (not block.is_time_dependent()) {
      61              :         return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      62              :       }
      63              :     }
      64              :     auto initial_data = evolution::Initialization::initial_data(
      65              :         db::get<CurvedScalarWave::Tags::BackgroundSpacetime<
      66              :             typename Metavariables::background_spacetime>>(box),
      67              :         db::get<domain::Tags::Coordinates<Dim, Frame::Inertial>>(box),
      68              :         db::get<::Tags::Time>(box), typename System::spacetime_tag_list{});
      69              :     tmpl::for_each<typename System::spacetime_tag_list>(
      70              :         [&box, &initial_data](auto spacetime_tag_v) {
      71              :           using spacetime_tag = tmpl::type_from<decltype(spacetime_tag_v)>;
      72              :           db::mutate<spacetime_tag>(
      73              :               [&initial_data](const auto spacetime_tag_ptr) {
      74              :                 *spacetime_tag_ptr =
      75              :                     std::move(get<spacetime_tag>(initial_data));
      76              :               },
      77              :               make_not_null(&box));
      78              :         });
      79              : 
      80              :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      81              :   }
      82              : };
      83              : }  // namespace CurvedScalarWave::Actions
        

Generated by: LCOV version 2.0-1