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 <string>
8 :
9 : #include "ControlSystem/Measurements/NonFactoryCreatable.hpp"
10 : #include "ControlSystem/Protocols/Measurement.hpp"
11 : #include "ControlSystem/Protocols/Submeasurement.hpp"
12 : #include "ControlSystem/RunCallbacks.hpp"
13 : #include "Domain/Structure/ObjectLabel.hpp"
14 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FailedHorizonFind.hpp"
15 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveCenters.hpp"
16 : #include "ParallelAlgorithms/ApparentHorizonFinder/Destination.hpp"
17 : #include "ParallelAlgorithms/ApparentHorizonFinder/Events/FindApparentHorizon.hpp"
18 : #include "ParallelAlgorithms/ApparentHorizonFinder/HorizonAliases.hpp"
19 : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/HorizonMetavars.hpp"
20 : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp"
21 : #include "Time/Tags/TimeAndPrevious.hpp"
22 : #include "Utilities/ProtocolHelpers.hpp"
23 : #include "Utilities/TMPL.hpp"
24 :
25 : /// \cond
26 : class DataVector;
27 : template <size_t VolumeDim>
28 : class ElementId;
29 : template <size_t Dim>
30 : class Mesh;
31 : namespace Parallel {
32 : template <typename Metavariables>
33 : class GlobalCache;
34 : } // namespace Parallel
35 : namespace domain::Tags {
36 : template <size_t Dim>
37 : struct Mesh;
38 : } // namespace domain::Tags
39 : /// \endcond
40 :
41 : namespace control_system::measurements {
42 : /*!
43 : * \brief A `control_system::protocols::Measurement` that relies on two apparent
44 : * horizons.
45 : */
46 1 : struct BothHorizons : tt::ConformsTo<protocols::Measurement> {
47 : /*!
48 : * \brief A `control_system::protocols::Submeasurement` that starts the
49 : * interpolation to the interpolation target in order to find the apparent
50 : * horizon given by the template parameter `Horizon`.
51 : */
52 : template <::domain::ObjectLabel Horizon>
53 1 : struct FindHorizon : tt::ConformsTo<protocols::Submeasurement> {
54 0 : static std::string name() {
55 : return "BothHorizons::FindHorizon" + ::domain::name(Horizon);
56 : }
57 :
58 : private:
59 : template <typename ControlSystems>
60 0 : struct HorizonMetavars : tt::ConformsTo<ah::protocols::HorizonMetavars> {
61 0 : static std::string name() {
62 : return "ControlSystemAh" + ::domain::name(Horizon);
63 : }
64 :
65 0 : using time_tag = ::Tags::TimeAndPrevious<0>;
66 :
67 0 : using frame = ::Frame::Distorted;
68 :
69 0 : using horizon_find_callbacks =
70 : tmpl::list<control_system::RunCallbacks<FindHorizon, ControlSystems>,
71 : ::ah::callbacks::ObserveCenters<HorizonMetavars>>;
72 0 : using horizon_find_failure_callbacks =
73 : tmpl::list<ah::callbacks::FailedHorizonFind<HorizonMetavars, false>>;
74 :
75 0 : using compute_tags_on_element =
76 : tmpl::list<::Tags::TimeAndPreviousCompute<0>>;
77 :
78 0 : static constexpr ah::Destination destination =
79 : ah::Destination::ControlSystem;
80 : };
81 :
82 : public:
83 : template <typename ControlSystems>
84 0 : using interpolation_target_tag = void;
85 : template <typename ControlSystems>
86 0 : using horizon_metavars = HorizonMetavars<ControlSystems>;
87 :
88 : template <typename ControlSystems>
89 0 : using event = NonFactoryCreatableWrapper<
90 : ah::Events::FindApparentHorizon<HorizonMetavars<ControlSystems>>>;
91 : };
92 :
93 0 : using submeasurements = tmpl::list<FindHorizon<::domain::ObjectLabel::A>,
94 : FindHorizon<::domain::ObjectLabel::B>>;
95 : };
96 : } // namespace control_system::measurements
|