SpECTRE Documentation Coverage Report
Current view: top level - Time/Actions - AdvanceTime.hpp Hit Total Coverage
Commit: 25e47f6c1f478fabc9818b4c4e199a5bd19054b4 Lines: 2 3 66.7 %
Date: 2022-06-24 19:42:36
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Defines action AdvanceTime
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <tuple>
      10             : 
      11             : #include "DataStructures/DataBox/DataBox.hpp"
      12             : #include "Time/Tags.hpp"
      13             : #include "Time/Time.hpp"
      14             : #include "Time/TimeStepId.hpp"
      15             : #include "Time/TimeSteppers/TimeStepper.hpp"
      16             : #include "Utilities/Gsl.hpp"
      17             : #include "Utilities/TaggedTuple.hpp"
      18             : 
      19             : /// \cond
      20             : namespace Parallel {
      21             : template <typename Metavariables>
      22             : class GlobalCache;
      23             : }  // namespace Parallel
      24             : namespace Tags {
      25             : template <typename Tag>
      26             : struct Next;
      27             : }  // namespace Tags
      28             : // IWYU pragma: no_forward_declare db::DataBox
      29             : /// \endcond
      30             : 
      31             : namespace Actions {
      32             : /// \ingroup ActionsGroup
      33             : /// \ingroup TimeGroup
      34             : /// \brief Advance time one substep
      35             : ///
      36             : /// Uses:
      37             : /// - DataBox:
      38             : ///   - Tags::TimeStep
      39             : ///   - Tags::TimeStepId
      40             : ///   - Tags::TimeStepper<>
      41             : ///
      42             : /// DataBox changes:
      43             : /// - Adds: nothing
      44             : /// - Removes: nothing
      45             : /// - Modifies:
      46             : ///   - Tags::Next<Tags::TimeStepId>
      47             : ///   - Tags::Time
      48             : ///   - Tags::TimeStepId
      49             : ///   - Tags::TimeStep
      50           1 : struct AdvanceTime {
      51             :   template <typename DbTags, typename... InboxTags, typename Metavariables,
      52             :             typename ArrayIndex, typename ActionList,
      53             :             typename ParallelComponent>
      54           0 :   static std::tuple<db::DataBox<DbTags>&&> apply(
      55             :       db::DataBox<DbTags>& box, tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      56             :       const Parallel::GlobalCache<Metavariables>& /*cache*/,
      57             :       const ArrayIndex& /*array_index*/, ActionList /*meta*/,
      58             :       const ParallelComponent* const /*meta*/) {  // NOLINT const
      59             :     db::mutate<Tags::TimeStepId, Tags::Next<Tags::TimeStepId>, Tags::TimeStep,
      60             :                Tags::Time, Tags::Next<Tags::TimeStep>>(
      61             :         make_not_null(&box),
      62             :         [](const gsl::not_null<TimeStepId*> time_id,
      63             :            const gsl::not_null<TimeStepId*> next_time_id,
      64             :            const gsl::not_null<TimeDelta*> time_step,
      65             :            const gsl::not_null<double*> time,
      66             :            const gsl::not_null<TimeDelta*> next_time_step,
      67             :            const TimeStepper& time_stepper) {
      68             :           *time_id = *next_time_id;
      69             :           *time_step = next_time_step->with_slab(time_id->step_time().slab());
      70             : 
      71             :           *next_time_id = time_stepper.next_time_id(*next_time_id, *time_step);
      72             :           *next_time_step =
      73             :               time_step->with_slab(next_time_id->step_time().slab());
      74             :           *time = time_id->substep_time().value();
      75             :         },
      76             :         db::get<Tags::TimeStepper<>>(box));
      77             : 
      78             :     return std::forward_as_tuple(std::move(box));
      79             :   }
      80             : };
      81             : }  // namespace Actions

Generated by: LCOV version 1.14