Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <pup.h>
7 :
8 : #include "NumericalAlgorithms/Convergence/HasConverged.hpp"
9 : #include "NumericalAlgorithms/Convergence/Tags.hpp"
10 : #include "Options/String.hpp"
11 : #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
12 : #include "Utilities/Serialization/CharmPupable.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : namespace elliptic::Triggers {
16 : /// \ingroup EventsAndTriggersGroup
17 : /// Trigger when the solver identified by the `Label` has converged.
18 : template <typename Label>
19 1 : class HasConverged : public Trigger {
20 : public:
21 : /// \cond
22 : HasConverged() = default;
23 : explicit HasConverged(CkMigrateMessage* /*unused*/) {}
24 : using PUP::able::register_constructor;
25 : WRAPPED_PUPable_decl_template(HasConverged); // NOLINT
26 : /// \endcond
27 :
28 0 : using options = tmpl::list<>;
29 0 : static constexpr Options::String help{
30 : "Trigger when the solver has converged."};
31 :
32 0 : using argument_tags = tmpl::list<Convergence::Tags::HasConverged<Label>>;
33 :
34 0 : bool operator()(const Convergence::HasConverged& has_converged) const {
35 : return static_cast<bool>(has_converged);
36 : }
37 : };
38 :
39 : /// \cond
40 : template <typename Label>
41 : PUP::able::PUP_ID HasConverged<Label>::my_PUP_ID = 0; // NOLINT
42 : /// \endcond
43 : } // namespace elliptic::Triggers
|