|
SpECTRE
2021.08.02
|
Send reduction data to the observer group. More...
#include <ReductionActions.hpp>
Static Public Member Functions | |
| template<typename ParallelComponent , typename DbTagsList , typename Metavariables , typename ArrayIndex , typename... Ts, typename Formatter = observers::NoFormatter> | |
| static void | apply (db::DataBox< DbTagsList > &box, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index, const observers::ObservationId &observation_id, const ArrayComponentId &sender_array_id, const std::string &subfile_name, const std::vector< std::string > &reduction_names, Parallel::ReductionData< Ts... > &&reduction_data, std::optional< Formatter > &&formatter=std::nullopt) noexcept |
Send reduction data to the observer group.
Once everything at a specific ObservationId has been contributed to the reduction, the groups reduce to their local nodegroup.
The caller of this Action (which is to be invoked on the Observer parallel component) must pass in an observation_id used to uniquely identify the observation in time, the name of the h5::Dat subfile in the HDF5 file (e.g. /element_data, where the slash is important), a std::vector<std::string> of names of the quantities being reduced (e.g. {"Time", "L1ErrorDensity", "L2ErrorDensity"}), and the Parallel::ReductionData that holds the ReductionDatums containing info on how to do the reduction.
The observer components need to know all expected reduction data types by compile-time, so they rely on the Metavariables::observed_reduction_data_tags alias to collect them in one place. To this end, each Action that contributes reduction data must expose the type alias as:
Then, in the Metavariables collect them from all observing Actions using the observers::collect_reduction_data_tags metafunction.
This action also accepts a "formatter" that will be forwarded along with the reduction data and used to print an informative message when the reduction is complete. The formatter must conform to observers::protocols::ReductionDataFormatter.