SpECTRE  v2022.09.02
control_system::TestHelpers::SystemHelper< Metavars > Struct Template Reference

Helper struct for testing basic control systems. More...

#include <SystemHelpers.hpp>

Public Types

using control_systems = typename Metavars::control_systems
 
using element_component = typename Metavars::element_component
 
using control_components = typename Metavars::control_components
 

Public Member Functions

auto & domain ()
 
auto & initial_functions_of_time ()
 
auto & initial_measurement_timescales ()
 
template<typename System >
const auto & init_tuple ()
 
const auto & horizon_a ()
 
const auto & horizon_b ()
 
template<typename System >
std::string name ()
 
template<typename F >
void setup_control_system_test (const double initial_time, const double initial_separation, const std::string &option_string, const F initialize_functions_of_time)
 Setup the test. More...
 
template<typename Generator , typename F >
void run_control_system_test (ActionTesting::MockRuntimeSystem< Metavars > &runner, const double final_time, gsl::not_null< Generator * > generator, const F horizon_function, const size_t number_of_horizons)
 Actually run the control system test. More...
 

Detailed Description

template<typename Metavars>
struct control_system::TestHelpers::SystemHelper< Metavars >

Helper struct for testing basic control systems.

To signify which control systems you want, set the corresponding DerivOrder. To turn control systems off, put 0 for their DerivOrder in the templates of the metavariables.

Ideally we'd construct the runner here and just pass that to the test to simplify as must of the work as possible, but MockRuntimeSystems aren't copy- or move-able so we have to make the necessary info available. The simplest way to do this was to have functions that return references to the member variables.

Note
Translation control isn't supported yet. It will be added in the future.

Member Function Documentation

◆ run_control_system_test()

template<typename Metavars >
template<typename Generator , typename F >
void control_system::TestHelpers::SystemHelper< Metavars >::run_control_system_test ( ActionTesting::MockRuntimeSystem< Metavars > &  runner,
const double  final_time,
gsl::not_null< Generator * >  generator,
const F  horizon_function,
const size_t  number_of_horizons 
)
inline

Actually run the control system test.

The horizon_function should return a std::pair<Strahlkorper<Frame::Grid>, Strahlkorper<Frame::Grid>> representing the two horizons in the grid frame. This means the user is responsible for doing any coordinate transformations inside horizon_function as this function won't do any. The number_of_horizons is used to determine if we actually use both horizon "measurements" as some control systems may only need one. If only one horizon is used, the default is to use AhA.

For the basic control systems, a common function is defined for you: control_system::TestHelpers::build_horizons_for_basic_control_systems().

◆ setup_control_system_test()

template<typename Metavars >
template<typename F >
void control_system::TestHelpers::SystemHelper< Metavars >::setup_control_system_test ( const double  initial_time,
const double  initial_separation,
const std::string option_string,
const F  initialize_functions_of_time 
)
inline

Setup the test.

The function initialize_functions_of_time must take a const gsl::not_null<std::unordered_map<std::string, std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>*> for the function of time map, a const double for the initial time, and a const std::unordered_map<std::string, double>& for the expiration times. This function will initialize the functions of time and must return a double that represents the radius of the excision spheres. Some existing functions are given in the control_system::TestHelpers namespace for Expansion, Rotation, and Translation.


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