ResidualMonitorActionsTestHelpers.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cmath>
7 #include <converse.h>
8 #include <string>
9 
11 #include "DataStructures/DataBox/Tag.hpp"
12 #include "Framework/ActionTesting.hpp"
13 #include "IO/Observer/ObservationId.hpp"
14 #include "IO/Observer/ReductionActions.hpp"
15 #include "Utilities/Gsl.hpp"
16 #include "Utilities/TMPL.hpp"
17 #include "Utilities/TaggedTuple.hpp"
18 
19 namespace Parallel {
20 template <typename Metavariables>
21 class GlobalCache;
22 } // namespace Parallel
23 
24 namespace ResidualMonitorActionsTestHelpers {
25 
28 };
29 
31  using type = std::string;
32 };
33 
36 };
37 
40 };
41 
42 using observer_writer_tags =
45 
47  template <typename ParallelComponent, typename DbTagsList,
48  typename Metavariables, typename ArrayIndex,
49  typename... ReductionDatums,
51  nullptr>
52  static void apply(db::DataBox<DbTagsList>& box, // NOLINT
53  const Parallel::GlobalCache<Metavariables>& /*cache*/,
54  const ArrayIndex& /*array_index*/,
55  const gsl::not_null<Parallel::NodeLock*> /*node_lock*/,
56  const observers::ObservationId& observation_id,
57  const size_t /*sender_node_number*/,
58  const std::string& subfile_name,
59  std::vector<std::string>&& reduction_names,
60  Parallel::ReductionData<ReductionDatums...>&&
61  in_reduction_data) noexcept {
64  make_not_null(&box),
65  [ observation_id, subfile_name, reduction_names, in_reduction_data ](
67  check_observation_id,
69  check_subfile_name,
71  check_reduction_names,
73  check_reduction_data) noexcept {
74  *check_observation_id = observation_id;
75  *check_subfile_name = subfile_name;
76  *check_reduction_names = reduction_names;
77  *check_reduction_data = in_reduction_data.data();
78  });
79  }
80 };
81 
82 template <typename Metavariables>
84  using metavariables = Metavariables;
86  using array_index = int;
87  using phase_dependent_action_list = tmpl::list<Parallel::PhaseActions<
88  typename Metavariables::Phase, Metavariables::Phase::Initialization,
89  tmpl::list<ActionTesting::InitializeDataBox<observer_writer_tags>>>>;
91 
92  using replace_these_threaded_actions =
93  tmpl::list<observers::ThreadedActions::WriteReductionData>;
94  using with_these_threaded_actions = tmpl::list<MockWriteReductionData>;
95 };
96 
97 } // namespace ResidualMonitorActionsTestHelpers
observers::ObservationId
A unique identifier for an observation representing the type of observation and the instance (e....
Definition: ObservationId.hpp:71
ResidualMonitorActionsTestHelpers::CheckReductionNamesTag
Definition: ResidualMonitorActionsTestHelpers.hpp:34
std::string
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
std::vector< std::string >
ResidualMonitorActionsTestHelpers::MockObserverWriter
Definition: ResidualMonitorActionsTestHelpers.hpp:83
std::tuple
ResidualMonitorActionsTestHelpers::MockWriteReductionData
Definition: ResidualMonitorActionsTestHelpers.hpp:46
ResidualMonitorActionsTestHelpers::CheckReductionDataTag
Definition: ResidualMonitorActionsTestHelpers.hpp:38
db::SimpleTag
Mark a struct as a simple tag by inheriting from this.
Definition: Tag.hpp:36
ResidualMonitorActionsTestHelpers::CheckObservationIdTag
Definition: ResidualMonitorActionsTestHelpers.hpp:26
cmath
ResidualMonitorActionsTestHelpers::CheckSubfileNameTag
Definition: ResidualMonitorActionsTestHelpers.hpp:30
db::mutate
decltype(auto) mutate(const gsl::not_null< DataBox< TagList > * > box, Invokable &&invokable, Args &&... args) noexcept
Allows changing the state of one or more non-computed elements in the DataBox.
Definition: DataBox.hpp:641
Parallel::PhaseActions
List of all the actions to be executed in the specified phase.
Definition: PhaseDependentActionList.hpp:16
observers::ObserverWriter
The nodegroup parallel component that is responsible for writing data to disk.
Definition: ObserverComponent.hpp:51
DataBox.hpp
ActionTesting::MockArrayChare
A mock class for the CMake-generated Parallel::Algorithms::Array
Definition: ActionTesting.hpp:649
Gsl.hpp
make_not_null
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
Requires
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t
Definition: Requires.hpp:67
Parallel
Functionality for parallelization.
Definition: ElementReceiveInterpPoints.hpp:13
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13
string