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 <deque>
8 : #include <optional>
9 : #include <string>
10 : #include <type_traits>
11 : #include <unordered_map>
12 : #include <unordered_set>
13 :
14 : #include "DataStructures/DataBox/PrefixHelpers.hpp"
15 : #include "DataStructures/DataBox/Tag.hpp"
16 : #include "DataStructures/TaggedTuple.hpp"
17 : #include "DataStructures/Variables.hpp"
18 : #include "IO/Logging/Tags.hpp"
19 : #include "IO/Logging/Verbosity.hpp"
20 : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
21 : #include "Options/String.hpp"
22 :
23 : /// \cond
24 : template <size_t VolumeDim>
25 : class ElementId;
26 : /// \endcond
27 :
28 : namespace intrp {
29 :
30 0 : namespace OptionTags {
31 : /*!
32 : * \ingroup OptionGroupsGroup
33 : * \brief Groups option tags for InterpolationTargets.
34 : */
35 1 : struct InterpolationTargets {
36 0 : static constexpr Options::String help{"Options for interpolation targets"};
37 : };
38 :
39 : /*!
40 : * \ingroup OptionGroupsGroup
41 : * \brief Groups option tags for the Interpolator.
42 : */
43 1 : struct Interpolator {
44 0 : static constexpr Options::String help{
45 : "Options related to the Interpolator parallel component"};
46 : };
47 : } // namespace OptionTags
48 :
49 : /// Tags for items held in the `DataBox` of `InterpolationTarget` or
50 : /// `Interpolator`.
51 : namespace Tags {
52 : /// Tag that determines the verbosity of output from the interpolation target
53 1 : struct Verbosity : db::SimpleTag {
54 0 : using type = ::Verbosity;
55 :
56 0 : using option_tags =
57 : tmpl::list<logging::OptionTags::Verbosity<OptionTags::Interpolator>>;
58 0 : static constexpr bool pass_metavariables = false;
59 0 : static ::Verbosity create_from_options(const ::Verbosity& verbosity) {
60 : return verbosity;
61 : }
62 : };
63 :
64 : /// Keeps track of which points have been filled with interpolated data.
65 : template <typename TemporalId>
66 1 : struct IndicesOfFilledInterpPoints : db::SimpleTag {
67 0 : using type = std::unordered_map<TemporalId, std::unordered_set<size_t>>;
68 : };
69 :
70 : /// Keeps track of points that cannot be filled with interpolated data.
71 : ///
72 : /// The InterpolationTarget can decide what to do with these points.
73 : /// In most cases the correct action is to throw an error, but in other
74 : /// cases one might wish to fill these points with a default value or
75 : /// take some other action.
76 : template <typename TemporalId>
77 1 : struct IndicesOfInvalidInterpPoints : db::SimpleTag {
78 0 : using type = std::unordered_map<TemporalId, std::unordered_set<size_t>>;
79 : };
80 :
81 : /// `temporal_id`s on which to interpolate.
82 : ///
83 : /// \note This tag is only used in non-sequential targets
84 : template <typename TemporalId>
85 1 : struct TemporalIds : db::SimpleTag {
86 0 : using type = std::unordered_set<TemporalId>;
87 : };
88 :
89 : /// `temporal_id`s that we have already interpolated onto.
90 : /// This is used to prevent problems with multiple late calls.
91 : template <typename TemporalId>
92 1 : struct CompletedTemporalIds : db::SimpleTag {
93 0 : using type = std::deque<TemporalId>;
94 : };
95 :
96 : /// Holds interpolated variables on an InterpolationTarget.
97 : template <typename InterpolationTargetTag, typename TemporalId>
98 1 : struct InterpolatedVars : db::SimpleTag {
99 0 : using type = std::unordered_map<
100 : TemporalId,
101 : Variables<
102 : typename InterpolationTargetTag::vars_to_interpolate_to_target>>;
103 : };
104 : } // namespace Tags
105 : } // namespace intrp
|