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/Interpolation/Events/Interpolate.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 only one 44 : * apparent horizon; the template parameter `Horizon`. 45 : */ 46 : template <::domain::ObjectLabel Horizon> 47 1 : struct SingleHorizon : tt::ConformsTo<protocols::Measurement> { 48 0 : static std::string name() { 49 : return "SingleHorizon" + ::domain::name(Horizon); 50 : } 51 : 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. 56 : */ 57 1 : struct Submeasurement : tt::ConformsTo<protocols::Submeasurement> { 58 0 : static std::string name() { return SingleHorizon::name(); } 59 : 60 : private: 61 : template <typename ControlSystems> 62 0 : struct InterpolationTarget 63 : : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> { 64 0 : static std::string name() { 65 : return "ControlSystemSingleAh" + ::domain::name(Horizon); 66 : } 67 : 68 0 : using temporal_id = ::Tags::TimeAndPrevious<0>; 69 : 70 0 : using vars_to_interpolate_to_target = 71 : ::ah::vars_to_interpolate_to_target<3, ::Frame::Distorted>; 72 0 : using compute_vars_to_interpolate = ::ah::ComputeHorizonVolumeQuantities; 73 0 : using tags_to_observe = ::ah::tags_for_observing<Frame::Distorted>; 74 0 : using compute_items_on_target = 75 : ::ah::compute_items_on_target<3, Frame::Distorted>; 76 0 : using compute_items_on_source = 77 : tmpl::list<::Tags::TimeAndPreviousCompute<0>>; 78 0 : using compute_target_points = 79 : intrp::TargetPoints::ApparentHorizon<InterpolationTarget, 80 : ::Frame::Distorted>; 81 0 : using post_interpolation_callbacks = 82 : tmpl::list<intrp::callbacks::FindApparentHorizon<InterpolationTarget, 83 : ::Frame::Distorted>>; 84 0 : using horizon_find_failure_callback = 85 : intrp::callbacks::ErrorOnFailedApparentHorizon; 86 0 : using post_horizon_find_callbacks = tmpl::list< 87 : control_system::RunCallbacks<Submeasurement, ControlSystems>>; 88 : }; 89 : 90 : public: 91 : template <typename ControlSystems> 92 0 : using interpolation_target_tag = InterpolationTarget<ControlSystems>; 93 : 94 : template <typename ControlSystems> 95 0 : using event = NonFactoryCreatableWrapper<intrp::Events::Interpolate< 96 : 3, InterpolationTarget<ControlSystems>, ::ah::source_vars<3>>>; 97 : }; 98 : 99 0 : using submeasurements = tmpl::list<Submeasurement>; 100 : }; 101 : } // namespace control_system::measurements