Static Public Member Functions | List of all members
Actions::SetupDataBox Struct Reference

Add into the DataBox default constructed items for the collection of tags requested by any of the actions in the phase-dependent action list. More...

#include <SetupDataBox.hpp>

Static Public Member Functions

template<typename DbTags , typename... InboxTags, typename Metavariables , typename ArrayIndex , typename ActionList , typename ParallelComponent >
static auto apply (db::DataBox< DbTags > &box, const tuples::TaggedTuple< InboxTags... > &, const Parallel::GlobalCache< Metavariables > &, const ArrayIndex &, const ActionList, const ParallelComponent *const) noexcept

Detailed Description

Add into the DataBox default constructed items for the collection of tags requested by any of the actions in the phase-dependent action list.


This action adds all of the simple tags given in the simple_tags type lists in each of the other actions in the current component's full phase-dependent action list, and all of the compute tags given in the compute_tags type lists. If an action does not give either of the type lists, it is treated as an empty type list.

To prevent the proliferation of many DataBox types, which can drastically slow compile times, it is preferable to use only this action to add tags to the DataBox, and place this action at the start of the Initialization phase action list. The rest of the initialization actions should specify simple_tags and compute_tags, and assign initial values to those tags, but not add those tags into the DataBox.

An example initialization action:

struct InitializationAction {
using simple_tags = tmpl::list<CounterTag, VectorTag>;
using compute_tags = tmpl::list<SquareVectorCompute>;
template <typename DbTagsList, typename... InboxTags, typename Metavariables,
typename ArrayIndex, typename ActionList,
typename ParallelComponent>
db::DataBox<DbTagsList>& box,
const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
const ParallelComponent* const /*meta*/) noexcept {
DataVector{1.2, 3.0});
return {std::move(box)};
This action operates on the assumption that the phase dependent action list of the ParallelComponent and the ActionList do not depend on the DataBox type in the Algorithm. This assumption holds for all current utilities, but if it must be relaxed, revisions to SetupDataBox may be required to avoid a cyclic dependency of the DataBox types.

The documentation for this struct was generated from the following file:
T apply(T... args)
Definition: ElementReceiveInterpPoints.hpp:15
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Stores a collection of function values.
Definition: DataVector.hpp:46
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion,...
Definition: Gsl.hpp:880