Event.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
9 #include "Utilities/FakeVirtual.hpp"
10 #include "Utilities/Registration.hpp"
11 #include "Utilities/TMPL.hpp"
12 
13 /// \cond
14 namespace Events {
15 template <typename EventRegistrars>
16 class Completion;
17 } // namespace Events
18 /// \endcond
19 
20 /// \ingroup EventsAndTriggersGroup
21 namespace Events {
22 /// Registrars for Events
23 namespace Registrars {}
24 } // namespace Events
25 
26 /// \ingroup EventsAndTriggersGroup
27 /// Base class for something that can happen during a simulation (such
28 /// as an observation).
29 template <typename EventRegistrars>
30 class Event : public PUP::able {
31  protected:
32  /// \cond
33  Event() = default;
34  Event(const Event&) = default;
35  Event(Event&&) = default;
36  Event& operator=(const Event&) = default;
37  Event& operator=(Event&&) = default;
38  /// \endcond
39 
40  public:
41  ~Event() override = default;
42 
44 
45  using default_events = tmpl::list<Events::Completion<EventRegistrars>>;
46 
47  using creatable_classes =
48  tmpl::append<default_events, Registration::registrants<EventRegistrars>>;
49 
50  template <typename DbTags, typename Metavariables, typename ArrayIndex,
51  typename ComponentPointer>
52  void run(const db::DataBox<DbTags>& box,
54  const ArrayIndex& array_index,
55  const ComponentPointer /*meta*/) noexcept {
56  call_with_dynamic_type<void, creatable_classes>(
57  this,
58  [&box, &cache, &array_index](auto* const event) noexcept {
59  using EventType = std::decay_t<decltype(*event)>;
60  db::apply<typename EventType::argument_tags>(
61  *event, box, cache, array_index, ComponentPointer{});
62  });
63  }
64 };
65 
66 #include "Evolution/EventsAndTriggers/Completion.hpp"
Defines macros to allow serialization of abstract template base classes.
Definition: Completion.hpp:13
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
#define WRAPPED_PUPable_abstract(className)
Wraps the Charm++ macro, see the Charm++ documentation.
Definition: CharmPupable.hpp:39
Wraps the template metaprogramming library used (brigand)
Base class for something that can happen during a simulation (such as an observation).
Definition: Event.hpp:30
Definition: SolvePoissonProblem.hpp:38
Defines class template ConstGlobalCache.