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 
12 #include "DataStructures/DataBox/Tag.hpp"
13 #include "Framework/ActionTesting.hpp"
14 #include "IO/Observer/ObservationId.hpp"
15 #include "IO/Observer/ReductionActions.hpp"
16 #include "Utilities/Gsl.hpp"
17 #include "Utilities/TMPL.hpp"
18 #include "Utilities/TaggedTuple.hpp"
19 
20 namespace Parallel {
21 template <typename Metavariables>
22 class ConstGlobalCache;
23 } // namespace Parallel
24 
25 namespace ResidualMonitorActionsTestHelpers {
26 
29 };
30 
32  using type = std::string;
33 };
34 
37 };
38 
41 };
42 
43 using observer_writer_tags =
46 
48  template <typename ParallelComponent, typename DbTagsList,
49  typename Metavariables, typename ArrayIndex,
50  typename... ReductionDatums,
52  nullptr>
53  static void apply(db::DataBox<DbTagsList>& box, // NOLINT
55  const ArrayIndex& /*array_index*/,
56  const gsl::not_null<Parallel::NodeLock*> /*node_lock*/,
57  const observers::ObservationId& observation_id,
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
Parallel::ConstGlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
observers::ObservationId
A type-erased identifier that combines the identifier's type and hash used to uniquely identify an ob...
Definition: ObservationId.hpp:42
ResidualMonitorActionsTestHelpers::CheckReductionNamesTag
Definition: ResidualMonitorActionsTestHelpers.hpp:35
std::string
DataBoxTag.hpp
std::vector< std::string >
ResidualMonitorActionsTestHelpers::MockObserverWriter
Definition: ResidualMonitorActionsTestHelpers.hpp:83
std::tuple
ResidualMonitorActionsTestHelpers::MockWriteReductionData
Definition: ResidualMonitorActionsTestHelpers.hpp:47
ResidualMonitorActionsTestHelpers::CheckReductionDataTag
Definition: ResidualMonitorActionsTestHelpers.hpp:39
db::SimpleTag
Tags for the DataBox inherit from this type.
Definition: Tag.hpp:23
ResidualMonitorActionsTestHelpers::CheckObservationIdTag
Definition: ResidualMonitorActionsTestHelpers.hpp:27
cmath
db::mutate
void 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:1020
ResidualMonitorActionsTestHelpers::CheckSubfileNameTag
Definition: ResidualMonitorActionsTestHelpers.hpp:31
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:48
DataBox.hpp
ActionTesting::MockArrayChare
A mock class for the CMake-generated Parallel::Algorithms::Array
Definition: ActionTesting.hpp:1588
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
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Parallel
Contains functions that forward to Charm++ parallel functions.
Definition: ElementReceiveInterpPoints.hpp:14
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
string