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