Namespaces | Functions
MockRuntimeSystemFreeFunctions.hpp File Reference
#include <cstddef>
#include <random>
#include <utility>
#include <vector>
#include "Framework/MockRuntimeSystem.hpp"
#include "Utilities/Gsl.hpp"
#include "Utilities/Requires.hpp"
#include "Utilities/TMPL.hpp"
#include "Utilities/TypeTraits.hpp"

Go to the source code of this file.

Namespaces

 ActionTesting
 Structures used for mocking the parallel components framework in order to test actions.
 

Functions

template<typename Metavariables >
void ActionTesting::set_phase (const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Metavariables::Phase &phase) noexcept
 Set the phase of all parallel components to phase
 
template<typename Component , typename... Options>
void ActionTesting::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. The options opts are forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply.
 
template<typename Component , typename... Options>
void ActionTesting::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. The options opts are forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply.
 
template<typename Component , typename... Options>
void ActionTesting::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 forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply.
 
template<typename Component , typename... Options>
void ActionTesting::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 forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply.
 
template<typename Component , typename... Options>
void ActionTesting::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 forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply.
 
template<typename Component , typename... Options, typename Metavars = typename Component::metavariables, Requires< detail::has_initialization_phase_v< Metavars >> = nullptr>
void ActionTesting::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. The options opts are forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply Additionally, the simple tags in the DataBox are initialized from the values set in initial_values.
 
template<typename Component , typename... Options, typename Metavars = typename Component::metavariables, Requires< detail::has_initialization_phase_v< Metavars >> = nullptr>
void ActionTesting::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. The options opts are forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply Additionally, the simple tags in the DataBox are initialized from the values set in initial_values.
 
template<typename Component , typename... Options, typename Metavars = typename Component::metavariables, Requires< detail::has_initialization_phase_v< Metavars >> = nullptr>
void ActionTesting::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 forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply Additionally, the simple tags in the DataBox are initialized from the values set in initial_values.
 
template<typename Component , typename... Options, typename Metavars = typename Component::metavariables, Requires< detail::has_initialization_phase_v< Metavars >> = nullptr>
void ActionTesting::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 forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply Additionally, the simple tags in the DataBox are initialized from the values set in initial_values.
 
template<typename Component , typename... Options, typename Metavars = typename Component::metavariables, Requires< detail::has_initialization_phase_v< Metavars >> = nullptr>
void ActionTesting::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 forwarded to be used in a call to detail::ForwardAllOptionsToDataBox::apply Additionally, the simple tags in the DataBox are initialized from the values set in initial_values.
 
template<typename Component , typename Metavariables >
size_t ActionTesting::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.
 
template<typename Component , typename Tag , typename Metavariables >
const auto & ActionTesting::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. If the component's current DataBox type does not contain Tag then an error is emitted.
 
template<typename Component , typename Tag , typename Metavariables >
bool ActionTesting::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. If the tag is not contained, returns false.
 
template<typename Component , typename Tag , typename Metavariables >
bool ActionTesting::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_index.
 
template<typename Component , typename Metavariables >
void ActionTesting::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 by array_index, failing if it was not ready.
 
template<typename Component , typename Metavariables >
bool ActionTesting::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 by array_index, returning whether it was ready.
 
template<typename Component , typename Action , typename Metavariables , typename... Args>
void ActionTesting::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.
 
template<typename Component , typename Action , typename Metavariables , typename... Args>
void ActionTesting::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.
 
template<typename Component , typename Metavariables >
void ActionTesting::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.
 
template<typename Component , typename Metavariables >
bool ActionTesting::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.
 
template<typename Component , typename Metavariables >
size_t ActionTesting::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.
 
template<typename Component , typename Metavariables >
void ActionTesting::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.
 
template<typename Component , typename Metavariables >
bool ActionTesting::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.
 
template<typename Component , typename Metavariables >
size_t ActionTesting::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.
 
template<typename Component , typename Metavariables >
bool ActionTesting::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.
 
template<typename Component , typename Metavariables , typename ArrayIndex >
Parallel::GlobalCache< Metavariables > & ActionTesting::cache (MockRuntimeSystem< Metavariables > &runner, const ArrayIndex &array_index) noexcept
 Returns the GlobalCache of Component with index array_index.
 
template<typename ComponentList , typename MockRuntimeSystem , typename ArrayIndex >
std::vector< size_t > ActionTesting::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 actions, for a particular array_index.
 
template<typename ComponentList , typename MockRuntimeSystem >
auto ActionTesting::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_indices for which there are queued simple actions.
 
template<typename ComponentList >
size_t ActionTesting::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 indices that have queued simple actions.
 
template<typename ComponentList , typename MockRuntimeSystem , typename Generator >
void ActionTesting::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. array_indices is the thing returned by array_indices_with_queued_simple_actions
 
template<typename Component , typename TagsList , typename Metavariables >
const auto & ActionTesting::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 the parallel component Component with index array_index.
 
template<typename Component , typename TagsList , typename Metavariables >
auto & ActionTesting::get_databox (const gsl::not_null< 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 the parallel component Component with index array_index.
 
template<typename Component , typename InboxTag , typename Metavariables >
const auto & ActionTesting::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.
 
template<typename Component , typename InboxTag , typename Metavariables >
auto & ActionTesting::get_inbox_tag (const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index) noexcept
 Returns the InboxTag from the parallel component Component with array index array_index.
 
template<typename Component , typename TagsList , typename Metavariables >
const auto & ActionTesting::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 the parallel component Component with index array_index.
 
template<typename Component , typename TagsList , typename Metavariables >
auto & ActionTesting::get_databox (const gsl::not_null< 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 the parallel component Component with index array_index.
 
template<typename Component , typename InboxTag , typename Metavariables >
const auto & ActionTesting::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.
 
template<typename Component , typename InboxTag , typename Metavariables >
auto & ActionTesting::get_inbox_tag (const gsl::not_null< MockRuntimeSystem< Metavariables > * > runner, const typename Component::array_index &array_index) noexcept
 Returns the InboxTag from the parallel component Component with array index array_index.
 

Detailed Description

Defines free functions that wrap MockRuntimeSystem member functions.