SpECTRE  v2021.11.01
db::ReferenceTag Struct Reference

Mark a struct as a reference tag by inheriting from this. More...

#include <Tag.hpp>

Detailed Description

Mark a struct as a reference tag by inheriting from this.

Details

A reference tag is used to identify an item in a DataBox that is a const reference to a sub-item of another item (such as a Variables or GlobalCache) in the DataBox

Derived Class Requires:

  • type alias base that is the simple tag from which the reference tag is derived
  • type alias parent_tag that is the tag for the item from which the reference item is retrieved
  • static function get that, given the item fetched by parent_tag, returns a const reference to the sub-item
  • type alias argument_tags that is tmpl::list<parent_tag>

A reference tag may optionally specify a static std::string name() method to override the default name produced by db::tag_name.

Warning
A reference tag should only be derived from a simple tag and db::ReferenceTag.

Example

template <typename... Tags>
struct TaggedTuple : db::SimpleTag {
using type = tuples::TaggedTuple<Tags...>;
};
template <typename Tag, typename ParentTag>
struct FromTaggedTuple : Tag, db::ReferenceTag {
using base = Tag;
using parent_tag = ParentTag;
static const auto& get(const typename parent_tag::type& tagged_tuple) {
return tuples::get<Tag>(tagged_tuple);
}
using argument_tags = tmpl::list<parent_tag>;
};
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:259
const auto & get(const DataBox< TagList > &box)
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:840
Mark a struct as a reference tag by inheriting from this.
Definition: Tag.hpp:188
Mark a struct as a simple tag by inheriting from this.
Definition: Tag.hpp:36
See also
DataBox SimpleTag

The documentation for this struct was generated from the following file: