MockRuntimeSystemFreeFunctions.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines free functions that wrap MockRuntimeSystem member functions.
6 
7 #pragma once
8 
9 #include <cstddef>
10 #include <random>
11 #include <utility>
12 #include <vector>
13 
14 #include "Framework/MockRuntimeSystem.hpp"
15 #include "Utilities/Gsl.hpp"
16 #include "Utilities/Requires.hpp"
17 #include "Utilities/TMPL.hpp"
18 #include "Utilities/TypeTraits.hpp"
19 
20 namespace ActionTesting {
21 /// Set the phase of all parallel components to `phase`
22 template <typename Metavariables>
24  const typename Metavariables::Phase& phase) noexcept {
25  runner->set_phase(phase);
26 }
27 
28 /// Emplaces a distributed object with index `array_index` into the parallel
29 /// component `Component`. The options `opts` are forwarded to be used in a call
30 /// to `detail::ForwardAllOptionsToDataBox::apply`.
31 template <typename Component, typename... Options>
34  runner,
35  const typename Component::array_index& array_index,
36  Options&&... opts) noexcept {
37  runner->template emplace_component<Component>(array_index,
38  std::forward<Options>(opts)...);
39 }
40 
41 /// Emplaces a distributed array object with index `array_index` into
42 /// the parallel component `Component`. The options `opts` are
43 /// forwarded to be used in a call to
44 /// `detail::ForwardAllOptionsToDataBox::apply`.
45 template <typename Component, typename... Options>
48  runner,
49  const NodeId node_id, const LocalCoreId local_core_id,
50  const typename Component::array_index& array_index,
51  Options&&... opts) noexcept {
52  runner->template emplace_array_component<Component>(
53  node_id, local_core_id, array_index, std::forward<Options>(opts)...);
54 }
55 
56 /// Emplaces a distributed singleton object into
57 /// the parallel component `Component`. The options `opts` are
58 /// forwarded to be used in a call to
59 /// `detail::ForwardAllOptionsToDataBox::apply`.
60 template <typename Component, typename... Options>
63  runner,
64  const NodeId node_id, const LocalCoreId local_core_id,
65  Options&&... opts) noexcept {
66  runner->template emplace_singleton_component<Component>(
67  node_id, local_core_id, std::forward<Options>(opts)...);
68 }
69 
70 /// Emplaces a distributed group object into
71 /// the parallel component `Component`. The options `opts` are
72 /// forwarded to be used in a call to
73 /// `detail::ForwardAllOptionsToDataBox::apply`.
74 template <typename Component, typename... Options>
77  runner,
78  Options&&... opts) noexcept {
79  runner->template emplace_group_component<Component>(
80  std::forward<Options>(opts)...);
81 }
82 
83 /// Emplaces a distributed nodegroup object into
84 /// the parallel component `Component`. The options `opts` are
85 /// forwarded to be used in a call to
86 /// `detail::ForwardAllOptionsToDataBox::apply`.
87 template <typename Component, typename... Options>
90  runner,
91  Options&&... opts) noexcept {
92  runner->template emplace_nodegroup_component<Component>(
93  std::forward<Options>(opts)...);
94 }
95 
96 /// Emplaces a distributed object with index `array_index` into the parallel
97 /// component `Component`. The options `opts` are forwarded to be used in a call
98 /// to `detail::ForwardAllOptionsToDataBox::apply` Additionally, the simple tags
99 /// in the DataBox are initialized from the values set in `initial_values`.
100 template <typename Component, typename... Options,
101  typename Metavars = typename Component::metavariables,
105  runner,
106  const typename Component::array_index& array_index,
107  const typename detail::get_initialization<Component>::InitialValues&
108  initial_values,
109  Options&&... opts) noexcept {
110  runner->template emplace_component_and_initialize<Component>(
111  array_index, initial_values, std::forward<Options>(opts)...);
112 }
113 
114 /// Emplaces a distributed array object with index `array_index` into the
115 /// parallel component `Component`. The options `opts` are forwarded to be used
116 /// in a call to `detail::ForwardAllOptionsToDataBox::apply` Additionally, the
117 /// simple tags in the DataBox are initialized from the values set in
118 /// `initial_values`.
119 template <typename Component, typename... Options,
120  typename Metavars = typename Component::metavariables,
124  runner,
125  const NodeId node_id, const LocalCoreId local_core_id,
126  const typename Component::array_index& array_index,
127  const typename detail::get_initialization<Component>::InitialValues&
128  initial_values,
129  Options&&... opts) noexcept {
130  runner->template emplace_array_component_and_initialize<Component>(
131  node_id, local_core_id, array_index, initial_values,
132  std::forward<Options>(opts)...);
133 }
134 
135 /// Emplaces a distributed singleton object into the parallel
136 /// component `Component`. The options `opts` are forwarded to be used
137 /// in a call to `detail::ForwardAllOptionsToDataBox::apply`
138 /// Additionally, the simple tags in the DataBox are initialized from
139 /// the values set in `initial_values`.
140 template <typename Component, typename... Options,
141  typename Metavars = typename Component::metavariables,
145  runner,
146  const NodeId node_id, const LocalCoreId local_core_id,
147  const typename detail::get_initialization<Component>::InitialValues&
148  initial_values,
149  Options&&... opts) noexcept {
150  runner->template emplace_singleton_component_and_initialize<Component>(
151  node_id, local_core_id, initial_values, std::forward<Options>(opts)...);
152 }
153 
154 /// Emplaces a distributed group object into the
155 /// parallel component `Component`. The options `opts` are forwarded to be used
156 /// in a call to `detail::ForwardAllOptionsToDataBox::apply` Additionally, the
157 /// simple tags in the DataBox are initialized from the values set in
158 /// `initial_values`.
159 template <typename Component, typename... Options,
160  typename Metavars = typename Component::metavariables,
164  runner,
165  const typename detail::get_initialization<Component>::InitialValues&
166  initial_values,
167  Options&&... opts) noexcept {
168  runner->template emplace_group_component_and_initialize<Component>(
169  initial_values, std::forward<Options>(opts)...);
170 }
171 
172 /// Emplaces a distributed nodegroup object into the
173 /// parallel component `Component`. The options `opts` are forwarded to be used
174 /// in a call to `detail::ForwardAllOptionsToDataBox::apply` Additionally, the
175 /// simple tags in the DataBox are initialized from the values set in
176 /// `initial_values`.
177 template <typename Component, typename... Options,
178  typename Metavars = typename Component::metavariables,
182  runner,
183  const typename detail::get_initialization<Component>::InitialValues&
184  initial_values,
185  Options&&... opts) noexcept {
186  runner->template emplace_nodegroup_component_and_initialize<Component>(
187  initial_values, std::forward<Options>(opts)...);
188 }
189 
190 /// @{
191 /// Retrieves the DataBox with tags `TagsList` (omitting the `GlobalCache`
192 /// and `add_from_options` tags) from the parallel component `Component` with
193 /// index `array_index`.
194 template <typename Component, typename TagsList, typename Metavariables>
195 const auto& get_databox(
196  const MockRuntimeSystem<Metavariables>& runner,
197  const typename Component::array_index& array_index) noexcept {
198  return runner.template mock_distributed_objects<Component>()
199  .at(array_index)
200  .template get_databox<TagsList>();
201 }
202 
203 template <typename Component, typename TagsList, typename Metavariables>
205  const typename Component::array_index& array_index) noexcept {
206  return runner->template mock_distributed_objects<Component>()
207  .at(array_index)
208  .template get_databox<TagsList>();
209 }
210 /// @}
211 
212 /// Get the index in the action list of the next action.
213 template <typename Component, typename Metavariables>
215  const MockRuntimeSystem<Metavariables>& runner,
216  const typename Component::array_index& array_index) noexcept {
217  return runner.template get_next_action_index<Component>(array_index);
218 }
219 
220 /// Returns the `Tag` from the `DataBox` of the parallel component `Component`
221 /// with array index `array_index`. If the component's current `DataBox` type
222 /// does not contain `Tag` then an error is emitted.
223 template <typename Component, typename Tag, typename Metavariables>
224 const auto& get_databox_tag(
225  const MockRuntimeSystem<Metavariables>& runner,
226  const typename Component::array_index& array_index) noexcept {
227  return runner.template mock_distributed_objects<Component>()
228  .at(array_index)
229  .template get_databox_tag<Tag>();
230 }
231 
232 /// @{
233 /// Returns the `InboxTag` from the parallel component `Component` with array
234 /// index `array_index`.
235 template <typename Component, typename InboxTag, typename Metavariables>
236 const auto& get_inbox_tag(
237  const MockRuntimeSystem<Metavariables>& runner,
238  const typename Component::array_index& array_index) noexcept {
239  return tuples::get<InboxTag>(
240  runner.template inboxes<Component>().at(array_index));
241 }
242 
243 template <typename Component, typename InboxTag, typename Metavariables>
246  const typename Component::array_index& array_index) noexcept {
247  return tuples::get<InboxTag>(
248  runner->template inboxes<Component>().at(array_index));
249 }
250 /// @}
251 
252 /// Returns `true` if the current DataBox of `Component` with index
253 /// `array_index` contains the tag `Tag`. If the tag is not contained, returns
254 /// `false`.
255 template <typename Component, typename Tag, typename Metavariables>
257  const typename Component::array_index& array_index) noexcept {
258  return runner.template mock_distributed_objects<Component>()
259  .at(array_index)
260  .template box_contains<Tag>();
261 }
262 
263 /// Returns `true` if the tag `Tag` can be retrieved from the current DataBox
264 /// of `Component` with index `array_index`.
265 template <typename Component, typename Tag, typename Metavariables>
267  const MockRuntimeSystem<Metavariables>& runner,
268  const typename Component::array_index& array_index) noexcept {
269  return runner.template mock_distributed_objects<Component>()
270  .at(array_index)
271  .template tag_is_retrievable<Tag>();
272 }
273 
274 /// Invoke the next action in the ActionList on the parallel component
275 /// `Component` on the component labeled by `array_index`, failing if it was
276 /// not ready.
277 template <typename Component, typename Metavariables>
279  const typename Component::array_index& array_index) noexcept {
280  runner->template next_action<Component>(array_index);
281 }
282 
283 /// Invoke the next action in the ActionList on the parallel component
284 /// `Component` on the component labeled by `array_index`, returning whether
285 /// it was ready.
286 template <typename Component, typename Metavariables>
289  const typename Component::array_index& array_index) noexcept {
290  return runner->template next_action_if_ready<Component>(array_index);
291 }
292 
293 /// Runs the simple action `Action` on the `array_index`th element of the
294 /// parallel component `Component`.
295 template <typename Component, typename Action, typename Metavariables,
296  typename... Args>
299  const typename Component::array_index& array_index,
300  Args&&... args) noexcept {
301  runner->template simple_action<Component, Action>(
302  array_index, std::forward<Args>(args)...);
303 }
304 
305 /// Runs the simple action `Action` on the `array_index`th element of the
306 /// parallel component `Component`.
307 template <typename Component, typename Action, typename Metavariables,
308  typename... Args>
311  const typename Component::array_index& array_index,
312  Args&&... args) noexcept {
313  runner->template threaded_action<Component, Action>(
314  array_index, std::forward<Args>(args)...);
315 }
316 
317 /// Runs the next queued simple action on the `array_index`th element of
318 /// the parallel component `Component`.
319 template <typename Component, typename Metavariables>
322  const typename Component::array_index& array_index) noexcept {
323  runner->template invoke_queued_simple_action<Component>(array_index);
324 }
325 
326 /// Returns `true` if there are no simple actions in the queue.
327 template <typename Component, typename Metavariables>
329  const MockRuntimeSystem<Metavariables>& runner,
330  const typename Component::array_index& array_index) noexcept {
331  return runner.template is_simple_action_queue_empty<Component>(array_index);
332 }
333 
334 /// Returns the number of simple actions in the queue.
335 template <typename Component, typename Metavariables>
337  const MockRuntimeSystem<Metavariables>& runner,
338  const typename Component::array_index& array_index) noexcept {
339  return runner.template number_of_queued_simple_actions<Component>(
340  array_index);
341 }
342 
343 /// Runs the next queued threaded action on the `array_index`th element of
344 /// the parallel component `Component`.
345 template <typename Component, typename Metavariables>
348  const typename Component::array_index& array_index) noexcept {
349  runner->template invoke_queued_threaded_action<Component>(array_index);
350 }
351 
352 /// Returns `true` if there are no threaded actions in the queue.
353 template <typename Component, typename Metavariables>
355  const MockRuntimeSystem<Metavariables>& runner,
356  const typename Component::array_index& array_index) noexcept {
357  return runner.template is_threaded_action_queue_empty<Component>(array_index);
358 }
359 
360 /// Returns the number of threaded actions in the queue.
361 template <typename Component, typename Metavariables>
363  const MockRuntimeSystem<Metavariables>& runner,
364  const typename Component::array_index& array_index) noexcept {
365  return runner.template number_of_queued_threaded_actions<Component>(
366  array_index);
367 }
368 
369 /// Returns whether or not the `Component` with index `array_index` has been
370 /// terminated.
371 template <typename Component, typename Metavariables>
373  const MockRuntimeSystem<Metavariables>& runner,
374  const typename Component::array_index& array_index) noexcept {
375  return runner.template mock_distributed_objects<Component>()
376  .at(array_index)
377  .get_terminate();
378 }
379 
380 /// Returns the GlobalCache of `Component` with index `array_index`.
381 template <typename Component, typename Metavariables, typename ArrayIndex>
384  const ArrayIndex& array_index) noexcept {
385  return runner.template mock_distributed_objects<Component>()
386  .at(array_index)
387  .cache();
388 }
389 
390 /// Returns a vector of all the indices of the Components in the
391 /// ComponentList that have queued simple actions, for a particular
392 /// array_index.
393 template <typename ComponentList, typename MockRuntimeSystem,
394  typename ArrayIndex>
397  const ArrayIndex& array_index) noexcept {
398  std::vector<size_t> result{};
399  size_t i = 0;
400  tmpl::for_each<ComponentList>([&](auto tag) noexcept {
401  using Tag = typename decltype(tag)::type;
402  if (not runner->template is_simple_action_queue_empty<Tag>(array_index)) {
403  result.push_back(i);
404  }
405  ++i;
406  });
407  return result;
408 }
409 
410 /// \cond
411 namespace detail {
412 template<typename Component>
413 struct ArrayIndicesTag {
415 };
416 
417 template <typename ComponentList>
418 using array_indices_tags =
419  tmpl::transform<ComponentList, tmpl::bind<ArrayIndicesTag, tmpl::_1>>;
420 
421 template <typename ComponentList>
422 using array_indices_for_each_component =
423  tuples::tagged_tuple_from_typelist<array_indices_tags<ComponentList>>;
424 } // namespace detail
425 /// \endcond
426 
427 /// Returns a vector of array_indices for each Component. The vector
428 /// is filled with only those array_indices for which there are queued
429 /// simple actions.
430 template <typename ComponentList, typename MockRuntimeSystem>
432  const gsl::not_null<MockRuntimeSystem*> runner) noexcept
433  -> detail::array_indices_for_each_component<ComponentList> {
434  detail::array_indices_for_each_component<ComponentList> result;
435  tmpl::for_each<ComponentList>([&](auto component) noexcept {
436  using Component = typename decltype(component)::type;
437  using array_indices_tag = detail::ArrayIndicesTag<Component>;
438  auto& result_this_component = tuples::get<array_indices_tag>(result);
439  for (auto& [index, mock_distributed_object] :
440  runner->template mock_distributed_objects<Component>()) {
441  if (not mock_distributed_object.is_simple_action_queue_empty()) {
442  result_this_component.push_back(index);
443  }
444  }
445  });
446  return result;
447 }
448 
449 /// Given the output of `array_indices_with_queued_simple_actions`, returns
450 /// the total number of array indices that have queued simple actions.
451 template <typename ComponentList>
453  const detail::array_indices_for_each_component<ComponentList>&
454  array_indices) noexcept {
455  size_t num_queued_actions = 0;
456  tmpl::for_each<ComponentList>([&](auto component) noexcept {
457  using Component = typename decltype(component)::type;
458  using array_indices_tag = detail::ArrayIndicesTag<Component>;
459  num_queued_actions += tuples::get<array_indices_tag>(array_indices).size();
460  });
461  return num_queued_actions;
462 }
463 
464 /// Invokes the next queued action on a random Component on a random
465 /// array_index of that component. `array_indices` is the thing returned
466 /// by `array_indices_with_queued_simple_actions`
467 template <typename ComponentList, typename MockRuntimeSystem,
468  typename Generator>
471  const gsl::not_null<Generator*> generator,
472  const detail::array_indices_for_each_component<ComponentList>&
473  array_indices) noexcept {
474  // Choose one queued action at random.
475  const size_t num_queued_actions =
476  number_of_elements_with_queued_simple_actions<ComponentList>(
477  array_indices);
478  std::uniform_int_distribution<size_t> ran(0, num_queued_actions - 1);
479  const size_t index_of_action_to_invoke = ran(*generator);
480 
481  // Invoke the chosen queued action.
482  size_t queued_action_count = 0;
483  tmpl::for_each<ComponentList>([&runner, &array_indices,
484  &index_of_action_to_invoke,
485  &queued_action_count](
486  auto component) noexcept {
487  using Component = typename decltype(component)::type;
488  using array_indices_tag = detail::ArrayIndicesTag<Component>;
489  const size_t num_queued_actions_this_comp =
490  tuples::get<array_indices_tag>(array_indices).size();
491  if (index_of_action_to_invoke >= queued_action_count and
492  index_of_action_to_invoke <
493  queued_action_count + num_queued_actions_this_comp) {
494  runner->template invoke_queued_simple_action<Component>(
495  tuples::get<array_indices_tag>(array_indices)
496  .at(index_of_action_to_invoke - queued_action_count));
497  }
498  queued_action_count += num_queued_actions_this_comp;
499  });
500 }
501 } // namespace ActionTesting
ActionTesting::emplace_component_and_initialize
void emplace_component_and_initialize(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const typename Component::array_index &array_index, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts) noexcept
Emplaces a distributed object with index array_index into the parallel component Component....
Definition: MockRuntimeSystemFreeFunctions.hpp:103
ActionTesting::invoke_queued_simple_action
void invoke_queued_simple_action(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index) noexcept
Runs the next queued simple action on the array_indexth element of the parallel component Component.
Definition: MockRuntimeSystemFreeFunctions.hpp:320
ActionTesting::get_next_action_index
size_t get_next_action_index(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Get the index in the action list of the next action.
Definition: MockRuntimeSystemFreeFunctions.hpp:214
ActionTesting::box_contains
bool box_contains(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns true if the current DataBox of Component with index array_index contains the tag Tag....
Definition: MockRuntimeSystemFreeFunctions.hpp:256
gsl::at
constexpr T & at(std::array< T, N > &arr, Size index)
Retrieve a entry from a container, with checks in Debug mode that the index being retrieved is valid.
Definition: Gsl.hpp:125
ActionTesting::set_phase
void set_phase(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Metavariables::Phase &phase) noexcept
Set the phase of all parallel components to phase
Definition: MockRuntimeSystemFreeFunctions.hpp:23
std::uniform_int_distribution
ActionTesting::number_of_elements_with_queued_simple_actions
size_t number_of_elements_with_queued_simple_actions(const detail::array_indices_for_each_component< ComponentList > &array_indices) noexcept
Given the output of array_indices_with_queued_simple_actions, returns the total number of array indic...
Definition: MockRuntimeSystemFreeFunctions.hpp:452
utility
ActionTesting::MockRuntimeSystem
Definition: MockRuntimeSystem.hpp:97
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
ActionTesting
Structures used for mocking the parallel components framework in order to test actions.
Definition: ActionTesting.hpp:337
ActionTesting::invoke_queued_threaded_action
void invoke_queued_threaded_action(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index) noexcept
Runs the next queued threaded action on the array_indexth element of the parallel component Component...
Definition: MockRuntimeSystemFreeFunctions.hpp:346
vector
ActionTesting::emplace_group_component_and_initialize
void emplace_group_component_and_initialize(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts) noexcept
Emplaces a distributed group object into the parallel component Component. The options opts are forwa...
Definition: MockRuntimeSystemFreeFunctions.hpp:162
random
ActionTesting::LocalCoreId
Wraps a size_t representing the local core number. This is so the user can write things like emplace_...
Definition: MockDistributedObject.hpp:148
ActionTesting::threaded_action
void threaded_action(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index, Args &&... args) noexcept
Runs the simple action Action on the array_indexth element of the parallel component Component.
Definition: MockRuntimeSystemFreeFunctions.hpp:309
ActionTesting::next_action_if_ready
bool next_action_if_ready(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index) noexcept
Invoke the next action in the ActionList on the parallel component Component on the component labeled...
Definition: MockRuntimeSystemFreeFunctions.hpp:287
Options
Utilities for parsing input files.
Definition: MinmodType.hpp:8
ActionTesting::get_terminate
bool get_terminate(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns whether or not the Component with index array_index has been terminated.
Definition: MockRuntimeSystemFreeFunctions.hpp:372
ActionTesting::emplace_singleton_component_and_initialize
void emplace_singleton_component_and_initialize(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const NodeId node_id, const LocalCoreId local_core_id, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts) noexcept
Emplaces a distributed singleton object into the parallel component Component. The options opts are f...
Definition: MockRuntimeSystemFreeFunctions.hpp:143
cstddef
ActionTesting::indices_of_components_with_queued_simple_actions
std::vector< size_t > indices_of_components_with_queued_simple_actions(const gsl::not_null< MockRuntimeSystem * > runner, const ArrayIndex &array_index) noexcept
Returns a vector of all the indices of the Components in the ComponentList that have queued simple ac...
Definition: MockRuntimeSystemFreeFunctions.hpp:395
ActionTesting::emplace_component
void emplace_component(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const typename Component::array_index &array_index, Options &&... opts) noexcept
Emplaces a distributed object with index array_index into the parallel component Component....
Definition: MockRuntimeSystemFreeFunctions.hpp:32
ActionTesting::NodeId
Wraps a size_t representing the node number. This is so the user can write things like emplace_array_...
Definition: MockDistributedObject.hpp:125
ActionTesting::get_inbox_tag
const auto & get_inbox_tag(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns the InboxTag from the parallel component Component with array index array_index.
Definition: MockRuntimeSystemFreeFunctions.hpp:236
ActionTesting::emplace_array_component
void emplace_array_component(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const NodeId node_id, const LocalCoreId local_core_id, const typename Component::array_index &array_index, Options &&... opts) noexcept
Emplaces a distributed array object with index array_index into the parallel component Component....
Definition: MockRuntimeSystemFreeFunctions.hpp:46
ActionTesting::array_indices_with_queued_simple_actions
auto array_indices_with_queued_simple_actions(const gsl::not_null< MockRuntimeSystem * > runner) noexcept -> detail::array_indices_for_each_component< ComponentList >
Returns a vector of array_indices for each Component. The vector is filled with only those array_indi...
Definition: MockRuntimeSystemFreeFunctions.hpp:431
ActionTesting::is_threaded_action_queue_empty
bool is_threaded_action_queue_empty(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns true if there are no threaded actions in the queue.
Definition: MockRuntimeSystemFreeFunctions.hpp:354
ActionTesting::emplace_array_component_and_initialize
void emplace_array_component_and_initialize(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const NodeId node_id, const LocalCoreId local_core_id, const typename Component::array_index &array_index, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts) noexcept
Emplaces a distributed array object with index array_index into the parallel component Component....
Definition: MockRuntimeSystemFreeFunctions.hpp:122
ActionTesting::get_databox_tag
const auto & get_databox_tag(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns the Tag from the DataBox of the parallel component Component with array index array_index....
Definition: MockRuntimeSystemFreeFunctions.hpp:224
ActionTesting::invoke_random_queued_simple_action
void invoke_random_queued_simple_action(const gsl::not_null< MockRuntimeSystem * > runner, const gsl::not_null< Generator * > generator, const detail::array_indices_for_each_component< ComponentList > &array_indices) noexcept
Invokes the next queued action on a random Component on a random array_index of that component....
Definition: MockRuntimeSystemFreeFunctions.hpp:469
ActionTesting::get_databox
const auto & get_databox(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Retrieves the DataBox with tags TagsList (omitting the GlobalCache and add_from_options tags) from th...
Definition: MockRuntimeSystemFreeFunctions.hpp:195
ActionTesting::cache
Parallel::GlobalCache< Metavariables > & cache(MockRuntimeSystem< Metavariables > &runner, const ArrayIndex &array_index) noexcept
Returns the GlobalCache of Component with index array_index.
Definition: MockRuntimeSystemFreeFunctions.hpp:382
ActionTesting::simple_action
void simple_action(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index, Args &&... args) noexcept
Runs the simple action Action on the array_indexth element of the parallel component Component.
Definition: MockRuntimeSystemFreeFunctions.hpp:297
ActionTesting::number_of_queued_threaded_actions
size_t number_of_queued_threaded_actions(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns the number of threaded actions in the queue.
Definition: MockRuntimeSystemFreeFunctions.hpp:362
Gsl.hpp
ActionTesting::number_of_queued_simple_actions
size_t number_of_queued_simple_actions(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns the number of simple actions in the queue.
Definition: MockRuntimeSystemFreeFunctions.hpp:336
ActionTesting::emplace_singleton_component
void emplace_singleton_component(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const NodeId node_id, const LocalCoreId local_core_id, Options &&... opts) noexcept
Emplaces a distributed singleton object into the parallel component Component. The options opts are f...
Definition: MockRuntimeSystemFreeFunctions.hpp:61
ActionTesting::tag_is_retrievable
bool tag_is_retrievable(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns true if the tag Tag can be retrieved from the current DataBox of Component with index array_i...
Definition: MockRuntimeSystemFreeFunctions.hpp:266
Requires.hpp
ActionTesting::is_simple_action_queue_empty
bool is_simple_action_queue_empty(const MockRuntimeSystem< Metavariables > &runner, const typename Component::array_index &array_index) noexcept
Returns true if there are no simple actions in the queue.
Definition: MockRuntimeSystemFreeFunctions.hpp:328
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
ActionTesting::next_action
void next_action(const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index) noexcept
Invoke the next action in the ActionList on the parallel component Component on the component labeled...
Definition: MockRuntimeSystemFreeFunctions.hpp:278
ActionTesting::emplace_nodegroup_component_and_initialize
void emplace_nodegroup_component_and_initialize(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts) noexcept
Emplaces a distributed nodegroup object into the parallel component Component. The options opts are f...
Definition: MockRuntimeSystemFreeFunctions.hpp:180
ActionTesting::emplace_group_component
void emplace_group_component(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, Options &&... opts) noexcept
Emplaces a distributed group object into the parallel component Component. The options opts are forwa...
Definition: MockRuntimeSystemFreeFunctions.hpp:75
TMPL.hpp
ActionTesting::emplace_nodegroup_component
void emplace_nodegroup_component(const gsl::not_null< MockRuntimeSystem< typename Component::metavariables > * > runner, Options &&... opts) noexcept
Emplaces a distributed nodegroup object into the parallel component Component. The options opts are f...
Definition: MockRuntimeSystemFreeFunctions.hpp:88
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13