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 :
8 : #include "Options/String.hpp"
9 : #include "Time/StepChoosers/StepChooser.hpp"
10 : #include "Time/TimeStepRequest.hpp"
11 : #include "Utilities/Serialization/CharmPupable.hpp"
12 : #include "Utilities/TMPL.hpp"
13 :
14 : /// \cond
15 : namespace PUP {
16 : class er;
17 : } // namespace PUP
18 : /// \endcond
19 :
20 : namespace StepChoosers {
21 : /// Limits step increase to a constant ratio.
22 1 : class LimitIncrease : public StepChooser<StepChooserUse::Slab>,
23 : public StepChooser<StepChooserUse::LtsStep> {
24 : public:
25 : /// \cond
26 : LimitIncrease() = default;
27 : explicit LimitIncrease(CkMigrateMessage* /*unused*/) {}
28 : using PUP::able::register_constructor;
29 : WRAPPED_PUPable_decl_template(LimitIncrease); // NOLINT
30 : /// \endcond
31 :
32 0 : struct Factor {
33 0 : using type = double;
34 0 : static constexpr Options::String help{"Factor to allow increase by"};
35 0 : static type lower_bound() { return 1.0; }
36 : };
37 :
38 0 : static constexpr Options::String help{
39 : "Limits step increase to a constant ratio."};
40 0 : using options = tmpl::list<Factor>;
41 :
42 0 : explicit LimitIncrease(double factor);
43 :
44 0 : using argument_tags = tmpl::list<>;
45 :
46 0 : TimeStepRequest operator()(double last_step) const;
47 :
48 1 : bool uses_local_data() const override;
49 1 : bool can_be_delayed() const override;
50 1 : bool must_set_step_size() const override;
51 :
52 : // NOLINTNEXTLINE(google-runtime-references)
53 0 : void pup(PUP::er& p) override;
54 :
55 : private:
56 0 : double factor_ = std::numeric_limits<double>::signaling_NaN();
57 : };
58 : } // namespace StepChoosers
|