Completion.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include "Evolution/EventsAndTriggers/Event.hpp"
7 #include "Options/Options.hpp"
10 #include "Utilities/Registration.hpp"
11 #include "Utilities/TMPL.hpp"
12 
13 namespace Events {
14 /// \ingroup EventsAndTriggersGroup
15 /// Sets the termination flag for the code to exit. This event is
16 /// automatically registered.
17 template <typename EventRegistrars = tmpl::list<>>
18 class Completion : public Event<EventRegistrars> {
19  public:
20  /// \cond
21  explicit Completion(CkMigrateMessage* /*unused*/) noexcept {}
22  using PUP::able::register_constructor;
24  /// \endcond
25 
26  using options = tmpl::list<>;
27  static constexpr OptionString help = {
28  "Sets the termination flag for the code to exit."};
29 
30  Completion() = default;
31 
32  using argument_tags = tmpl::list<>;
33 
34  template <typename Metavariables, typename ArrayIndex, typename Component>
35  void operator()(Parallel::ConstGlobalCache<Metavariables>& cache,
36  const ArrayIndex& array_index,
37  const Component* const /*meta*/) const noexcept {
38  auto al_gore =
39  Parallel::get_parallel_component<Component>(cache)[array_index]
40  .ckLocal();
41  al_gore->set_terminate(true);
42  }
43 };
44 
45 /// \cond
46 template <typename EventRegistrars>
47 PUP::able::PUP_ID Completion<EventRegistrars>::my_PUP_ID = 0; // NOLINT
48 /// \endcond
49 } // namespace Events
Defines classes and functions for making classes creatable from input files.
Defines macros to allow serialization of abstract template base classes.
Definition: Completion.hpp:13
#define WRAPPED_PUPable_decl_template(className)
Mark derived classes as serializable.
Definition: CharmPupable.hpp:22
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:26
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
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
Defines class template ConstGlobalCache.
Sets the termination flag for the code to exit. This event is automatically registered.
Definition: Completion.hpp:18