SpECTRE  v2024.09.29
db Namespace Reference

Namespace for DataBox related things. More...

Classes

class  Access
 A class for retrieving items from a DataBox without needing to know all the tags in the box. More...
 
struct  BaseTag
 Mark a (usually) empty struct as a base tag by inheriting from this. More...
 
struct  ComputeTag
 Mark a struct as a compute tag by inheriting from this. More...
 
class  DataBox< tmpl::list< Tags... > >
 A DataBox stores objects that can be retrieved by using Tags. More...
 
struct  is_base_tag
 Check if Tag is a base DataBox tag. More...
 
struct  is_compute_tag
 Check if Tag derives off of db::ComputeTag. More...
 
struct  is_immutable_item_tag
 Check if Tag is a DataBox tag for an immutable item, i.e. a ComputeTag or ReferenceTag. More...
 
struct  is_mutable_item_tag
 Check if Tag is a DataBox tag for a mutable item, i.e. a SimpleTag. More...
 
struct  is_non_base_tag
 Check if Tag is not a base tag. More...
 
struct  is_reference_tag
 Check if Tag derives off of db::ReferenceTag. More...
 
struct  is_simple_tag
 Check if Tag is a simple tag. More...
 
struct  is_tag
 Check if Tag is a DataBox tag, i.e. a BaseTag, SimpleTag, ComputeTag, or ReferenceTag. More...
 
struct  PrefixTag
 Mark a struct as a prefix tag by inheriting from this. More...
 
struct  ReferenceTag
 Mark a struct as a reference tag by inheriting from this. More...
 
struct  SimpleTag
 Mark a struct as a simple tag by inheriting from this. More...
 
struct  Subitems
 Struct that can be specialized to allow DataBox items to have subitems. Specializations must define: More...
 
struct  Subitems< domain::Tags::Interface< DirectionsTag, VariablesTag >, Requires< tt::is_a_v< Variables, typename VariablesTag::type > > >
 
struct  Subitems< domain::Tags::InterfaceCompute< DirectionsTag, VariablesTag >, Requires< tt::is_a_v< Variables, typename VariablesTag::type > > >
 
struct  Subitems< domain::Tags::Slice< DirectionsTag, VariablesTag >, Requires< tt::is_a_v< Variables, typename VariablesTag::type > > >
 
struct  Subitems< FacesTag, Requires< std::is_base_of_v< domain::Tags::Faces< FacesTag::volume_dim, typename FacesTag::tag >, FacesTag > and tt::is_a_v< Variables, typename FacesTag::tag::type > > >
 
struct  Subitems< LinearSolver::Schwarz::Tags::Overlaps< VariablesTag, Dim, OptionsGroup >, Requires< tt::is_a_v< Variables, typename VariablesTag::type > > >
 
struct  Subitems< Tag, Requires< Variables_detail::is_a_variables_tag_v< Tag > > >
 

Typedefs

template<typename Tag , typename Box >
using creation_tag = typename detail::creation_tag_impl< typename Box::tags_list, Tag >::type
 The tag added to Box referred to by Tag. This resolves base tags and converts subitems to full items.
 
template<typename... Tags>
using AddSimpleTags = tmpl::flatten< tmpl::list< Tags... > >
 List of Tags to add to the DataBox.
 
template<typename... Tags>
using AddComputeTags = tmpl::flatten< tmpl::list< Tags... > >
 List of Compute Item Tags to add to the DataBox.
 
template<typename TagList >
using compute_databox_type = typename detail::compute_dbox_type< TagList >::type
 Returns the type of the DataBox that would be constructed from the TagList of tags.
 
template<typename Tag , typename TagsList >
using const_item_type = typename detail::const_item_type_impl< Tag, TagsList >::type
 
template<template< typename... > class Wrapper, typename TagList , typename... Args>
using wrap_tags_in = tmpl::transform< TagList, tmpl::bind< Wrapper, tmpl::_1, tmpl::pin< Args >... > >
 Create a new tmpl::list of tags by wrapping each tag in TagList in Wrapper<_, Args...>.
 
template<template< typename... > class Prefix, typename Tag , typename... Args>
using add_tag_prefix = typename detail::add_tag_prefix_impl< Prefix, Tag, Args... >::type
 Wrap Tag in Prefix<_, Args...>, unless Tag is a Tags::Variables, in which case this creates a new Tags::Variables, wrapping each tag in Tag::tags_list with Prefix<_, Args...>.
 
template<typename Tag >
using remove_tag_prefix = typename detail::remove_tag_prefix_impl< Tag >::type
 Remove the outer prefix from a prefixed tag Tag, or remove the outer prefix of each tag in Tag::tags_list if Tag is a Tags::Variables.
 
template<typename Tag >
using remove_all_prefixes = typename detail::remove_all_prefixes_impl< Tag >::type
 Completely remove all prefix tags from a Tag, or all prefixes from the tags in Tag::tags_list if Tag is a Tags::Variables.
 
template<template< typename... > class Wrapper, typename T , typename... Args>
using prefix_variables = typename detail::prefix_variables< Wrapper, T, Args... >::type
 Add a prefix to all tags in a Variables, leaving the argument unchanged if it is not a Variables. More...
 
template<typename T >
using unprefix_variables = typename detail::unprefix_variables< T >::type
 Remove the outer prefix from all tags in a Variables, leaving the argument unchanged if it is not a Variables. More...
 

Functions

template<typename Tag >
const auto & get (const Access &box)
 Retrieve a tag from a db::Access
 
template<typename... MutateTags, typename Invokable , typename... Args>
decltype(auto) mutate (Invokable &&invokable, const gsl::not_null< Access * > box, Args &&... args)
 Mutate a tag in a db::Access.
 
template<typename... MutateTags, typename TagList , typename Invokable , typename... Args>
decltype(auto) mutate (Invokable &&invokable, const gsl::not_null< DataBox< TagList > * > box, Args &&... args)
 Allows changing the state of one or more non-computed elements in the DataBox. More...
 
template<typename Tag , typename TagList >
const auto & get (const DataBox< TagList > &box)
 Retrieve the item with tag Tag from the DataBox. More...
 
template<typename CopiedItemsTagList , typename DbTagList >
auto copy_items (const DataBox< DbTagList > &box)
 Copy the items from the DataBox into a TaggedTuple. More...
 
template<typename Tag , typename TagList >
auto & get_mutable_reference (const gsl::not_null< DataBox< TagList > * > box)
 Retrieve a mutable reference to the item with tag Tag from the DataBox. More...
 
template<typename AddMutableItemTags , typename AddImmutableItemTags = tmpl::list<>, typename... Args>
constexpr auto create (Args &&... args)
 Create a new DataBox. More...
 
template<size_t VolumeDim, typename TagsList , typename... TagsToSlice>
Variables< tmpl::list< TagsToSlice... > > data_on_slice (const db::DataBox< TagsList > &box, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index, tmpl::list< TagsToSlice... >)
 Slices volume Tensors from a DataBox into a Variables More...
 
template<typename Tag >
std::string tag_name ()
 Get the name of a DataBox tag, including prefixes. More...
 
template<typename Tags >
void validate_selection (const std::vector< std::string > &selected_names, const Options::Context &context)
 Validate that the selected names are a subset of the given tags. More...
 
template<typename MutateTags , typename ArgumentTags , typename F , typename... Args>
constexpr decltype(auto) mutate_apply (F &&f, const gsl::not_null< Access * > box, Args &&... args)
 Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and args. More...
 
template<typename F , typename... Args>
constexpr decltype(auto) mutate_apply (F &&f, const gsl::not_null< Access * > box, Args &&... args)
 Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and args. More...
 
template<typename F , typename... Args>
constexpr decltype(auto) mutate_apply (const gsl::not_null< Access * > box, Args &&... args)
 Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and args. More...
 
template<typename TagsList >
const Accessas_access (const DataBox< TagsList > &box)
 Convert a db::DataBox to a db::Access.
 
template<typename TagsList >
Accessas_access (DataBox< TagsList > &box)
 Convert a db::DataBox to a db::Access.
 
template<typename ArgumentTags , typename F , typename BoxTags , typename... Args>
constexpr auto apply (F &&f, const DataBox< BoxTags > &box, Args &&... args)
 Apply the invokable f with argument Tags TagsList from DataBox box More...
 
template<typename F , typename BoxTags , typename... Args>
constexpr auto apply (F &&f, const DataBox< BoxTags > &box, Args &&... args)
 Apply the invokable f with argument Tags TagsList from DataBox box More...
 
template<typename F , typename BoxTags , typename... Args>
constexpr auto apply (const DataBox< BoxTags > &box, Args &&... args)
 Apply the invokable f with argument Tags TagsList from DataBox box More...
 
template<typename MutateTags , typename ArgumentTags , typename F , typename BoxTags , typename... Args>
constexpr decltype(auto) mutate_apply (F &&f, const gsl::not_null< DataBox< BoxTags > * > box, Args &&... args)
 Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and args. More...
 
template<typename F , typename BoxTags , typename... Args>
constexpr decltype(auto) mutate_apply (F &&f, const gsl::not_null< DataBox< BoxTags > * > box, Args &&... args)
 Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and args. More...
 
template<typename F , typename BoxTags , typename... Args>
constexpr decltype(auto) mutate_apply (const gsl::not_null< DataBox< BoxTags > * > box, Args &&... args)
 Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and args. More...
 

Variables

template<typename Tag >
constexpr bool is_compute_tag_v = is_compute_tag<Tag>::value
 True if Tag derives from db::ComputeTag.
 
template<typename Tag >
constexpr bool is_reference_tag_v = is_reference_tag<Tag>::value
 True if Tag derives from db::ReferenceTag.
 
template<typename Tag >
constexpr bool is_immutable_item_tag_v = is_immutable_item_tag<Tag>::value
 True if Tag is a DataBox tag for an immutable item, i.e. a ComputeTag or ReferenceTag.
 
template<typename Tag >
constexpr bool is_mutable_item_tag_v = is_mutable_item_tag<Tag>::value
 True if Tag is a DataBox tag for a mutable item, i.e. a SimpleTag.
 
template<typename Tag >
constexpr bool is_simple_tag_v = is_simple_tag<Tag>::value
 True if Tag is a simple tag.
 
template<typename Tag >
constexpr bool is_non_base_tag_v = is_non_base_tag<Tag>::value
 True if Tag is not a base tag.
 
template<typename Tag >
constexpr bool is_tag_v = is_tag<Tag>::value
 True if Tag is a DataBox tag.
 
template<typename Tag >
constexpr bool is_base_tag_v = is_base_tag<Tag>::value
 True if Tag is a base tag.
 
template<typename Tag , typename DataBoxType >
using tag_is_retrievable = tmpl::or_< std::is_same< Tag, ::Tags::DataBox >, tmpl::any< typename DataBoxType::tags_list, std::is_base_of< tmpl::pin< Tag >, tmpl::_1 > > >
 Equal to true if Tag can be retrieved from a DataBox of type DataBoxType.
 
template<typename Tag , typename DataBoxType >
constexpr bool tag_is_retrievable_v
 Equal to true if Tag can be retrieved from a DataBox of type DataBoxType. More...
 
template<typename Consumer , typename Provider , typename Box >
using tag_depends_on = std::bool_constant< Box::template tag_depends_on< Consumer, Provider >()>
 Check whether the tag Consumer depends on the tag Provider in a given Box. More...
 
template<typename Consumer , typename Provider , typename Box >
constexpr bool tag_depends_on_v
 Check whether the tag Consumer depends on the tag Provider in a given Box. More...
 

Detailed Description

Namespace for DataBox related things.

Function Documentation

◆ validate_selection()

template<typename Tags >
void db::validate_selection ( const std::vector< std::string > &  selected_names,
const Options::Context context 
)

Validate that the selected names are a subset of the given tags.

The possible choices for the selection are the db::tag_names of the Tags.

Template Parameters
TagsList of possible tags.
Parameters
selected_namesNames to validate.
contextOptions context for error reporting.