SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Actions - RequestBoundaryData.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 33.3 % 6 2
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 <optional>
       7              : #include <tuple>
       8              : #include <utility>
       9              : 
      10              : #include "DataStructures/DataBox/DataBox.hpp"
      11              : #include "Evolution/Systems/Cce/Actions/BoundaryComputeAndSendToEvolution.hpp"
      12              : #include "Parallel/AlgorithmExecution.hpp"
      13              : #include "Parallel/GlobalCache.hpp"
      14              : #include "Parallel/Invoke.hpp"
      15              : 
      16              : /// \cond
      17              : namespace Tags {
      18              : struct TimeStepId;
      19              : }  // namespace Tags
      20              : /// \endcond
      21              : 
      22              : namespace Cce {
      23              : namespace Actions {
      24              : 
      25              : /*!
      26              :  * \ingroup ActionsGroup
      27              :  * \brief Requests boundary data be sent from `WorldtubeBoundaryComponent` to
      28              :  * `EvolutionComponent` (template parameters).
      29              :  *
      30              :  * \details Calls the simple action
      31              :  * `Cce::Actions::BoundaryComputeAndSendToEvolution<WorldtubeBoundaryComponent,
      32              :  * EvolutionComponent>` on the `WorldtubeBoundaryComponent`, which performs
      33              :  * boundary computations then sends data to the `EvolutionComponent` via
      34              :  * `Cce::Actions::ReceiveWorldtubeData`. Requests the current
      35              :  * `Tags::TimeStepId`. For the majority of these requests, it's better to issue
      36              :  * them as early as possible to maximize the degree of parallelism for the
      37              :  * system, so most calls should use `Cce::Actions::RequestNextBoundaryData`,
      38              :  * because it can be called the substep prior to when the data will actually be
      39              :  * used.
      40              :  *
      41              :  * Uses:
      42              :  *  - DataBox:
      43              :  *    - `Tags::TimeStepId`
      44              :  *
      45              :  * \ref DataBoxGroup changes
      46              :  * - Adds: nothing
      47              :  * - Removes: nothing
      48              :  * - Modifies: nothing
      49              :  */
      50              : template <typename WorldtubeBoundaryComponent, typename EvolutionComponent>
      51            1 : struct RequestBoundaryData {
      52              :   template <typename DbTags, typename... InboxTags, typename Metavariables,
      53              :             typename ArrayIndex, typename ActionList,
      54              :             typename ParallelComponent>
      55            0 :   static Parallel::iterable_action_return_t apply(
      56              :       db::DataBox<DbTags>& box,
      57              :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      58              :       Parallel::GlobalCache<Metavariables>& cache,
      59              :       const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
      60              :       const ParallelComponent* const /*meta*/) {
      61              :     Parallel::simple_action<Actions::BoundaryComputeAndSendToEvolution<
      62              :         WorldtubeBoundaryComponent, EvolutionComponent>>(
      63              :         Parallel::get_parallel_component<WorldtubeBoundaryComponent>(cache),
      64              :         db::get<::Tags::TimeStepId>(box));
      65              :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      66              :   }
      67              : };
      68              : 
      69              : /*!
      70              :  * \ingroup ActionsGroup
      71              :  * \brief Requests boundary data be sent from `WorldtubeBoundaryComponent` to
      72              :  * `EvolutionComponent`.
      73              :  *
      74              :  * \details Calls the simple action
      75              :  * `Cce::Actions::BoundaryComputeAndSendToEvolution<WorldtubeBoundaryComponent,
      76              :  * EvolutionComponent>` on the `WorldtubeBoundaryComponent`, which performs
      77              :  * boundary computations then sends data to the `EvolutionComponent` via
      78              :  * `Cce::Actions::ReceiveWorldtubeData`. Requests the
      79              :  * `Tags::Next<Tags::TimeStepId>` (for the next timestep).
      80              :  *
      81              :  * Uses:
      82              :  *  - DataBox:
      83              :  *    - `Tags::Next<Tags::TimeStepId>`
      84              :  *
      85              :  * \ref DataBoxGroup changes
      86              :  * - Adds: nothing
      87              :  * - Removes: nothing
      88              :  * - Modifies: nothing
      89              :  */
      90              : template <typename WorldtubeBoundaryComponent, typename EvolutionComponent>
      91            1 : struct RequestNextBoundaryData {
      92            0 :   using const_global_cache_tags =
      93              :       tmpl::list<typename WorldtubeBoundaryComponent::end_time_tag>;
      94              : 
      95              :   template <typename DbTags, typename... InboxTags, typename Metavariables,
      96              :             typename ArrayIndex, typename ActionList,
      97              :             typename ParallelComponent>
      98            0 :   static Parallel::iterable_action_return_t apply(
      99              :       db::DataBox<DbTags>& box,
     100              :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
     101              :       Parallel::GlobalCache<Metavariables>& cache,
     102              :       const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
     103              :       const ParallelComponent* const /*meta*/) {
     104              :     // only request the data if the next step is not after the end time.
     105              :     const double substep_time =
     106              :         db::get<::Tags::Next<::Tags::TimeStepId>>(box).substep_time();
     107              :     const double end_time = db::get<Tags::EndTime>(box);
     108              :     if (substep_time < end_time) {
     109              :       Parallel::simple_action<Actions::BoundaryComputeAndSendToEvolution<
     110              :           WorldtubeBoundaryComponent, EvolutionComponent>>(
     111              :           Parallel::get_parallel_component<WorldtubeBoundaryComponent>(cache),
     112              :           db::get<::Tags::Next<::Tags::TimeStepId>>(box));
     113              :     }
     114              :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
     115              :   }
     116              : };
     117              : }  // namespace Actions
     118              : }  // namespace Cce
        

Generated by: LCOV version 2.0-1