SpECTRE Documentation Coverage Report
Current view: top level - Time/Tags - TimeAndPrevious.hpp Hit Total Coverage
Commit: d7dc5bae4c2eeb465c1a076e919d884f4ccca7c5 Lines: 1 10 10.0 %
Date: 2024-05-01 22:09:14
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 <string>
       9             : 
      10             : #include "DataStructures/DataBox/Tag.hpp"
      11             : #include "DataStructures/LinkedMessageId.hpp"
      12             : #include "Utilities/GetOutput.hpp"
      13             : #include "Utilities/Gsl.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : /// \cond
      17             : namespace Tags {
      18             : struct Time;
      19             : struct PreviousTriggerTime;
      20             : }  // namespace Tags
      21             : /// \endcond
      22             : 
      23             : namespace Tags {
      24             : 
      25             : /// @{
      26             : /// \ingroup TimeGroup
      27             : /// \brief Tag for the current and previous time as doubles
      28             : ///
      29             : /// \warning The previous time is calculated via the value of the
      30             : /// ::Tags::PreviousTriggerTime. Therefore, this tag can only be
      31             : /// used in the context of dense triggers as that is where the
      32             : /// ::Tags::PreviousTriggerTime tag is set. Any Events that request
      33             : /// this tag in their `argument_tags` type alias, must be triggered by a
      34             : /// DenseTrigger.
      35             : ///
      36             : /// \note The Index is just so we can have multiple of this tag in the same
      37             : /// DataBox.
      38             : template <size_t Index>
      39           1 : struct TimeAndPrevious : db::SimpleTag {
      40           0 :   static constexpr size_t index = Index;
      41           0 :   using type = LinkedMessageId<double>;
      42           0 :   static std::string name() { return "TimeAndPrevious" + get_output(Index); }
      43             : };
      44             : 
      45             : template <size_t Index>
      46           0 : struct TimeAndPreviousCompute : TimeAndPrevious<Index>, db::ComputeTag {
      47           0 :   using argument_tags = tmpl::list<::Tags::Time, ::Tags::PreviousTriggerTime>;
      48           0 :   using base = TimeAndPrevious<Index>;
      49           0 :   using return_type = LinkedMessageId<double>;
      50             : 
      51           0 :   static void function(
      52             :       gsl::not_null<LinkedMessageId<double>*> time_and_previous,
      53             :       const double time, const std::optional<double>& previous_time) {
      54             :     time_and_previous->id = time;
      55             :     time_and_previous->previous = previous_time;
      56             :   }
      57             : };
      58             : /// @}
      59             : }  // namespace Tags

Generated by: LCOV version 1.14