Prefixes.hpp
Go to the documentation of this file.
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 #include <string>
11 
16 #include "Utilities/Requires.hpp"
17 #include "Utilities/TypeTraits.hpp" // IWYU pragma: keep
18 
19 /// \cond
20 template <class>
21 class Variables; // IWYU pragma: keep
22 /// \endcond
23 
24 namespace Tags {
25 /// \ingroup DataBoxTagsGroup
26 /// \brief Prefix indicating a time derivative
27 template <typename Tag>
29  static std::string name() noexcept { return "dt"; }
30  using type = db::item_type<Tag>;
31  using tag = Tag;
32 };
33 
34 /// \ingroup DataBoxTagsGroup
35 /// \brief Prefix indicating a flux
36 template <typename Tag, typename VolumeDim, typename Fr,
37  typename = std::nullptr_t>
38 struct Flux;
39 
40 /// \cond
41 template <typename Tag, typename VolumeDim, typename Fr>
42 struct Flux<Tag, VolumeDim, Fr,
43  Requires<tt::is_a_v<Tensor, db::item_type<Tag>>>> : db::PrefixTag,
46  db::item_type<Tag>, VolumeDim::value, UpLo::Up, Fr>;
47  using tag = Tag;
48  static std::string name() noexcept { return "Flux"; }
49 };
50 
51 template <typename Tag, typename VolumeDim, typename Fr>
52 struct Flux<Tag, VolumeDim, Fr,
53  Requires<tt::is_a_v<::Variables, db::item_type<Tag>>>>
55  using type = db::item_type<Tag>;
56  using tag = Tag;
57  static std::string name() noexcept { return "Flux"; }
58 };
59 /// \endcond
60 
61 /// \ingroup DataBoxTagsGroup
62 /// \brief Prefix indicating a source term
63 ///
64 /// \snippet Test_DataBoxPrefixes.cpp source_name
65 template <typename Tag>
67  using type = db::item_type<Tag>;
68  using tag = Tag;
69  static std::string name() noexcept { return "Source(" + Tag::name() + ")"; }
70 };
71 
72 /// \ingroup DataBoxTagsGroup
73 /// \brief Prefix indicating a boundary unit normal vector dotted into
74 /// the flux
75 template <typename Tag>
77  using type = db::item_type<Tag>;
78  using tag = Tag;
79  static std::string name() noexcept { return "NormalDotFlux"; }
80 };
81 
82 /// \ingroup DataBoxTagsGroup
83 /// \brief Prefix indicating a boundary unit normal vector dotted into
84 /// the numerical flux
85 template <typename Tag>
87  using type = db::item_type<Tag>;
88  using tag = Tag;
89  static std::string name() noexcept { return "NormalDotNumericalFlux"; }
90 };
91 
92 /// \ingroup DataBoxTagsGroup
93 /// \brief Prefix indicating the value a quantity will take on the
94 /// next iteration of the algorithm.
95 ///
96 /// \snippet Test_DataBoxPrefixes.cpp next_name
97 template <typename Tag>
99  using type = db::item_type<Tag>;
100  using tag = Tag;
101  static std::string name() noexcept { return "Next(" + Tag::name() + ")"; }
102 };
103 
104 /// \ingroup DataBoxTagsGroup
105 /// \brief Prefix corresponding to the characteristic speed of the
106 /// characteristic field given by `Tag`. Its `type` is always a
107 /// `Scalar<DataVector>`.
108 template<typename Tag>
110  using type = Scalar<DataVector>;
111  using tag = Tag;
112  static std::string name() noexcept {
113  return "CharSpeed(" + Tag::name() + ")";
114  }
115 };
116 } // namespace Tags
Prefix indicating a source term.
Definition: Prefixes.hpp:66
Prefix indicating a boundary unit normal vector dotted into the flux.
Definition: Prefixes.hpp:76
Contravariant, or Upper index.
Tags for the DataBox inherit from this type.
Definition: DataBoxTag.hpp:65
Defines the type alias Requires.
Prefix indicating a time derivative.
Definition: Prefixes.hpp:28
A collection of useful type traits.
Definition: TensorExpression.hpp:115
Prefix corresponding to the characteristic speed of the characteristic field given by Tag...
Definition: Prefixes.hpp:109
constexpr bool is_a_v
Definition: TypeTraits.hpp:543
Prefix indicating a flux.
Definition: Prefixes.hpp:38
Definition: DataBoxTag.hpp:29
Defines classes for Tensor.
Prefix indicating the value a quantity will take on the next iteration of the algorithm.
Definition: Prefixes.hpp:98
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that is returned by the Tag. If it is a base tag then a TagList must be passed as a seco...
Definition: DataBoxTag.hpp:410
Marks an item as being a prefix to another tag.
Definition: DataBoxTag.hpp:112
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t ...
Definition: Requires.hpp:67
Defines metafunctions used by Tensor.
::Tensor< typename Tensor::type, tmpl::push_front< typename Tensor::symmetry, tmpl::int32_t< 1+tmpl::fold< typename Tensor::symmetry, tmpl::int32_t< 0 >, tmpl::max< tmpl::_state, tmpl::_element > >::value > >, tmpl::push_front< typename Tensor::index_list, SpatialIndex< VolumeDim, Ul, Fr > >> prepend_spatial_index
Add a spatial index to the front of a Tensor.
Definition: Metafunctions.hpp:85
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines type traits, some of which are future STL type_traits header.
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Prefix indicating a boundary unit normal vector dotted into the numerical flux.
Definition: Prefixes.hpp:86
Defines classes representing tensor indices.