Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <string>
7 : #include <type_traits>
8 :
9 : #include "ParallelAlgorithms/ApparentHorizonFinder/Destination.hpp"
10 : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/Callback.hpp"
11 : #include "Utilities/ProtocolHelpers.hpp"
12 : #include "Utilities/TMPL.hpp"
13 :
14 : namespace ah::protocols {
15 : /*!
16 : * \brief A protocol for `HorizonMetavars`s that are used in the
17 : * `ah::Component` parallel component.
18 : *
19 : * \details A struct conforming to the `HorizonMetavars` protocol must
20 : * have
21 : *
22 : * - a type alias `time_tag` to a tag that tells the horizon finder
23 : * which time tag to use (for example, `::Tags::TimeAndPrevious`).
24 : *
25 : * - a type alias `frame` to the frame that the horizon find happens in (e.g.
26 : * `::Frame::Distorted`).
27 : *
28 : * - a type alias `compute_tags_on_element` which is a `tmpl::list` of compute
29 : * tags used in the `ObservationBox` on the elements.
30 : *
31 : * - a type alias `horizon_find_callbacks` which is a `tmpl::list` of callbacks
32 : * that conform to `ah::protocols::Callback`.
33 : *
34 : * - a type alias `horizon_find_failure_callbacks` which is a `tmpl::list` of
35 : * callbacks that conform to `ah::protocols::Callback`.
36 : *
37 : * - a static function `name()` that returns a `std::string`.
38 : *
39 : * - a static constexpr `ah::Destination` named `destination` which tells what
40 : * this horizon find is for.
41 : *
42 : * \snippet Helpers/ParallelAlgorithms/ApparentHorizonFinder/TestHelpers.hpp HorizonMetavars
43 : */
44 1 : struct HorizonMetavars {
45 : template <typename ConformingType>
46 0 : struct test {
47 0 : using time_tag = typename ConformingType::time_tag;
48 :
49 0 : using frame = typename ConformingType::frame;
50 :
51 0 : using horizon_find_callbacks =
52 : typename ConformingType::horizon_find_callbacks;
53 : static_assert(tmpl::all<horizon_find_callbacks,
54 : tt::assert_conforms_to<tmpl::_1, Callback>>::value);
55 0 : using horizon_find_failure_callbacks =
56 : typename ConformingType::horizon_find_failure_callbacks;
57 : static_assert(tmpl::all<horizon_find_failure_callbacks,
58 : tt::assert_conforms_to<tmpl::_1, Callback>>::value);
59 :
60 0 : using compute_tags_on_element =
61 : typename ConformingType::compute_tags_on_element;
62 :
63 : static_assert(std::is_same_v<decltype(ConformingType::destination),
64 : const Destination>);
65 :
66 : static_assert(
67 : std::is_same_v<decltype(ConformingType::name()), std::string>);
68 : };
69 : };
70 : } // namespace ah::protocols
|