SpECTRE Documentation Coverage Report
Current view: top level - Time/StepChoosers - Random.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 16.0 % 25 4
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 <cstddef>
       7              : #include <limits>
       8              : #include <pup.h>
       9              : 
      10              : #include "Options/Context.hpp"
      11              : #include "Options/String.hpp"
      12              : #include "Time/StepChoosers/StepChooser.hpp"
      13              : #include "Time/TimeStepRequest.hpp"
      14              : #include "Utilities/Serialization/CharmPupable.hpp"
      15              : #include "Utilities/TMPL.hpp"
      16              : 
      17              : /// \cond
      18              : template <size_t VolumeDim>
      19              : class Element;
      20              : class TimeStepId;
      21              : namespace Tags {
      22              : struct TimeStepId;
      23              : }  // namespace Tags
      24              : namespace domain::Tags {
      25              : template <size_t VolumeDim>
      26              : struct Element;
      27              : }  // namespace domain::Tags
      28              : /// \endcond
      29              : 
      30              : namespace StepChoosers {
      31              : /// Changes the step size pseudo-randomly.  Values are distributed
      32              : /// uniformly in $\log(dt)$.  The current step is always accepted.
      33              : /// \note This StepChooser is for debugging.
      34              : template <size_t VolumeDim>
      35            1 : class Random : public StepChooser<StepChooserUse::Slab>,
      36              :                public StepChooser<StepChooserUse::LtsStep> {
      37              :  public:
      38              :   /// \cond
      39              :   Random();
      40              :   explicit Random(CkMigrateMessage* /*unused*/);
      41              :   using PUP::able::register_constructor;
      42              :   WRAPPED_PUPable_decl_template(Random);  // NOLINT
      43              :   /// \endcond
      44              : 
      45            0 :   struct Minimum {
      46            0 :     using type = double;
      47            0 :     static constexpr Options::String help{"Minimum value to suggest"};
      48            0 :     static type lower_bound() { return 0.0; }
      49              :   };
      50              : 
      51            0 :   struct Maximum {
      52            0 :     using type = double;
      53            0 :     static constexpr Options::String help{"Maximum value to suggest"};
      54            0 :     static type lower_bound() { return 0.0; }
      55              :   };
      56              : 
      57            0 :   struct Seed {
      58            0 :     using type = size_t;
      59            0 :     static constexpr Options::String help{"RNG seed"};
      60              :   };
      61              : 
      62            0 :   static constexpr Options::String help =
      63              :       "Changes the step size pseudo-randomly.";
      64            0 :   using options = tmpl::list<Minimum, Maximum, Seed>;
      65              : 
      66            0 :   Random(double minimum, double maximum, size_t seed,
      67              :          const Options::Context& context = {});
      68              : 
      69            0 :   using argument_tags =
      70              :       tmpl::list<domain::Tags::Element<VolumeDim>, Tags::TimeStepId>;
      71              : 
      72            0 :   TimeStepRequest operator()(const Element<VolumeDim>& element,
      73              :                              const TimeStepId& time_step_id,
      74              :                              double last_step) const;
      75              : 
      76            1 :   bool uses_local_data() const override;
      77            1 :   bool can_be_delayed() const override;
      78            1 :   bool must_set_step_size() const override;
      79              : 
      80              :   // NOLINTNEXTLINE(google-runtime-references)
      81            0 :   void pup(PUP::er& p) override;
      82              : 
      83              :  private:
      84            0 :   double minimum_ = std::numeric_limits<double>::signaling_NaN();
      85            0 :   double maximum_ = std::numeric_limits<double>::signaling_NaN();
      86            0 :   size_t seed_ = 0;
      87              : };
      88              : }  // namespace StepChoosers
        

Generated by: LCOV version 2.0-1