Times.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <memory>
7 #include <pup.h>
8 
9 #include "Evolution/EventsAndDenseTriggers/DenseTrigger.hpp"
10 #include "Options/Options.hpp"
11 #include "Options/ParseOptions.hpp"
13 #include "Time/TimeSequence.hpp"
14 #include "Utilities/TMPL.hpp"
15 
16 /// \cond
17 class TimeStepId;
18 namespace Tags {
19 struct Time;
20 struct TimeStepId;
21 } // namespace Tags
22 /// \endcond
23 
24 namespace DenseTriggers {
25 /// \ingroup EventsAndTriggersGroup
26 /// \ingroup TimeGroup
27 /// Trigger at specified times.
28 class Times : public DenseTrigger {
29  public:
30  /// \cond
31  Times() = default;
32  explicit Times(CkMigrateMessage* const msg) noexcept : DenseTrigger(msg) {}
33  using PUP::able::register_constructor;
35  /// \endcond
36 
37  static constexpr Options::String help{"Trigger at specified times."};
38 
39  explicit Times(std::unique_ptr<TimeSequence<double>> times) noexcept;
40 
41  using is_triggered_argument_tags = tmpl::list<Tags::TimeStepId, Tags::Time>;
42 
43  Result is_triggered(const TimeStepId& time_step_id,
44  const double time) const noexcept;
45 
46  using is_ready_argument_tags = tmpl::list<>;
47 
48  static bool is_ready() noexcept;
49 
50  // NOLINTNEXTLINE(google-runtime-references)
51  void pup(PUP::er& p) noexcept override;
52 
53  private:
55 };
56 } // namespace DenseTriggers
57 
58 template <>
59 struct Options::create_from_yaml<DenseTriggers::Times> {
60  template <typename Metavariables>
61  static DenseTriggers::Times create(const Option& options) {
62  return DenseTriggers::Times(
63  options
64  .parse_as<std::unique_ptr<TimeSequence<double>>, Metavariables>());
65  }
66 };
CharmPupable.hpp
Options.hpp
ParseOptions.hpp
Options::Option
Definition: Options.hpp:108
TimeSequence
Represents a sequence of times.
Definition: TimeSequence.hpp:21
DenseTrigger
Definition: DenseTrigger.hpp:27
WRAPPED_PUPable_decl_template
#define WRAPPED_PUPable_decl_template(className)
Mark derived classes as serializable.
Definition: CharmPupable.hpp:22
Options::create_from_yaml
Definition: MinmodType.hpp:11
memory
DenseTrigger::Result
Result type for the is_triggered method.
Definition: DenseTrigger.hpp:34
TimeStepId
Definition: TimeStepId.hpp:25
Time
Definition: Time.hpp:29
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
std::unique_ptr
TMPL.hpp
DenseTriggers::Times
Definition: Times.hpp:28