SpECTRE Documentation Coverage Report
Current view: top level - Time/Triggers - OnSubsteps.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 <memory>
       7              : #include <pup.h>
       8              : #include <pup_stl.h>
       9              : #include <utility>
      10              : 
      11              : #include "DataStructures/DataBox/DataBoxTag.hpp"
      12              : #include "Options/Options.hpp"
      13              : #include "Options/ParseOptions.hpp"
      14              : #include "Options/String.hpp"
      15              : #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
      16              : #include "Utilities/Serialization/CharmPupable.hpp"
      17              : #include "Utilities/TMPL.hpp"
      18              : 
      19              : /// \cond
      20              : namespace db {
      21              : template <typename TagsList>
      22              : class DataBox;
      23              : }  // namespace db
      24              : /// \endcond
      25              : 
      26              : namespace Triggers {
      27              : /*!
      28              :  * \ingroup EventsAndTriggersGroup
      29              :  * \ingroup TimeGroup
      30              :  * Check a trigger on substeps, as well as full steps.  Primarily for
      31              :  * debugging.
      32              :  *
      33              :  * In LTS mode, only substeps of the first step in each slab will be
      34              :  * checked. Such substeps may not be aligned across the domain.
      35              :  *
      36              :  * The observation value on a substep is set to the start time of the
      37              :  * step plus $10^6$ times the substep number.
      38              :  *
      39              :  * This trigger can be used as:
      40              :  *
      41              :  * ```yaml
      42              :  * - Trigger:
      43              :  *     OnSubsteps:
      44              :  *       Always:
      45              :  * ```
      46              :  */
      47            1 : class OnSubsteps : public Trigger {
      48              :  public:
      49              :   /// \cond
      50              :   OnSubsteps() = default;
      51              :   explicit OnSubsteps(CkMigrateMessage* /*unused*/) {}
      52              :   using PUP::able::register_constructor;
      53              :   WRAPPED_PUPable_decl_template(OnSubsteps);  // NOLINT
      54              :   /// \endcond
      55              : 
      56            0 :   static constexpr Options::String help =
      57              :       "Check a trigger on substeps in addition to steps.";
      58              : 
      59            0 :   explicit OnSubsteps(std::unique_ptr<Trigger> trigger)
      60              :       : trigger_(std::move(trigger)) {}
      61              : 
      62            0 :   using argument_tags = tmpl::list<Tags::DataBox>;
      63              : 
      64              :   template <typename DbTags>
      65            0 :   bool operator()(const db::DataBox<DbTags>& box) const {
      66              :     // This trigger doesn't actually do anything.  All the special
      67              :     // logic is in the RunEventsAndTriggers action.  Just forward
      68              :     // along.
      69              :     return trigger_->is_triggered(box);
      70              :   }
      71              : 
      72              :   // NOLINTNEXTLINE(google-runtime-references)
      73            0 :   void pup(PUP::er& p) override { p | trigger_; }
      74              : 
      75              :  private:
      76            0 :   std::unique_ptr<Trigger> trigger_;
      77              : };
      78              : }  // namespace Triggers
      79              : 
      80              : template <>
      81            0 : struct Options::create_from_yaml<Triggers::OnSubsteps> {
      82              :   template <typename Metavariables>
      83            0 :   static Triggers::OnSubsteps create(const Option& options) {
      84              :     return Triggers::OnSubsteps(
      85              :         options.parse_as<std::unique_ptr<Trigger>, Metavariables>());
      86              :   }
      87              : };
        

Generated by: LCOV version 2.0-1