BaseStepController
- class cubie.integrators.step_control.base_step_controller.BaseStepController(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], dt: float = None, n_states: int = 1, **kwargs)[source]
Bases:
CUDAFactoryFactory interface for compiling CUDA step-size controllers.
- __init__(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], dt: float = None, n_states: int = 1, **kwargs) None[source]
Initialise the step controller.
- Parameters:
precision – Precision used for controller calculations.
dt – Step size or initial step size.
n_states – Number of state variables.
**kwargs – Additional parameters passed to the config class.
- _apply_filter_coefficients(params: dict) set[str][source]
Translate
filter_coefficientsinparamsinto gains.- Parameters:
params – Mutable settings mapping; modified in place.
- Returns:
The consumed keys.
- Return type:
- Raises:
ValueError – On mixed gain and filter input, or an unsupported gain.
- build() ControllerCache[source]
Compile the controller and record its bounds and tolerances.
- Returns:
The compiled controller with its products filled in.
- Return type:
ControllerCache
- abstractmethod compile_controller() ControllerCache[source]
Compile the controller device function.
- Returns:
The compiled controller.
- Return type:
ControllerCache
- register_buffers() None[source]
Register controller buffers with the central buffer registry.
Registers the
timestep_bufferat_timestep_buffer_elementshistory slots in the location given bycompile_settings.timestep_memory_location. Controllers that keep no history (_timestep_buffer_elements == 0) register nothing, so the registry owns the size like every other buffer-registered class.
- settings_keys: frozenset | None = frozenset({'algorithm_order', 'atol', 'deadband_max', 'deadband_min', 'derivative_gain', 'dt', 'dt_max', 'dt_min', 'filter_coefficients', 'integral_gain', 'mass_flags', 'max_step_growth', 'min_step_shrink', 'n_states', 'newton_target_iters', 'precision', 'proportional_gain', 'rtol', 'safety', 'step_controller', 'timestep_memory_location'})
Loose keys the factory accepts;
Noneaccepts every field.
- classmethod system_inputs(system: Any, algorithm_order: int) Dict[str, Any][source]
Return controller settings from a system object and step order.
- update(updates_dict: dict[str, object] | None = None, silent: bool = False, **kwargs: object) set[str][source]
Propagate configuration updates to the compiled controller.
- Parameters:
updates_dict – Dictionary of configuration values to update.
silent – When
Truesuppress warnings for recognised but unused controller parameters.**kwargs – Additional configuration key-value pairs to update.
- Returns:
Names of parameters that were applied successfully.
- Return type:
- Raises:
KeyError – Raised when an update references parameters that are not defined for any controller.