Manages state integration via signal discovery.
More...
#include <StateManager.hpp>
|
| | StateManager ()=default |
| void | DiscoverStates (const SignalRegistry< Scalar > ®istry) |
| | Discover integrable states from the registry.
|
| void | ZeroDerivatives () |
| | Zero all derivatives.
|
| std::size_t | TotalSize () const |
| | Get total state vector size.
|
| JanusVector< Scalar > | GetState () const |
| | Get copy of current state as a vector.
|
| void | SetState (const JanusVector< Scalar > &X) |
| | Set state from external vector.
|
| JanusVector< Scalar > | GetDerivatives () const |
| | Get copy of current derivatives as a vector.
|
| JanusVector< Scalar > | GetDerivatives (const std::unordered_set< std::string > &active_components) const |
| | Get derivatives with phase-based gating.
|
| const std::vector< StateBinding< Scalar > > & | GetBindings () const |
| | Get state bindings (for introspection).
|
| bool | IsAllocated () const |
| | Check if states have been discovered.
|
template<typename Scalar>
class icarus::StateManager< Scalar >
Manages state integration via signal discovery.
Discovers integrable states from the SignalRegistry during Stage(). Components register states with register_state() during Provision(), and StateManager builds the integration vector by gathering pointers.
- Template Parameters
-
| Scalar | Numeric type (double or casadi::MX) |
◆ StateManager()
template<typename Scalar>
◆ DiscoverStates()
template<typename Scalar>
Discover integrable states from the registry.
Queries the registry for all state pairs registered via register_state(). Builds internal binding vector with pointers to each state/derivative.
- Parameters
-
◆ GetBindings()
template<typename Scalar>
Get state bindings (for introspection).
◆ GetDerivatives() [1/2]
template<typename Scalar>
Get copy of current derivatives as a vector.
Gathers derivative values from component-owned storage.
◆ GetDerivatives() [2/2]
template<typename Scalar>
| JanusVector< Scalar > icarus::StateManager< Scalar >::GetDerivatives |
( |
const std::unordered_set< std::string > & | active_components | ) |
const |
|
inlinenodiscard |
Get derivatives with phase-based gating.
Returns derivatives for active components, zeros for inactive ones. This "freezes" states for components not active in the current phase.
- Parameters
-
| active_components | Set of component names that are active. Empty set means all components are active. |
- Returns
- Derivative vector with zeros for inactive components
◆ GetState()
template<typename Scalar>
Get copy of current state as a vector.
Gathers state values from component-owned storage into a JanusVector.
◆ IsAllocated()
template<typename Scalar>
Check if states have been discovered.
◆ SetState()
template<typename Scalar>
Set state from external vector.
Scatters values from JanusVector back to component-owned storage.
- Parameters
-
| X | New state vector (must match size) |
◆ TotalSize()
template<typename Scalar>
Get total state vector size.
◆ ZeroDerivatives()
template<typename Scalar>
Zero all derivatives.
Called before each Step() to ensure components accumulate derivatives.
The documentation for this class was generated from the following file: