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 "DataStructures/Tensor/IndexType.hpp" 14 : #include "Domain/Structure/ObjectLabel.hpp" 15 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ErrorOnFailedApparentHorizon.hpp" 16 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FailedHorizonFind.hpp" 17 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FindApparentHorizon.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 only one 49 : * apparent horizon; the template parameter `Horizon`. 50 : */ 51 : template <::domain::ObjectLabel Horizon> 52 1 : struct SingleHorizon : tt::ConformsTo<protocols::Measurement> { 53 0 : static std::string name() { 54 : return "SingleHorizon" + ::domain::name(Horizon); 55 : } 56 : 57 : /*! 58 : * \brief A `control_system::protocols::Submeasurement` that starts the 59 : * interpolation to the interpolation target in order to find the apparent 60 : * horizon. 61 : */ 62 1 : struct Submeasurement : tt::ConformsTo<protocols::Submeasurement> { 63 0 : static std::string name() { return SingleHorizon::name(); } 64 : 65 : private: 66 : template <typename ControlSystems> 67 0 : struct InterpolationTarget 68 : : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> { 69 0 : static std::string name() { 70 : return "ControlSystemSingleAh" + ::domain::name(Horizon); 71 : } 72 : 73 0 : using temporal_id = ::Tags::TimeAndPrevious<0>; 74 : 75 0 : using vars_to_interpolate_to_target = 76 : ::ah::vars_to_interpolate_to_target<3, ::Frame::Distorted>; 77 0 : using compute_vars_to_interpolate = ::ah::ComputeHorizonVolumeQuantities; 78 0 : using tags_to_observe = ::ah::tags_for_observing<Frame::Distorted>; 79 0 : using compute_items_on_target = 80 : ::ah::compute_items_on_target<3, Frame::Distorted>; 81 0 : using compute_items_on_source = 82 : tmpl::list<::Tags::TimeAndPreviousCompute<0>>; 83 0 : using compute_target_points = 84 : ah::TargetPoints::ApparentHorizon<InterpolationTarget, 85 : ::Frame::Distorted>; 86 0 : using post_interpolation_callbacks = 87 : tmpl::list<intrp::callbacks::FindApparentHorizon<InterpolationTarget, 88 : ::Frame::Distorted>>; 89 0 : using horizon_find_failure_callbacks = 90 : tmpl::list<intrp::callbacks::ErrorOnFailedApparentHorizon>; 91 0 : using post_horizon_find_callbacks = tmpl::list< 92 : control_system::RunCallbacks<Submeasurement, ControlSystems>>; 93 : }; 94 : 95 : template <typename ControlSystems> 96 0 : struct HorizonMetavars : tt::ConformsTo<ah::protocols::HorizonMetavars> { 97 0 : static std::string name() { 98 : return "ControlSystemSingleAh" + ::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 = tmpl::list< 106 : control_system::RunCallbacks<Submeasurement, ControlSystems>>; 107 0 : using horizon_find_failure_callbacks = 108 : tmpl::list<ah::callbacks::FailedHorizonFind<HorizonMetavars, false>>; 109 : 110 0 : using compute_tags_on_element = 111 : tmpl::list<::Tags::TimeAndPreviousCompute<0>>; 112 : 113 0 : static constexpr ah::Destination destination = 114 : ah::Destination::ControlSystem; 115 : }; 116 : 117 : public: 118 : template <typename ControlSystems> 119 0 : using interpolation_target_tag = void; 120 : template <typename ControlSystems> 121 0 : using horizon_metavars = HorizonMetavars<ControlSystems>; 122 : 123 : template <typename ControlSystems> 124 0 : using event = NonFactoryCreatableWrapper< 125 : ah::Events::FindApparentHorizon<HorizonMetavars<ControlSystems>>>; 126 : }; 127 : 128 0 : using submeasurements = tmpl::list<Submeasurement>; 129 : }; 130 : } // namespace control_system::measurements