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/ErrorOnFailedApparentHorizon.hpp" 15 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FailedHorizonFind.hpp" 16 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FindApparentHorizon.hpp" 17 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveCenters.hpp" 18 : #include "ParallelAlgorithms/ApparentHorizonFinder/ComputeHorizonVolumeQuantities.hpp" 19 : #include "ParallelAlgorithms/ApparentHorizonFinder/Destination.hpp" 20 : #include "ParallelAlgorithms/ApparentHorizonFinder/Events/FindApparentHorizon.hpp" 21 : #include "ParallelAlgorithms/ApparentHorizonFinder/HorizonAliases.hpp" 22 : #include "ParallelAlgorithms/ApparentHorizonFinder/InterpolationTarget.hpp" 23 : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/HorizonMetavars.hpp" 24 : #include "ParallelAlgorithms/Interpolation/Events/Interpolate.hpp" 25 : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" 26 : #include "Time/Tags/TimeAndPrevious.hpp" 27 : #include "Utilities/ProtocolHelpers.hpp" 28 : #include "Utilities/TMPL.hpp" 29 : 30 : /// \cond 31 : class DataVector; 32 : template <size_t VolumeDim> 33 : class ElementId; 34 : template <size_t Dim> 35 : class Mesh; 36 : namespace Parallel { 37 : template <typename Metavariables> 38 : class GlobalCache; 39 : } // namespace Parallel 40 : namespace domain::Tags { 41 : template <size_t Dim> 42 : struct Mesh; 43 : } // namespace domain::Tags 44 : /// \endcond 45 : 46 : namespace control_system::measurements { 47 : /*! 48 : * \brief A `control_system::protocols::Measurement` that relies on two apparent 49 : * horizons. 50 : */ 51 1 : struct BothHorizons : tt::ConformsTo<protocols::Measurement> { 52 : /*! 53 : * \brief A `control_system::protocols::Submeasurement` that starts the 54 : * interpolation to the interpolation target in order to find the apparent 55 : * horizon given by the template parameter `Horizon`. 56 : */ 57 : template <::domain::ObjectLabel Horizon> 58 1 : struct FindHorizon : tt::ConformsTo<protocols::Submeasurement> { 59 0 : static std::string name() { 60 : return "BothHorizons::FindHorizon" + ::domain::name(Horizon); 61 : } 62 : 63 : private: 64 : template <typename ControlSystems> 65 0 : struct InterpolationTarget 66 : : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> { 67 0 : static std::string name() { 68 : return "ControlSystemAh" + ::domain::name(Horizon); 69 : } 70 : 71 0 : using temporal_id = ::Tags::TimeAndPrevious<0>; 72 : 73 0 : using vars_to_interpolate_to_target = 74 : ::ah::vars_to_interpolate_to_target<3, ::Frame::Distorted>; 75 0 : using compute_vars_to_interpolate = ::ah::ComputeHorizonVolumeQuantities; 76 0 : using tags_to_observe = ::ah::tags_for_observing<Frame::Distorted>; 77 0 : using compute_items_on_target = 78 : ::ah::compute_items_on_target<3, Frame::Distorted>; 79 0 : using compute_items_on_source = 80 : tmpl::list<::Tags::TimeAndPreviousCompute<0>>; 81 0 : using compute_target_points = 82 : ah::TargetPoints::ApparentHorizon<InterpolationTarget, 83 : ::Frame::Distorted>; 84 0 : using post_interpolation_callbacks = 85 : tmpl::list<intrp::callbacks::FindApparentHorizon<InterpolationTarget, 86 : ::Frame::Distorted>>; 87 0 : using horizon_find_failure_callbacks = 88 : tmpl::list<intrp::callbacks::ErrorOnFailedApparentHorizon>; 89 0 : using post_horizon_find_callbacks = 90 : tmpl::list<control_system::RunCallbacks<FindHorizon, ControlSystems>, 91 : ::intrp::callbacks::ObserveCenters<InterpolationTarget, 92 : ::Frame::Distorted>>; 93 : }; 94 : 95 : template <typename ControlSystems> 96 0 : struct HorizonMetavars : tt::ConformsTo<ah::protocols::HorizonMetavars> { 97 0 : static std::string name() { 98 : return "ControlSystemAh" + ::domain::name(Horizon); 99 : } 100 : 101 0 : using time_tag = ::Tags::TimeAndPrevious<0>; 102 : 103 0 : using frame = ::Frame::Distorted; 104 : 105 0 : using horizon_find_callbacks = 106 : tmpl::list<control_system::RunCallbacks<FindHorizon, ControlSystems>, 107 : ::ah::callbacks::ObserveCenters<HorizonMetavars>>; 108 0 : using horizon_find_failure_callbacks = 109 : tmpl::list<ah::callbacks::FailedHorizonFind<HorizonMetavars, false>>; 110 : 111 0 : using compute_tags_on_element = 112 : tmpl::list<::Tags::TimeAndPreviousCompute<0>>; 113 : 114 0 : static constexpr ah::Destination destination = 115 : ah::Destination::ControlSystem; 116 : }; 117 : 118 : public: 119 : template <typename ControlSystems> 120 0 : using interpolation_target_tag = void; 121 : template <typename ControlSystems> 122 0 : using horizon_metavars = HorizonMetavars<ControlSystems>; 123 : 124 : template <typename ControlSystems> 125 0 : using event = NonFactoryCreatableWrapper< 126 : ah::Events::FindApparentHorizon<HorizonMetavars<ControlSystems>>>; 127 : }; 128 : 129 0 : using submeasurements = tmpl::list<FindHorizon<::domain::ObjectLabel::A>, 130 : FindHorizon<::domain::ObjectLabel::B>>; 131 : }; 132 : } // namespace control_system::measurements