SpECTRE Documentation Coverage Report
Current view: top level - Time/StepChoosers - Increase.hpp Hit Total Coverage
Commit: aabde07399ba7837e5db64eedfd0a21f31f96922 Lines: 2 14 14.3 %
Date: 2024-04-26 02:38:13
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 <cmath>
       7             : #include <limits>
       8             : #include <pup.h>
       9             : #include <utility>
      10             : 
      11             : #include "Options/String.hpp"
      12             : #include "Time/StepChoosers/StepChooser.hpp"  // IWYU pragma: keep
      13             : #include "Utilities/Serialization/CharmPupable.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : namespace StepChoosers {
      17             : /// Suggests increasing the step size by a constant ratio.
      18             : template <typename StepChooserUse>
      19           1 : class Increase : public StepChooser<StepChooserUse> {
      20             :  public:
      21             :   /// \cond
      22             :   Increase() = default;
      23             :   explicit Increase(CkMigrateMessage* /*unused*/) {}
      24             :   using PUP::able::register_constructor;
      25             :   WRAPPED_PUPable_decl_template(Increase);  // NOLINT
      26             :   /// \endcond
      27             : 
      28           0 :   struct Factor {
      29           0 :     using type = double;
      30           0 :     static constexpr Options::String help{"Factor to increase by"};
      31           0 :     static type lower_bound() { return 1.0; }
      32             :   };
      33             : 
      34           0 :   static constexpr Options::String help{"Suggests a constant factor increase."};
      35           0 :   using options = tmpl::list<Factor>;
      36             : 
      37           0 :   explicit Increase(const double factor) : factor_(factor) {}
      38             : 
      39           0 :   using argument_tags = tmpl::list<>;
      40             : 
      41           0 :   std::pair<double, bool> operator()(const double last_step_magnitude) const {
      42             :     return std::make_pair(last_step_magnitude * factor_, true);
      43             :   }
      44             : 
      45           1 :   bool uses_local_data() const override { return false; }
      46             : 
      47             :   // NOLINTNEXTLINE(google-runtime-references)
      48           0 :   void pup(PUP::er& p) override { p | factor_; }
      49             : 
      50             :  private:
      51           0 :   double factor_ = std::numeric_limits<double>::signaling_NaN();
      52             : };
      53             : 
      54             : /// \cond
      55             : template <typename StepChooserUse>
      56             : PUP::able::PUP_ID Increase<StepChooserUse>::my_PUP_ID = 0;  // NOLINT
      57             : /// \endcond
      58             : }  // namespace StepChoosers

Generated by: LCOV version 1.14