SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
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
using MutableCacheTuple
using mock_objects_tags
using CollectionOfMockDistributedObjects
using Inboxes

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 const and mutable tags 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>
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, 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 Parallel::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 queue_simple_action (const typename Component::array_index &array_index, Arg0 &&arg0, Args &&... args)
 Queue the simple action Action on the Component labeled by array_index.
template<typename Component, typename Action>
void queue_simple_action (const typename Component::array_index &array_index)
 Queue the simple action Action on the Component labeled by array_index.
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>
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 CatchMatcher>
bool next_action_if_ready (const typename Component::array_index &array_index, const CatchMatcher &matcher)
 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>
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.

Member Typedef Documentation

◆ CacheTuple

template<typename Metavariables>
using ActionTesting::MockRuntimeSystem< Metavariables >::CacheTuple
Initial value:
tuples::tagged_tuple_from_typelist<
tmpl::remove_duplicates< tmpl::flatten< tmpl::list< typename detail::get_const_global_cache_tags_from_parallel_struct< Metavariables >::type, tmpl::transform< typename Metavariables::component_list, detail::get_const_global_cache_tags_from_parallel_struct< tmpl::_1 > >, tmpl::transform< typename Metavariables::component_list, detail::get_const_global_cache_tags_from_component< tmpl::_1 > > > > > get_const_global_cache_tags
Given the metavariables, get a list of the unique tags that will specify the items in the GlobalCache...
Definition ParallelComponentHelpers.hpp:127

◆ CollectionOfMockDistributedObjects

template<typename Metavariables>
using ActionTesting::MockRuntimeSystem< Metavariables >::CollectionOfMockDistributedObjects
Initial value:
tuples::tagged_tuple_from_typelist<mock_objects_tags>

◆ Inboxes

template<typename Metavariables>
using ActionTesting::MockRuntimeSystem< Metavariables >::Inboxes
Initial value:
tuples::tagged_tuple_from_typelist<
tmpl::transform<typename Metavariables::component_list,
tmpl::bind<InboxesTag, tmpl::_1>>>

◆ mock_objects_tags

template<typename Metavariables>
using ActionTesting::MockRuntimeSystem< Metavariables >::mock_objects_tags
Initial value:
tmpl::transform<typename Metavariables::component_list,
tmpl::bind<MockDistributedObjectsTag, tmpl::_1>>

◆ MutableCacheTuple

template<typename Metavariables>
using ActionTesting::MockRuntimeSystem< Metavariables >::MutableCacheTuple
Initial value:
tuples::tagged_tuple_from_typelist<
tmpl::remove_duplicates< tmpl::flatten< tmpl::list< typename detail::get_mutable_global_cache_tags_from_parallel_struct< Metavariables >::type, tmpl::transform< typename Metavariables::component_list, detail::get_mutable_global_cache_tags_from_parallel_struct< tmpl::_1 > >, tmpl::transform< typename Metavariables::component_list, detail::get_mutable_global_cache_tags_from_component< tmpl::_1 > > > > > get_mutable_global_cache_tags
Given the metavariables, get a list of the unique tags that will specify the mutable items in the Glo...
Definition ParallelComponentHelpers.hpp:144

The documentation for this class was generated from the following file:
  • tests/Unit/Framework/MockRuntimeSystem.hpp