SpECTRE Documentation Coverage Report
Current view: top level - Time/Triggers - Slabs.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 10.0 % 10 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 <cstdint>
       7              : #include <memory>
       8              : #include <pup.h>
       9              : #include <pup_stl.h>
      10              : #include <utility>
      11              : 
      12              : #include "Options/ParseOptions.hpp"
      13              : #include "Options/String.hpp"
      14              : #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
      15              : #include "Time/TimeSequence.hpp"
      16              : #include "Time/TimeStepId.hpp"
      17              : #include "Utilities/Serialization/CharmPupable.hpp"
      18              : #include "Utilities/TMPL.hpp"
      19              : 
      20              : /// \cond
      21              : namespace Tags {
      22              : struct TimeStepId;
      23              : }  // namespace Tags
      24              : /// \endcond
      25              : 
      26              : namespace Triggers {
      27              : /// \ingroup EventsAndTriggersGroup
      28              : /// \ingroup TimeGroup
      29              : /// Trigger at specified numbers of slabs after the simulation start.
      30            1 : class Slabs : public Trigger {
      31              :  public:
      32              :   /// \cond
      33              :   Slabs() = default;
      34              :   explicit Slabs(CkMigrateMessage* /*unused*/) {}
      35              :   using PUP::able::register_constructor;
      36              :   WRAPPED_PUPable_decl_template(Slabs);  // NOLINT
      37              :   /// \endcond
      38              : 
      39            0 :   static constexpr Options::String help{
      40              :     "Trigger at specified numbers of slabs after the simulation start."};
      41              : 
      42            0 :   explicit Slabs(std::unique_ptr<TimeSequence<uint64_t>> slabs)
      43              :       : slabs_(std::move(slabs)) {}
      44              : 
      45            0 :   using argument_tags = tmpl::list<Tags::TimeStepId>;
      46              : 
      47            0 :   bool operator()(const TimeStepId& time_id) const {
      48              :     const auto unsigned_slab =
      49              :         static_cast<std::uint64_t>(time_id.slab_number());
      50              :     return slabs_->times_near(unsigned_slab)[1] == unsigned_slab;
      51              :   }
      52              : 
      53              :   // NOLINTNEXTLINE(google-runtime-references)
      54            0 :   void pup(PUP::er& p) override { p | slabs_; }
      55              : 
      56              :  private:
      57            0 :   std::unique_ptr<TimeSequence<uint64_t>> slabs_{};
      58              : };
      59              : }  // namespace Triggers
      60              : 
      61              : template <>
      62            0 : struct Options::create_from_yaml<Triggers::Slabs> {
      63              :   template <typename Metavariables>
      64            0 :   static Triggers::Slabs create(const Option& options) {
      65              :     return Triggers::Slabs(
      66              :         options.parse_as<std::unique_ptr<TimeSequence<uint64_t>>,
      67              :                          Metavariables>());
      68              :   }
      69              : };
        

Generated by: LCOV version 2.0-1