SpECTRE  v2024.04.12
db::DataBox< tmpl::list< Tags... > > Class Template Reference

A DataBox stores objects that can be retrieved by using Tags. More...

#include <DataBox.hpp>

Public Types

using tags_list = tmpl::list< Tags... >
 A typelist (tmpl::list) of Tags that the DataBox holds.
 
using immutable_item_tags = tmpl::filter< tags_list, db::is_immutable_item_tag< tmpl::_1 > >
 A list of all the immutable item tags, including their subitems. Immutable items are compute tags and reference tags.
 
using immutable_item_creation_tags = tmpl::remove_if< immutable_item_tags, tt::is_a<::Tags::Subitem, tmpl::_1 > >
 A list of all the immutable item tags used to create the DataBox. More...
 
using mutable_item_tags = tmpl::filter< tags_list, db::is_mutable_item_tag< tmpl::_1 > >
 A list of all the mutable item tags, including their subitems.
 
using mutable_subitem_tags = tmpl::flatten< tmpl::transform< mutable_item_tags, db::Subitems< tmpl::_1 > > >
 A list of the expanded simple subitems, not including the main Subitem tags themselves. More...
 
using mutable_item_creation_tags = tmpl::list_difference< mutable_item_tags, mutable_subitem_tags >
 A list of all the mutable item tags used to create the DataBox. More...
 
using mutable_item_parent_tags = tmpl::filter< mutable_item_creation_tags, tmpl::bind< detail::has_subitems, tmpl::_1 > >
 A list of all the mutable tags that have subitems.
 
using compute_item_tags = tmpl::filter< immutable_item_tags, db::is_compute_tag< tmpl::_1 > >
 A list of all the compute item tags.
 
using compute_item_parent_tags = tmpl::filter< compute_item_tags, tmpl::bind< detail::has_subitems, tmpl::_1 > >
 A list of all the compute tags that have subitems.
 
using reference_item_tags = tmpl::filter< immutable_item_tags, db::is_reference_tag< tmpl::_1 > >
 A list of all the reference tags.
 
using reference_item_parent_tags = tmpl::filter< reference_item_tags, tmpl::bind< detail::has_subitems, tmpl::_1 > >
 A list of all the reference tags that have subitems.
 

Public Member Functions

std::string print_types () const override
 Print the expanded type aliases. More...
 
template<bool PrintImmutableItems = true>
std::string print_items () const
 Print the items.
 
std::map< std::string, size_t > size_of_items () const
 The size in bytes of each item (excluding reference items)
 
template<typename Tag >
const auto & get () const
 Retrieve the tag Tag, should be called by the free function db::get.
 
template<typename... TagsOfItemsToCopy>
tuples::TaggedTuple< TagsOfItemsToCopy... > copy_items () const
 Copy the items with tags TagsOfItemsToCopy from the DataBox into a TaggedTuple, should be called by the free function db::copy_items.
 
template<typename Tag >
auto & get_mutable_reference ()
 Retrieve a mutable reference to the tag Tag, should be called by the free function db::get_mutable_reference.
 
void pup (PUP::er &p)
 
template<typename... AddMutableItemTags, typename AddImmutableItemTagsList , typename... Args>
constexpr DataBox (tmpl::list< AddMutableItemTags... >, AddImmutableItemTagsList, Args &&... args)
 
virtual std::string print_types () const =0
 Print the expanded type aliases of the derived db::DataBox More...
 

Static Public Member Functions

template<typename Consumer , typename Provider >
static constexpr bool tag_depends_on ()
 Check whether a tags depends on another tag. Should be called through the metafunction db::tag_depends_on.
 

Friends

template<typename CopiedItemsTagList , typename DbTagList >
auto copy_items (const DataBox< DbTagList > &box)
 Copy the items from the DataBox into a TaggedTuple. More...
 
template<typename... MutateTags, typename TagList , typename Invokable , typename... Args>
decltype(auto) mutate (Invokable &&invokable, gsl::not_null< DataBox< TagList > * > box, Args &&... args)
 

Detailed Description

template<typename... Tags>
class db::DataBox< tmpl::list< Tags... > >

A DataBox stores objects that can be retrieved by using Tags.

Warning
The order of the tags in DataBoxes returned by db::create depends on implementation-defined behavior, and therefore should not be specified in source files. If explicitly naming a DataBox type is necessary they should be generated using db::compute_databox_type.
See also
db::create
Template Parameters
Tagslist of DataBoxTag's

Member Typedef Documentation

◆ immutable_item_creation_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::immutable_item_creation_tags = tmpl::remove_if<immutable_item_tags, tt::is_a<::Tags::Subitem, tmpl::_1> >

A list of all the immutable item tags used to create the DataBox.

Note
This does not include subitems of immutable items

◆ mutable_item_creation_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::mutable_item_creation_tags = tmpl::list_difference<mutable_item_tags, mutable_subitem_tags>

A list of all the mutable item tags used to create the DataBox.

Note
This does not include subitems of mutable items

◆ mutable_subitem_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::mutable_subitem_tags = tmpl::flatten< tmpl::transform<mutable_item_tags, db::Subitems<tmpl::_1> >>

A list of the expanded simple subitems, not including the main Subitem tags themselves.

Specifically, if there is a Variables<Tag0, Tag1>, then this list would contain Tag0, Tag1.

Member Function Documentation

◆ print_types()

template<typename... Tags>
std::string db::DataBox< tmpl::list< Tags... > >::print_types
overridevirtual

Print the expanded type aliases.

Implements db::Access.

Friends And Related Function Documentation

◆ copy_items

template<typename... Tags>
template<typename CopiedItemsTagList , typename DbTagList >
auto copy_items ( const DataBox< DbTagList > &  box)
friend

Copy the items from the DataBox into a TaggedTuple.

Returns: The objects corresponding to CopiedItemsTagList

Note
The tags in CopiedItemsTagList must be a subset of the mutable_item_creation_tags of the DataBox

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