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 <vector> 8 : 9 : #include "Options/String.hpp" 10 : #include "Time/StepChoosers/StepChooser.hpp" 11 : #include "Time/TimeStepRequest.hpp" 12 : #include "Utilities/Serialization/CharmPupable.hpp" 13 : #include "Utilities/TMPL.hpp" 14 : 15 : /// \cond 16 : template <size_t VolumeDim> 17 : class Element; 18 : namespace domain { 19 : namespace Tags { 20 : template <size_t VolumeDim> 21 : struct Element; 22 : } // namespace Tags 23 : } // namespace domain 24 : namespace PUP { 25 : class er; 26 : } // namespace PUP 27 : /// \endcond 28 : 29 1 : namespace StepChoosers { 30 : /// Sets a goal specified per-block. 31 : /// 32 : /// \note This debugging StepChooser is not included in the 33 : /// `standard_step_choosers` list, but can be added to the 34 : /// `factory_creation` struct in the metavariables. 35 : template <size_t Dim> 36 1 : class ByBlock : public StepChooser<StepChooserUse::Slab>, 37 : public StepChooser<StepChooserUse::LtsStep> { 38 : public: 39 : /// \cond 40 : ByBlock() = default; 41 : explicit ByBlock(CkMigrateMessage* /*unused*/) {} 42 : using PUP::able::register_constructor; 43 : WRAPPED_PUPable_decl_template(ByBlock); // NOLINT 44 : /// \endcond 45 : 46 0 : struct Sizes { 47 0 : using type = std::vector<double>; 48 0 : static constexpr Options::String help{ 49 : "Step sizes, indexed by block number"}; 50 : }; 51 : 52 0 : static constexpr Options::String help{"Sets a goal specified per-block."}; 53 0 : using options = tmpl::list<Sizes>; 54 : 55 0 : explicit ByBlock(std::vector<double> sizes); 56 : 57 0 : using argument_tags = tmpl::list<domain::Tags::Element<Dim>>; 58 : 59 0 : TimeStepRequest operator()(const Element<Dim>& element, 60 : double last_step) const; 61 : 62 1 : bool uses_local_data() const override; 63 1 : bool can_be_delayed() const override; 64 : 65 : // NOLINTNEXTLINE(google-runtime-references) 66 0 : void pup(PUP::er& p) override; 67 : 68 : private: 69 0 : std::vector<double> sizes_; 70 : }; 71 : } // namespace StepChoosers