Line data Source code
1 1 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : /// \file
5 : /// Define prefixes for DataBox tags
6 :
7 : #pragma once
8 :
9 : #include <cstddef>
10 :
11 : #include "DataStructures/DataBox/Tag.hpp"
12 : #include "DataStructures/Tensor/IndexType.hpp"
13 : #include "DataStructures/Tensor/Metafunctions.hpp"
14 : #include "DataStructures/Tensor/Tensor.hpp"
15 : #include "Utilities/TypeTraits/IsA.hpp"
16 :
17 : /// \cond
18 : template <class>
19 : class Variables;
20 : /// \endcond
21 :
22 : namespace Tags {
23 : /// \ingroup DataBoxTagsGroup
24 : /// \brief Prefix indicating a time derivative
25 : ///
26 : /// \snippet Test_DataBoxPrefixes.cpp dt_name
27 : template <typename Tag>
28 1 : struct dt : db::PrefixTag, db::SimpleTag {
29 0 : using type = typename Tag::type;
30 0 : using tag = Tag;
31 : };
32 :
33 : /*!
34 : * \ingroup DataBoxTagsGroup
35 : * \brief Prefix indicating spatial derivatives
36 : *
37 : * Prefix indicating the spatial derivatives of a Tensor.
38 : *
39 : * \tparam Tag The tag to wrap
40 : * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
41 : * \tparam Frame The frame of the derivative index
42 : *
43 : * \see Tags::DerivCompute
44 : */
45 : template <typename Tag, typename Dim, typename Frame>
46 1 : struct deriv;
47 :
48 : /// \cond
49 : template <typename Tag, typename Dim, typename Frame>
50 : requires(tt::is_a_v<Tensor, typename Tag::type>)
51 : struct deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
52 : using type =
53 : TensorMetafunctions::prepend_spatial_index<typename Tag::type, Dim::value,
54 : UpLo::Lo, Frame>;
55 : using tag = Tag;
56 : };
57 : /// \endcond
58 :
59 : /*!
60 : * \ingroup DataBoxTagsGroup
61 : * \brief Prefix indicating symmetric second spatial derivatives
62 : *
63 : * Prefix indicating the symmetric second spatial derivatives of a Tensor.
64 : *
65 : * \tparam Tag The tag to wrap
66 : * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
67 : * \tparam Frame The frame of the derivative index
68 : *
69 : * \see Tags::DerivCompute
70 : */
71 : template <typename Tag, typename Dim, typename Frame>
72 1 : struct second_deriv;
73 :
74 : /// \cond
75 : template <typename Tag, typename Dim, typename Frame>
76 : requires(tt::is_a_v<Tensor, typename Tag::type>)
77 : struct second_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
78 : using type = TensorMetafunctions::prepend_two_symmetric_spatial_indices<
79 : typename Tag::type, Dim::value, UpLo::Lo, Frame>;
80 : using tag = Tag;
81 : };
82 : /// \endcond
83 :
84 : /*!
85 : * \ingroup DataBoxTagsGroup
86 : * \brief Prefix indicating spacetime derivatives
87 : *
88 : * Prefix indicating the spacetime derivatives of a Tensor or that a Variables
89 : * contains spatial derivatives of Tensors.
90 : *
91 : * \tparam Tag The tag to wrap
92 : * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
93 : * \tparam Frame The frame of the derivative index
94 : */
95 : template <typename Tag, typename Dim, typename Frame>
96 1 : struct spacetime_deriv;
97 :
98 : /// \cond
99 : template <typename Tag, typename Dim, typename Frame>
100 : requires(tt::is_a_v<Tensor, typename Tag::type>)
101 : struct spacetime_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
102 : using type =
103 : TensorMetafunctions::prepend_spacetime_index<typename Tag::type,
104 : Dim::value, UpLo::Lo, Frame>;
105 : using tag = Tag;
106 : };
107 : /// \endcond
108 :
109 : /// \ingroup DataBoxTagsGroup
110 : /// \brief Prefix indicating a flux
111 : ///
112 : /// \snippet Test_DataBoxPrefixes.cpp flux_name
113 : template <typename Tag, typename VolumeDim, typename Fr>
114 1 : struct Flux;
115 :
116 : /// \cond
117 : template <typename Tag, typename VolumeDim, typename Fr>
118 : requires(tt::is_a_v<Tensor, typename Tag::type>)
119 : struct Flux<Tag, VolumeDim, Fr> : db::PrefixTag, db::SimpleTag {
120 : using type = TensorMetafunctions::prepend_spatial_index<
121 : typename Tag::type, VolumeDim::value, UpLo::Up, Fr>;
122 : using tag = Tag;
123 : };
124 :
125 : template <typename Tag, typename VolumeDim, typename Fr>
126 : requires(tt::is_a_v<::Variables, typename Tag::type>)
127 : struct Flux<Tag, VolumeDim, Fr> : db::PrefixTag, db::SimpleTag {
128 : using type = typename Tag::type;
129 : using tag = Tag;
130 : };
131 : /// \endcond
132 :
133 : /// \ingroup DataBoxTagsGroup
134 : /// \brief Prefix indicating a source term
135 : ///
136 : /// \snippet Test_DataBoxPrefixes.cpp source_name
137 : template <typename Tag>
138 1 : struct Source : db::PrefixTag, db::SimpleTag {
139 0 : using type = typename Tag::type;
140 0 : using tag = Tag;
141 : };
142 :
143 : /// \ingroup DataBoxTagsGroup
144 : /// \brief Prefix indicating a source term that is independent of dynamic
145 : /// variables
146 : template <typename Tag>
147 1 : struct FixedSource : db::PrefixTag, db::SimpleTag {
148 0 : using type = typename Tag::type;
149 0 : using tag = Tag;
150 : };
151 :
152 : /// \ingroup DataBoxTagsGroup
153 : /// \brief Prefix indicating the initial value of a quantity
154 : ///
155 : /// \snippet Test_DataBoxPrefixes.cpp initial_name
156 : template <typename Tag>
157 1 : struct Initial : db::PrefixTag, db::SimpleTag {
158 0 : using type = typename Tag::type;
159 0 : using tag = Tag;
160 : };
161 :
162 : /// \ingroup DataBoxTagsGroup
163 : /// \brief Prefix indicating a boundary unit normal vector dotted into
164 : /// the flux
165 : ///
166 : /// \snippet Test_DataBoxPrefixes.cpp normal_dot_flux_name
167 : template <typename Tag>
168 1 : struct NormalDotFlux : db::PrefixTag, db::SimpleTag {
169 0 : using type = typename Tag::type;
170 0 : using tag = Tag;
171 : };
172 :
173 : /// \ingroup DataBoxTagsGroup
174 : /// \brief Prefix indicating a boundary unit normal vector dotted into
175 : /// the numerical flux
176 : ///
177 : /// \snippet Test_DataBoxPrefixes.cpp normal_dot_numerical_flux_name
178 : template <typename Tag>
179 1 : struct NormalDotNumericalFlux : db::PrefixTag, db::SimpleTag {
180 0 : using type = typename Tag::type;
181 0 : using tag = Tag;
182 : };
183 :
184 : /// \ingroup DataBoxTagsGroup
185 : /// \brief Prefix indicating the value a quantity took in the previous iteration
186 : /// of the algorithm.
187 : template <typename Tag>
188 1 : struct Previous : db::PrefixTag, db::SimpleTag {
189 0 : using type = typename Tag::type;
190 0 : using tag = Tag;
191 : };
192 :
193 : /// \ingroup DataBoxTagsGroup
194 : /// \brief Prefix indicating the value a quantity will take on the
195 : /// next iteration of the algorithm.
196 : ///
197 : /// \snippet Test_DataBoxPrefixes.cpp next_name
198 : template <typename Tag>
199 1 : struct Next : db::PrefixTag, db::SimpleTag {
200 0 : using type = typename Tag::type;
201 0 : using tag = Tag;
202 : };
203 :
204 : } // namespace Tags
|