SpECTRE Documentation Coverage Report
Current view: top level - Time/Triggers - SlabCompares.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 6.2 % 16 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 <limits>
       7              : #include <pup.h>
       8              : 
       9              : #include "Options/Comparator.hpp"
      10              : #include "Options/String.hpp"
      11              : #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
      12              : #include "Time/TimeStepId.hpp"
      13              : #include "Utilities/Serialization/CharmPupable.hpp"
      14              : #include "Utilities/TMPL.hpp"
      15              : 
      16              : /// \cond
      17              : namespace Tags {
      18              : struct TimeStepId;
      19              : }  // namespace Tags
      20              : /// \endcond
      21              : 
      22              : namespace Triggers {
      23              : /// \ingroup EventsAndTriggersGroup
      24              : /// \ingroup TimeGroup
      25              : /// Trigger based on a comparison with the slab number.
      26            1 : class SlabCompares : public Trigger {
      27              :  public:
      28              :   /// \cond
      29              :   SlabCompares() = default;
      30              :   explicit SlabCompares(CkMigrateMessage* /*unused*/) {}
      31              :   using PUP::able::register_constructor;
      32              :   WRAPPED_PUPable_decl_template(SlabCompares);  // NOLINT
      33              :   /// \endcond
      34              : 
      35            0 :   struct Comparison {
      36            0 :     using type = Options::Comparator;
      37            0 :     constexpr static Options::String help = "Comparison type";
      38              :   };
      39              : 
      40            0 :   struct Value {
      41            0 :     using type = uint64_t;
      42            0 :     constexpr static Options::String help = "Value to compare to";
      43              :   };
      44              : 
      45            0 :   using options = tmpl::list<Comparison, Value>;
      46            0 :   static constexpr Options::String help{
      47              :       "Trigger based on a comparison with the slab number."};
      48              : 
      49            0 :   explicit SlabCompares(const Options::Comparator comparator,
      50              :                         const uint64_t slab_number)
      51              :       : comparator_(comparator), slab_number_(slab_number) {}
      52              : 
      53            0 :   using argument_tags = tmpl::list<Tags::TimeStepId>;
      54              : 
      55            0 :   bool operator()(const TimeStepId& time_step_id) const {
      56              :     return comparator_(static_cast<uint64_t>(time_step_id.slab_number()),
      57              :                        slab_number_);
      58              :   }
      59              : 
      60              :   // NOLINTNEXTLINE(google-runtime-references)
      61            0 :   void pup(PUP::er& p) {
      62              :     p | comparator_;
      63              :     p | slab_number_;
      64              :   }
      65              : 
      66              :  private:
      67            0 :   Options::Comparator comparator_{};
      68            0 :   uint64_t slab_number_{};
      69              : };
      70              : }  // namespace Triggers
        

Generated by: LCOV version 2.0-1