SubitemTag.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include "DataStructures/DataBox/Subitems.hpp"
7 #include "DataStructures/DataBox/Tag.hpp"
8 #include "Utilities/TMPL.hpp"
9 
10 namespace Tags {
11 
12 /// \cond
13 // Declaration of a tag for a subitem
14 // Unless specialized, it will be the reference tag below,
15 template <typename Tag, typename ParentTag>
16 struct Subitem;
17 /// \endcond
18 
19 /// \brief a reference tag that refers to a particular Tag that is a subitem of
20 /// an item tagged with ParentTag
21 template <typename Tag, typename ParentTag>
22 struct Subitem : Tag, db::ReferenceTag {
23  using base = Tag;
24  using parent_tag = ParentTag;
25  static const auto& get(
26  const typename parent_tag::type& parent_value) noexcept {
27  return ::db::Subitems<parent_tag>::template create_compute_item<base>(
28  parent_value);
29  }
30  using argument_tags = tmpl::list<parent_tag>;
31 };
32 } // namespace Tags
db::ReferenceTag
Mark a struct as a reference tag by inheriting from this.
Definition: Tag.hpp:188
Tags::Subitem
a reference tag that refers to a particular Tag that is a subitem of an item tagged with ParentTag
Definition: SubitemTag.hpp:22
TMPL.hpp