SpECTRE  v2026.11.11
Loading...
Searching...
No Matches
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
 A list of all the immutable item tags, including their subitems. Immutable items are compute tags and reference tags.
using immutable_item_creation_tags
 A list of all the immutable item tags used to create the DataBox.
using mutable_item_tags
 A list of all the mutable item tags, including their subitems.
using mutable_subitem_tags
 A list of the expanded simple subitems, not including the main Subitem tags themselves.
using mutable_item_creation_tags
 A list of all the mutable item tags used to create the DataBox.
using mutable_item_parent_tags
 A list of all the mutable tags that have subitems.
using compute_item_tags
 A list of all the compute item tags.
using compute_item_parent_tags
 A list of all the compute tags that have subitems.
using reference_item_tags
 A list of all the reference tags.
using reference_item_parent_tags
 A list of all the reference tags that have subitems.
using metavars_tag
 If it exists, the Parallel::Tags::MetavariablesImpl tag, otherwise NoSuchType.

Public Member Functions

std::string print_tags () const override
 Print the expanded type aliases.
std::string print_types () const override
 Print the expanded type aliases.
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)

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.
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

◆ compute_item_parent_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::compute_item_parent_tags
Initial value:
tmpl::filter<compute_item_tags,
tmpl::bind<detail::has_subitems, tmpl::_1>>
tmpl::filter< immutable_item_tags, db::is_compute_tag< tmpl::_1 > > compute_item_tags
A list of all the compute item tags.
Definition DataBox.hpp:243

A list of all the compute tags that have subitems.

◆ compute_item_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::compute_item_tags
Initial value:
tmpl::filter<immutable_item_tags, db::is_compute_tag<tmpl::_1>>

A list of all the compute item tags.

◆ immutable_item_creation_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::immutable_item_creation_tags
Initial value:
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

◆ immutable_item_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::immutable_item_tags
Initial value:
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.

◆ metavars_tag

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::metavars_tag
Initial value:
typename detail::metavars_tag_impl<mutable_item_tags>::type

If it exists, the Parallel::Tags::MetavariablesImpl tag, otherwise NoSuchType.

This allows the type-erased Parallel::Tags::Metavariables to be used to fetch the metavariables

◆ mutable_item_creation_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::mutable_item_creation_tags
Initial value:
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_item_parent_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::mutable_item_parent_tags
Initial value:
tmpl::bind<detail::has_subitems, tmpl::_1>>
tmpl::list_difference< mutable_item_tags, mutable_subitem_tags > mutable_item_creation_tags
A list of all the mutable item tags used to create the DataBox.
Definition DataBox.hpp:234

A list of all the mutable tags that have subitems.

◆ mutable_item_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::mutable_item_tags
Initial value:
tmpl::filter<tags_list, db::is_mutable_item_tag<tmpl::_1>>

A list of all the mutable item tags, including their subitems.

◆ mutable_subitem_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::mutable_subitem_tags
Initial value:
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.

◆ reference_item_parent_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::reference_item_parent_tags
Initial value:
tmpl::filter<reference_item_tags,
tmpl::bind<detail::has_subitems, tmpl::_1>>
tmpl::filter< immutable_item_tags, db::is_reference_tag< tmpl::_1 > > reference_item_tags
A list of all the reference tags.
Definition DataBox.hpp:252

A list of all the reference tags that have subitems.

◆ reference_item_tags

template<typename... Tags>
using db::DataBox< tmpl::list< Tags... > >::reference_item_tags
Initial value:
tmpl::filter<immutable_item_tags, db::is_reference_tag<tmpl::_1>>

A list of all the reference tags.

Member Function Documentation

◆ print_tags()

template<typename... Tags>
std::string db::DataBox< tmpl::list< Tags... > >::print_tags ( ) const
overridevirtual

Print the expanded type aliases.

Implements db::Access.

◆ print_types()

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

Print the expanded type aliases.

Implements db::Access.

◆ 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:
  • src/DataStructures/DataBox/DataBox.hpp