SpECTRE  v2021.11.01
ActionTesting::MockRuntimeSystem< Metavariables > Class Template Reference

A class that mocks the infrastructure needed to run actions. It simulates message passing using the inbox infrastructure and handles most of the arguments to the apply method. This mocks the Charm++ runtime system as well as the layer built on top of it as part of SpECTRE. More...

#include <MockRuntimeSystem.hpp>

Classes

struct  InboxesTag
 
struct  MockDistributedObjectsTag
 

Public Types

using GlobalCache = Parallel::GlobalCache< Metavariables >
 
using CacheTuple = tuples::tagged_tuple_from_typelist< Parallel::get_const_global_cache_tags< Metavariables > >
 
using MutableCacheTuple = tuples::tagged_tuple_from_typelist< Parallel::get_mutable_global_cache_tags< Metavariables > >
 
using mock_objects_tags = tmpl::transform< typename Metavariables::component_list, tmpl::bind< MockDistributedObjectsTag, tmpl::_1 > >
 
using CollectionOfMockDistributedObjects = tuples::tagged_tuple_from_typelist< mock_objects_tags >
 
using Inboxes = tuples::tagged_tuple_from_typelist< tmpl::transform< typename Metavariables::component_list, tmpl::bind< InboxesTag, tmpl::_1 > > >
 

Public Member Functions

 MockRuntimeSystem (const MockRuntimeSystem &)=delete
 
 MockRuntimeSystem (MockRuntimeSystem &&)=delete
 
MockRuntimeSystemoperator= (const MockRuntimeSystem &)=delete
 
MockRuntimeSystemoperator= (MockRuntimeSystem &&)=delete
 
 MockRuntimeSystem (CacheTuple cache_contents, MutableCacheTuple mutable_cache_contents={}, const std::vector< size_t > &number_of_mock_cores_on_each_mock_node={1})
 Construct from the tuple of GlobalCache objects.
 
template<typename... CacheTags, typename... MutableCacheTags>
 MockRuntimeSystem (tuples::TaggedTuple< CacheTags... > cache_contents, tuples::TaggedTuple< MutableCacheTags... > mutable_cache_contents={}, const std::vector< size_t > &number_of_mock_cores_on_each_mock_node={1})
 Construct from the tuple of GlobalCache and MutableGlobalCache objects that might be in a different order.
 
template<typename Component , typename... Options>
void emplace_array_component (const NodeId node_id, const LocalCoreId local_core_id, const typename Component::array_index &array_index, Options &&... opts)
 Emplace an array component that does not need to be initialized.
 
template<typename Component , typename... Options>
void emplace_singleton_component (const NodeId node_id, const LocalCoreId local_core_id, Options &&... opts)
 Emplace a singleton component that does not need to be initialized.
 
template<typename Component , typename... Options>
void emplace_group_component (Options &&... opts)
 Emplace a group component that does not need to be initialized.
 
template<typename Component , typename... Options>
void emplace_nodegroup_component (Options &&... opts)
 Emplace a nodegroup component that does not need to be initialized.
 
template<typename Component , typename... Options>
void emplace_component (const typename Component::array_index &array_index, Options &&... opts)
 Emplace a component that does not need to be initialized. emplace_component is deprecated in favor of emplace_array_component, emplace_singleton_component, emplace_group_component, and emplace_nodegroup_component.
 
template<typename Component , typename... Options>
void emplace_array_component_and_initialize (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)
 Emplace an array component that needs to be initialized.
 
template<typename Component , typename... Options>
void emplace_singleton_component_and_initialize (const NodeId node_id, const LocalCoreId local_core_id, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts)
 Emplace a singleton component that needs to be initialized.
 
template<typename Component , typename... Options>
void emplace_group_component_and_initialize (const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts)
 Emplace a group component that needs to be initialized.
 
template<typename Component , typename... Options>
void emplace_nodegroup_component_and_initialize (const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts)
 Emplace a nodegroup component that needs to be initialized.
 
template<typename Component , typename... Options, typename Metavars = Metavariables, Requires< detail::has_initialization_phase_v< Metavars > > = nullptr>
void emplace_component_and_initialize (const typename Component::array_index &array_index, const typename detail::get_initialization< Component >::InitialValues &initial_values, Options &&... opts)
 Emplace a component that needs to be initialized. emplace_component_and_initialize is deprecated in favor of emplace_array_component_and_initialize, emplace_singleton_component_and_initialize, emplace_group_component_and_initialize, and emplace_nodegroup_component_and_initialize.
 
template<typename Component >
bool is_simple_action_queue_empty (const typename Component::array_index &array_index) const
 Return true if there are no queued simple actions on the Component labeled by array_index.
 
template<typename Component >
size_t number_of_queued_simple_actions (const typename Component::array_index &array_index) const
 Return the number of queued simple actions on the Component labeled by array_index.
 
template<typename Component >
void invoke_queued_simple_action (const typename Component::array_index &array_index)
 Invoke the next queued simple action on the Component labeled by array_index.
 
template<typename Component >
bool is_threaded_action_queue_empty (const typename Component::array_index &array_index) const
 Return true if there are no queued threaded actions on the Component labeled by array_index.
 
template<typename Component >
size_t number_of_queued_threaded_actions (const typename Component::array_index &array_index) const
 Return the number of queued threaded actions on the Component labeled by array_index.
 
template<typename Component >
void invoke_queued_threaded_action (const typename Component::array_index &array_index)
 Invoke the next queued threaded action on the Component labeled by array_index.
 
template<typename Component , typename Action >
void force_next_action_to_be (const typename Component::array_index &array_index)
 Instead of the next call to next_action applying the next action in the action list, force the next action to be Action
 
template<typename Component >
size_t get_next_action_index (const typename Component::array_index &array_index) const
 Obtain the index into the action list of the next action.
 
template<typename Component >
void next_action (const typename Component::array_index &array_index)
 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 >
bool next_action_if_ready (const typename Component::array_index &array_index)
 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 InboxTag >
auto nonempty_inboxes () -> std::unordered_set< typename Component::array_index >
 Find the set of array indices on Component where the specified inbox is not empty.
 
template<typename Component >
auto & mock_distributed_objects ()
 Access the mocked distributed objects for a component, indexed by array index.
 
template<typename Component >
const auto & mock_distributed_objects () const
 
void set_phase (const typename Metavariables::Phase next_phase)
 Set the phase of all parallel components to next_phase
 
size_t num_global_cores () const
 Return number of (mock) global cores.
 
size_t num_nodes () const
 Return number of (mock) nodes.
 
template<typename Component , typename Action , typename Arg0 , typename... Args>
void simple_action (const typename Component::array_index &array_index, Arg0 &&arg0, Args &&... args)
 Invoke the simple action Action on the Component labeled by array_index immediately.
 
template<typename Component , typename Action >
void simple_action (const typename Component::array_index &array_index)
 Invoke the simple action Action on the Component labeled by array_index immediately.
 
template<typename Component , typename Action , typename Arg0 , typename... Args>
void threaded_action (const typename Component::array_index &array_index, Arg0 &&arg0, Args &&... args)
 Invoke the threaded action Action on the Component labeled by array_index immediately.
 
template<typename Component , typename Action >
void threaded_action (const typename Component::array_index &array_index)
 Invoke the threaded action Action on the Component labeled by array_index immediately.
 
template<typename Component >
auto inboxes () -> std::unordered_map< typename Component::array_index, tuples::tagged_tuple_from_typelist< typename MockDistributedObject< Component >::inbox_tags_list > > &
 Access the inboxes for a given component.
 
template<typename Component >
auto inboxes () const -> const std::unordered_map< typename Component::array_index, tuples::tagged_tuple_from_typelist< typename MockDistributedObject< Component >::inbox_tags_list > > &
 Access the inboxes for a given component.
 

Detailed Description

template<typename Metavariables>
class ActionTesting::MockRuntimeSystem< Metavariables >

A class that mocks the infrastructure needed to run actions. It simulates message passing using the inbox infrastructure and handles most of the arguments to the apply method. This mocks the Charm++ runtime system as well as the layer built on top of it as part of SpECTRE.


The documentation for this class was generated from the following file: