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 "DataStructures/DataBox/DataBox.hpp"
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "Utilities/TMPL.hpp"
11 :
12 : /// \cond
13 : struct DataVector;
14 : /// \endcond
15 :
16 1 : namespace intrp::protocols {
17 : /*!
18 : * \brief A protocol for the type alias `compute_target_points` found in an
19 : * InterpolationTargetTag.
20 : *
21 : * \details A struct conforming to the `ComputeTargetPoints` protocol must have
22 : *
23 : * - a type alias `is_sequential` that is either `std::true_type` or
24 : * `std::false_type` which indicates if interpolations depend on previous
25 : * interpolations' results. It is assumed in the interpolation framework that
26 : * only horizon finds are sequential (e.y. anything that uses the
27 : * `intrp::Interpolator` component is a sequential horizon find).
28 : *
29 : * - a type alias `frame` that denotes the frame the target points are computed
30 : * in
31 : *
32 : * - a function `points` with signature matching the one in the example that
33 : * will compute the points in the given `frame` (with or without the `const &`
34 : * on the box argument).
35 : *
36 : * A struct that conforms to this protocol can optionally have any of these
37 : * members as well:
38 : *
39 : * - a type alias `simple_tags` that list simple tags to be added to the DataBox
40 : * of the InterpolationTarget
41 : *
42 : * - a type alias `compute_tags` that list compute tags to be added to the
43 : * DataBox of the InterpolationTarget
44 : *
45 : * - a type alias `const_global_cache_tags` with tags to be put in the
46 : * GlobalCache
47 : *
48 : * - a function `initialize` with signature matching the one in the example that
49 : * is run during the Initialization phase of the InterpolationTarget and can
50 : * initialize any of the `simple_tags` added.
51 : *
52 : * Here is an example of a class that conforms to this protocols:
53 : *
54 : * \snippet Helpers/ParallelAlgorithms/Interpolation/Examples.hpp ComputeTargetPoints
55 : */
56 1 : struct ComputeTargetPoints {
57 : template <typename ConformingType>
58 0 : struct test {
59 : struct DummyMetavariables;
60 0 : struct DummyTag : db::SimpleTag {
61 0 : using type = int;
62 : };
63 :
64 0 : using is_sequential = typename ConformingType::is_sequential;
65 : static_assert(std::is_same_v<is_sequential, std::true_type> or
66 : std::is_same_v<is_sequential, std::false_type>);
67 :
68 0 : using frame = typename ConformingType::frame;
69 : // We don't check the initialize() function because it is optional
70 : };
71 : };
72 : } // namespace intrp::protocols
|