SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
TestHelpers::observers::MockWriteReductionDataRow Struct Reference

Action meant to mock WriteReductionDataRow. More...

#include <MockWriteReductionDataRow.hpp>

Static Public Member Functions

template<typename ParallelComponent, typename DbTagsList, typename Metavariables, typename ArrayIndex, typename... Ts>
static void apply (::db::DataBox< DbTagsList > &box, const Parallel::GlobalCache< Metavariables > &, const ArrayIndex &, const gsl::not_null< Parallel::NodeLock * >, const std::string &subfile_name, std::vector< std::string > &&legend, std::tuple< Ts... > &&in_reduction_data)

Detailed Description

Action meant to mock WriteReductionDataRow.

Details

Instead of writing to disk, this action will mutate the MockReductionFileTag stored in the DataBox of the MockObserverWriter with the values passed in. We want to avoid writing to disk in the testing framework because IO is slow and we don't really care that things were written to disk, just that the correct values were recorded.

To check what values were written, get the MockDat file:

auto& mock_h5_file =
ActionTesting::get_databox_tag<mock_observer_writer,
MockReductionFileTag>(runner, 0);
const auto& mock_dat_file = mock_h5_file.get_dat(subfile_path);
CHECK(mock_dat_file.get_legend() == legend);
CHECK(mock_dat_file.get_data() == Matrix{{1.0, 9.3}});

The documentation for this struct was generated from the following file:
  • tests/Unit/Helpers/IO/Observers/MockWriteReductionDataRow.hpp