Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <type_traits> 7 : 8 : #include "Utilities/TMPL.hpp" 9 : 10 : namespace control_system::protocols { 11 : /*! 12 : * \brief Definition of a portion of a measurement for the control 13 : * systems 14 : * 15 : * These structs are referenced from structs conforming to the 16 : * Measurement protocol. They define independent parts of a control 17 : * system measurement, such as individual horizon-finds in a 18 : * two-horizon measurement. 19 : * 20 : * A conforming struct must provide 21 : * 22 : * - An `interpolation_target_tag` type alias templated on the \ref 23 : * ControlSystem "control systems" using this submeasurement. (This template 24 : * parameter must be used in the call to `RunCallbacks` discussed below.) This 25 : * alias may be `void` if the submeasurement does not use an interpolation 26 : * target tag. This is only used to collect the tags that must be registered 27 : * in the metavariables. 28 : * - An `event` type alias also templated on the 29 : * \ref ControlSystem "control systems" using this submeasurement which is an 30 : * `::Event`. It is templated on the control systems because the event usually 31 : * takes the `interpolation_target_tag` as a template parameter. Currently, 32 : * this event must be fully functional when it is default constructed. It will 33 : * not be constructed with any arguments. 34 : * 35 : * The `event` will be run on every element, and they must collectively 36 : * result in a single call on one chare (which need not be one of the element 37 : * chares) to `control_system::RunCallbacks<ConformingStructBeingDefinedHere, 38 : * ControlSystems>::apply`. This will almost always require performing a 39 : * reduction. The `ControlSystems` template parameter passed to `RunCallbacks` 40 : * here must be the same type that was passed to the `interpolation_target_tag` 41 : * and `event` type aliases. The `ControlSystems` template parameter will be 42 : * a list of all control systems that use the same Submeasurement. 43 : * 44 : * Here's an example for a class conforming to this protocol: 45 : * 46 : * \snippet Helpers/ControlSystem/Examples.hpp Submeasurement 47 : */ 48 1 : struct Submeasurement { 49 : template <typename ConformingType> 50 0 : struct test { 51 : struct DummyControlSystem; 52 : 53 0 : using interpolation_target_tag = 54 : typename ConformingType::template interpolation_target_tag< 55 : tmpl::list<DummyControlSystem>>; 56 : 57 0 : using event = 58 : typename ConformingType::template event<tmpl::list<DummyControlSystem>>; 59 : }; 60 : }; 61 : } // namespace control_system::protocols