Tags.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <string>
7 
10 
11 /// \cond
12 class DataVector;
13 class ModalVector;
14 /// \endcond
15 
16 namespace Tags {
17 /// Given the `Tag` holding a `Tensor<DataVector, ...>`, swap the
18 /// `DataVector` with a `double`.
19 template <typename Tag>
21  using tag = Tag;
22  static_assert(cpp17::is_same_v<typename Tag::type::type, DataVector>,
23  "The Mean tag should only be used on tags that hold "
24  "Tensors of DataVectors");
26  static std::string name() noexcept { return "Mean(" + Tag::name() + ")"; }
27 };
28 
29 /// Given the `NodalTag` holding a `Tensor<DataVector, ...>`, swap the
30 /// `DataVector` with a `ModalVector`.
31 template <typename NodalTag>
33  using tag = NodalTag;
34  static_assert(cpp17::is_same_v<typename NodalTag::type::type, DataVector>,
35  "The Modal tag should only be used on tags that hold "
36  "Tensors of DataVectors");
37  using type =
39  static std::string name() noexcept {
40  return "Modal(" + NodalTag::name() + ")";
41  }
42 };
43 } // namespace Tags
Tags for the DataBox inherit from this type.
Definition: DataBoxTag.hpp:65
A class for storing spectral coefficients on a spectral grid.
Definition: ModalVector.hpp:30
Definition: DataBoxTag.hpp:29
::Tensor< NewType, typename Tensor::symmetry, typename Tensor::index_list > swap_type
Swap the data type of a tensor for a new type.
Definition: Metafunctions.hpp:121
Stores a collection of function values.
Definition: DataVector.hpp:42
Marks an item as being a prefix to another tag.
Definition: DataBoxTag.hpp:112
Defines metafunctions used by Tensor.
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Given the Tag holding a Tensor<DataVector, ...>, swap the DataVector with a double.
Definition: Tags.hpp:20
Given the NodalTag holding a Tensor<DataVector, ...>, swap the DataVector with a ModalVector.
Definition: Tags.hpp:32